Capital gains tax on stocks and ETFs: rates, losses and the wash sale rule
When you sell a stock, an ETF or a mutual fund for more than you paid, the profit is subject to capital gains tax. How much you owe depends above all on one date: whether you held the investment for more than a year. Long-term gains get their own, much lower rates, starting at 0%. This article explains the 2026 rates, how gains stack on top of other income, how losses help, and the wash sale rule that limits them.
Short-term and long-term capital gains
A capital gain is the sale price minus your cost basis, which is usually the purchase price plus commissions. If you held the asset for more than one year, the gain is long-term; if you held it for one year or less, it is short-term. The holding period counts from the day after you bought the asset up to and including the day you sold it (IRS Topic 409 2026).
Short-term gains are taxed like wages, at your ordinary income tax rate of 10% to 37%. Long-term gains are taxed at 0%, 15% or 20%, depending on your taxable income. The difference is large: in the 24% bracket, waiting a few days past the one-year mark can cut the tax on a gain from 24% to 15%. A gain is only taxed when it is realized, that is, when you sell. Rising prices on investments you keep cost nothing in tax, which is why buy and hold is tax-efficient on its own.
Capital gain = sale price − cost basis- sale price
- proceeds after commissions
- cost basis
- purchase price plus commissions, plus reinvested dividends for funds
Capital gains tax rates for 2026
The thresholds for long-term gains are adjusted for inflation every year. For 2026 they are (Rev. Proc. 2025-32 2025):
| Filing status | 0% up to | 15% up to |
|---|---|---|
| Single | $49,450 | $545,500 |
| Married filing jointly | $98,900 | $613,700 |
| Head of household | $66,200 | $579,600 |
| Married filing separately | $49,450 | $306,850 |
The limits refer to taxable income including the gains. Above the 15% limit, long-term gains are taxed at 20%.
Two additions can raise the rate. The net investment income tax adds 3.8% on investment income, including capital gains and dividends, to the extent that modified adjusted gross income exceeds $200,000 for single filers or $250,000 for married couples filing jointly (IRS Topic 559 2026). And gains on collectibles such as coins or art are taxed at up to 28% (IRS Topic 409 2026). On top of the federal tax, most states tax capital gains as ordinary income; a few have no income tax at all.
The IRS publishes the thresholds for the following year each autumn. The figures above apply to sales in calendar year 2026.
How gains stack on top of other income
Long-term gains are counted last. Your wages, interest and short-term gains fill the brackets first, and the long-term gains sit on top. The part of the gain that still fits under the 0% threshold is tax-free, the rest is taxed at 15%. Short-term gains, by contrast, are simply added to your ordinary income.
The 0% bracket is a real opportunity in years with low income, for example early in retirement or during a sabbatical. Selling appreciated shares up to the threshold and buying them back right away resets the cost basis at no tax cost. The wash sale rule does not apply to gains, only to losses.
Dividends, interest and fund distributions
Dividends come in two kinds. Qualified dividends are taxed at the same 0%, 15% and 20% rates as long-term gains. To qualify, you must have held the stock for more than 60 days during the 121-day period that begins 60 days before the ex-dividend date (IRS Publication 550 2025). Most dividends from US companies and many foreign ones held long enough qualify. Ordinary dividends, including most distributions from money market funds and REITs, are taxed as regular income.
Interest from bonds and savings accounts is ordinary income too. Interest on Treasury bills, notes and bonds is subject to federal income tax but exempt from state and local income taxes (IRS Publication 550 2025). Mutual funds also pass realized capital gains on to their shareholders once a year, even if you never sold a share. Many index ETFs make such distributions rarely, which is one reason they are popular in taxable accounts (ETF basics).
Capital losses and tax-loss harvesting
Losses are subtracted from gains in the same year. If losses exceed gains, up to $3,000 of the net loss ($1,500 if married filing separately) can be deducted against other income each year, and the rest carries forward to later years without expiring (IRS Topic 409 2026).
Tax-loss harvesting uses this deliberately: you sell an investment that has fallen below its cost, book the loss and buy a similar but not identical investment so that your portfolio stays invested. Constantinides (1983) showed that, with taxes on realized gains, it is optimal to realize losses early and postpone gains. How much that is worth was measured by Chaudhuri et al. (2020) with the 500 largest US stocks from 1926 to 2018: with tax rates of 15% on long-term and 35% on short-term gains, the strategy yielded 1.08% a year before costs, and 0.82% when the wash sale rule was respected. Berkin and Ye (2003) found that regular contributions and volatile holdings make harvesting more productive, while withdrawals reduce the benefit.
The wash sale rule
A loss does not count if you buy the same investment again too soon. A wash sale occurs when you sell stock or securities at a loss and within 30 days before or after the sale you buy substantially identical stock or securities, acquire a contract or option to buy them, or buy them in your IRA or Roth IRA. Purchases by your spouse or by a corporation you control count too (IRS Publication 550 2025).
The loss is not lost in most cases, only postponed: it is added to the cost basis of the new shares, and the holding period of the old shares carries over. The exception is a repurchase inside an IRA or Roth IRA, where the basis adjustment does not apply (IRS Publication 550 2025). Automatic dividend reinvestment and recurring purchases can trigger a wash sale without anyone noticing, so check them around the date of a harvesting sale.
The law does not define exactly when two funds are substantially identical. Selling one S&P 500 fund and buying another S&P 500 fund from a different provider is generally considered risky. Switching to a fund that tracks a different but similar index, for example from the S&P 500 to a total market index, is the common way to stay invested.
Cost basis, lots and the step-up at death
If you bought the same fund at different times, each purchase is a separate lot with its own cost basis. Many brokers use first in, first out by default; with specific identification you choose which lot to sell, for example the one with the highest cost to keep the gain small, or a lot held for more than a year to get the long-term rate. Reinvested dividends are new purchases that add to the basis.
Assets inherited from someone who dies get a new cost basis equal to their market value at the date of death (26 U.S.C. § 1014 1954). Gains that built up during the original owner's lifetime are never taxed as capital gains. That is why selling highly appreciated shares late in life can be expensive compared with holding them, a point that matters for estate planning, not for everyday investing.
Where to hold what
Inside a 401(k), IRA or HSA, gains, dividends and interest are not taxed year by year, so the rules above only apply to taxable brokerage accounts (401(k) vs. IRA, Roth vs. traditional). If you have both, the question is which investments go where, known as asset location. Dammon et al. (2004) show how taxable and tax-deferred accounts should be combined. A common rule derived from that work: assets that produce a lot of ordinary income, such as bond funds and REITs, belong in the tax-advantaged accounts first, broad stock index funds in the taxable account.
On portfolio-lab.net, backtests include fund costs but show results before taxes, because the tax depends on your account type, holding period and income. The comparison of two portfolios is therefore fair, but a taxable account will earn somewhat less than the backtest shows.
Common mistakes
- Selling a few days before the one-year mark: the gain is then short-term and taxed at your ordinary rate.
- Thinking reinvestment avoids tax: selling and buying something else in a taxable account realizes the gain, even if no money leaves the account.
- Triggering a wash sale by accident: dividend reinvestment, a purchase in an IRA or a spouse's account within 30 days.
- Harvesting losses and forgetting the basis: the lower basis means more tax later unless the gain is taxed at a lower rate or never realized.
- Letting taxes dominate: holding a concentrated position for years just to avoid tax can cost more in risk than the tax would have.
- Ignoring the 0% bracket: in low-income years, gains can often be realized tax-free.
This article explains general federal rules and is not tax advice. State taxes, special assets and your full return can change the result; check current IRS guidance or ask a tax professional.
Frequently asked questions
How much is capital gains tax on stocks?
It depends on how long you held the stock and on your income. Gains on stocks held more than a year are taxed at 0%, 15% or 20%: in 2026, 0% for single filers with taxable income up to $49,450 and 15% up to $545,500. Gains on stocks held one year or less are taxed at your ordinary income tax rate of 10% to 37%. High earners may owe an extra 3.8% net investment income tax.
How long do I have to hold a stock to pay the long-term rate?
More than one year. The holding period starts the day after you buy and includes the day you sell, so shares bought on March 3 qualify for the long-term rate if they are sold on March 4 of the next year or later.
Do I pay capital gains tax if I reinvest the money?
Yes, in a taxable account. A sale realizes the gain even if the proceeds stay in the account and buy another investment. Inside a 401(k), IRA or HSA, buying and selling has no tax consequences.
How can I reduce capital gains tax legally?
Hold investments for more than a year, realize gains in years when your income falls into the 0% bracket, use tax-advantaged accounts, harvest losses to offset gains, choose which lots to sell, and donate appreciated shares instead of cash. Inherited assets receive a stepped-up basis.
What is the wash sale rule?
If you sell a security at a loss and buy the same or a substantially identical security within 30 days before or after the sale, including in an IRA or by your spouse, the loss is disallowed for now. It is added to the cost basis of the new shares, except for purchases in an IRA, where it is lost.
Do ETFs pay capital gains tax?
You pay capital gains tax when you sell ETF shares for a profit, at the short-term or long-term rate. In addition, funds can distribute capital gains to shareholders. Many index ETFs do that rarely, which makes them tax-efficient in a taxable brokerage account.
Literature
- Berkin, Andrew L.; Ye, Jia (2003): Tax Management, Loss Harvesting, and HIFO Accounting. Financial Analysts Journal 59 (4), pp. 91–102. doi:10.2469/faj.v59.n4.2548
- Chaudhuri, Shomesh E.; Burnham, Terence C.; Lo, Andrew W. (2020): An Empirical Evaluation of Tax-Loss-Harvesting Alpha. Financial Analysts Journal 76 (3), pp. 99–108. doi:10.1080/0015198X.2020.1760064
- Constantinides, George M. (1983): Capital Market Equilibrium with Personal Tax. Econometrica 51 (3). doi:10.2307/1912150
- Dammon, Robert M.; Spatt, Chester S.; Zhang, Harold H. (2004): Optimal Asset Location and Allocation with Taxable and Tax-Deferred Investing. The Journal of Finance 59 (3), pp. 999–1037. doi:10.1111/j.1540-6261.2004.00655.x
- Internal Revenue Service (2025): Revenue Procedure 2025-32: inflation-adjusted items for 2026. Internal Revenue Bulletin 2025-45; accessed November 2, 2026. Source
- Internal Revenue Service (2025): IRS releases tax inflation adjustments for tax year 2026, including amendments from the One, Big, Beautiful Bill. IRS news release IR-2025-103, October 9, 2025; accessed November 2, 2026. Source
- Internal Revenue Service (2025): Publication 550 (2025), Investment Income and Expenses. Internal Revenue Service; accessed November 2, 2026. Source
- Internal Revenue Service (2026): Topic no. 409, Capital gains and losses. Internal Revenue Service, last reviewed September 24, 2026; accessed November 2, 2026. Source
- Internal Revenue Service (2026): Topic no. 559, Net investment income tax. Internal Revenue Service, last reviewed September 24, 2026; accessed November 2, 2026. Source
- United States Congress (1954): United States Code, Title 26 (Internal Revenue Code), § 1014 Basis of property acquired from a decedent. Legal Information Institute, Cornell Law School; accessed October 26, 2026. Source
This article explains a method; it is not investment or tax advice. Worked examples are simplified and rounded. All terms in the glossary.