Tax-Loss Harvesting: How to Cut Your Capital Gains Tax
Learn how selling investments at a loss offsets capital gains and up to $3,000 of income, how the wash sale rule works, and what harvesting is really worth.
Published
Free tool: Capital Gains Tax CalculatorTax-loss harvesting means selling investments that are worth less than you paid, so the loss offsets your taxable gains. Done well, it can cut this year's tax bill by thousands of dollars without changing your investment plan. This guide shows the rules and the math, using the free Capital Gains Tax Calculator. For how gains are taxed in the first place, see Capital Gains Tax: 2026 and 2027 Rates.
How losses offset gains
When you sell at a loss, the IRS lets you use it against your gains in this order:
- Like against like. Short-term losses offset short-term gains first, and long-term losses offset long-term gains.
- Then across. A net loss in one group offsets a net gain in the other.
- Then income. Up to $3,000 of a remaining net loss ($1,500 if married filing separately) offsets ordinary income such as wages.
- Then later years. Anything left carries forward with no time limit.
Example: offsetting a long-term gain
You're single with $136,100 of wages in 2026, which leaves $120,000 of taxable income after the standard deduction. You sell a fund for $50,000 that you bought for $30,000, a $20,000 long-term gain.
- Without harvesting: the gain falls in the 15% bracket: $3,000 of federal tax.
- With harvesting: you also sell another fund at a $15,000 loss. The net gain is $5,000: $750 of tax.
- Saving: $2,250 this year, plus any state tax on the $15,000.
Losses are worth more against short-term gains
Short-term gains, on investments held a year or less, are taxed at ordinary income rates. With the same $120,000 of taxable income, a $10,000 short-term gain costs $2,400 at 24%, against $1,500 for the same gain held long term. A harvested loss that offsets it saves the full $2,400.
What a $10,000 harvested loss saves in federal tax, depending on what it offsets:
| Offsets | Tax rate | Federal tax saved |
|---|---|---|
| Long-term gains in the 0% bracket | 0% | $0 |
| Long-term gains in the 15% bracket | 15% | $1,500 |
| Long-term gains, 15% plus the 3.8% NIIT | 18.8% | $1,880 |
| Long-term gains, 20% plus the 3.8% NIIT | 23.8% | $2,380 |
| Short-term gains in the 24% bracket | 24% | $2,400 |
| Short-term gains in the 35% bracket | 35% | $3,500 |
| $3,000 of wages in the 24% bracket, rest carried forward | 24% | $720 now |
The wash sale rule
You can't sell at a loss and buy straight back in. If you buy the same or a "substantially identical" security within 30 days before or after the sale, a 61-day window, the loss is disallowed for now. The rule also catches purchases by your spouse and in your IRAs. A disallowed loss isn't lost forever: it's added to the cost basis of the new shares.
To stay invested, many investors switch to a similar but not identical fund, such as one tracking a different index. The IRS hasn't defined "substantially identical" precisely, so be conservative, and turn off automatic dividend reinvestment in the fund you sell.
Harvesting defers tax more than it saves it
When you replace an investment you sold at a loss, the new shares have a lower cost basis, so a future sale shows a bigger gain. In the example, the replacement fund's basis is $15,000 lower, which could mean $2,250 more tax later. Harvesting still pays because:
- Money saved now can be invested until the tax comes due.
- Your rate may be lower later, for example in the 0% bracket in early retirement.
- Shares held until death get a stepped-up basis, so the deferred gain is never taxed.
- Donating appreciated shares to charity avoids the gain too.
- Losses that offset short-term gains or income are converted from high-taxed to lower-taxed.
The opposite: tax-gain harvesting
If your taxable income is low enough for the 0% long-term rate, up to $49,450 of taxable income for single filers and $98,900 for married couples filing jointly in 2026, you can sell winners, pay no tax, and buy back immediately. The wash sale rule only applies to losses. This resets your cost basis higher, cutting future tax.
Where it doesn't apply
Harvesting only works in taxable brokerage accounts. Gains and losses inside 401(k)s and IRAs aren't taxed when you sell, so there's nothing to harvest.
Try it with the Capital Gains Tax Calculator
- Open the Capital Gains Tax Calculator and enter your filing status, other income and the sale.
- Run it twice: once for the gain on its own, and once with the gain reduced by the loss you'd harvest.
- Compare the two tax figures, including the 3.8% NIIT and state tax, to see what harvesting is worth to you.
Frequently asked questions
When should I harvest losses?
Any time an investment is below what you paid, not just in December. Market drops during the year are often the best chance.
Does tax-loss harvesting work with crypto?
Crypto is taxed as property, and as of this writing the wash sale rule applies to stocks and securities. Check current IRS guidance before relying on it.
How long can I carry losses forward?
Indefinitely for individuals, until they're used up.