What is tax-loss harvesting?
Last updated August 2026
Short answer
Tax-loss harvesting is one of the few reliable ways to reduce an investment tax bill without changing what you are invested in. It is also widely oversold, because most of what it delivers is deferral rather than saving.
The mechanism
A loss on paper does nothing for you. Selling makes it real, and a realized loss can be set against realized gains.
Losses are matched long-term against long-term and short-term against short-term first, then any remainder crosses over. Because short-term gains are taxed at higher ordinary rates, a short-term loss offsetting a short-term gain is worth the most.
If losses exceed gains for the year, up to $3,000 can be deducted against ordinary income. Anything beyond that carries forward with no expiry and no limit on how long it waits.
The carryforward is the underrated part
A $40,000 loss in a bad year with no gains to offset is not wasted. $3,000 comes off ordinary income that year and $37,000 carries forward.
In later years it offsets gains in full, or another $3,000 of income, until it is used up. That can run for many years and is entirely automatic once recorded.
The practical requirement is record keeping. Carryforwards live on your return, and losing track of them across a change of accountant or software is how they quietly disappear.
The wash sale rule is the binding constraint
If you buy the same or a substantially identical security within 30 days before or after the sale, the loss is disallowed for now.
It is a 61-day window centred on the sale, and it applies across all your accounts, including your IRA and, in practice, a spouse's accounts.
The loss is not destroyed. It is added to the basis of the replacement shares, so it comes back when you eventually sell those. Except in one case: a wash sale triggered by repurchasing inside an IRA loses the deduction permanently.
Staying invested while harvesting
The point is to realize the loss without leaving the market, because sitting in cash for 31 days is a real risk that can easily cost more than the tax saved.
The usual approach is to buy something similar but not substantially identical: a different provider's index fund tracking a different index of the same market, for instance.
The IRS has never defined substantially identical precisely for funds, which is why the convention is to avoid two funds tracking the exact same index. This is an area where a tax professional's view is worth having if the amounts are large.
It is mostly deferral, not saving
Harvesting a loss lowers the basis of what you now hold, because you replaced a higher-basis position with a lower-basis one.
That means a larger taxable gain later. The benefit is having the money now rather than then, which is real but smaller than the headline number suggests.
There are cases where it becomes a permanent saving: offsetting short-term gains taxed at high rates with a loss later realized at long-term rates, using the $3,000 deduction against high-bracket income, or holding until death when the basis steps up.
Try it in Walnut
Walnut reads your connected brokerage positions, so you can see which holdings are below your cost basis before deciding whether any of them are worth realizing.
Where it does not apply
Inside a 401(k), IRA or HSA there are no capital gains or losses to speak of. Selling at a loss in a retirement account gives you nothing and cannot be deducted.
It also does nothing for someone whose gains fall entirely in the 0% long-term band, since there is no tax to offset.
And it is worth nothing at all if the trading costs and spread exceed the tax saved, which can be the case with thinly traded holdings.
The order that matters
Never let the tax decide the investment. Selling a holding you want to keep in order to harvest a loss, and then owning something worse for 31 days, is a bad trade with a tax rebate attached.
The right sequence is to decide what you want to own, then look for losses among positions you were willing to change anyway.
December is when most harvesting happens, but losses are available all year and a mid-year drawdown often offers better opportunities than a quiet December.
Sources
The wash sale rule, capital loss limits and carryforwards are in IRS Publication 550. Capital gains and loss treatment is summarised in IRS Topic 409. Walnut is informational and is not an investment adviser. This guide is educational and not personalized tax or investment advice; anything with a tax consequence is worth confirming with a tax professional.
FAQ
What is tax-loss harvesting?
+
Selling an investment that has fallen in value so the loss becomes realized and can offset taxable gains. Losses offset gains dollar for dollar, and any excess can reduce ordinary income by up to $3,000 a year, with the remainder carrying forward indefinitely.
How much can I deduct in losses each year?
+
Losses first offset realized gains without limit. If losses exceed gains, up to $3,000 a year can be deducted against ordinary income. Anything beyond that carries forward to future years with no expiry, offsetting gains in full or another $3,000 of income annually.
What is the wash sale rule?
+
If you buy the same or a substantially identical security within 30 days before or after selling at a loss, the loss is disallowed for now and added to the basis of the replacement shares. It applies across all your accounts, and a repurchase inside an IRA loses the deduction permanently.
Does tax-loss harvesting actually save money?
+
Mostly it defers tax rather than eliminating it, because replacing a holding at a lower basis means a larger gain later. It becomes a real saving when it offsets high-rate short-term gains, uses the $3,000 income deduction at a high bracket, or when the position is held until the basis steps up.