Tax-Loss Harvesting: What It Does, What It Doesn't, and the Wash-Sale Trap
How tax-loss harvesting works in a taxable brokerage account, why it defers rather than eliminates tax, and the wash-sale rule that quietly cancels the benefit.
Tax-loss harvesting is one of those techniques that sounds like free money and turns out to be something more modest and more conditional. The pitch is simple: sell an investment that has dropped, book the loss to reduce your tax bill, and stay invested by buying something similar. The mechanics are real, but two facts get glossed over in the pitch — the benefit is mostly a deferral, not a discount, and a rule called the wash-sale rule can quietly undo the whole thing. This is a structural walkthrough, not tax advice; rules vary by country and change over time.
What Tax-Loss Harvesting Actually Is
In a taxable brokerage account, you owe tax on realized capital gains — gains from positions you actually sold. A position that has fallen in value carries an unrealized loss, which does nothing for you until you sell and realize it.
Tax-loss harvesting is the deliberate act of realizing a loss. Suppose you bought a broad index fund and it is now worth less than you paid. You sell it, realizing a capital loss. That loss first offsets any realized capital gains you have elsewhere. If losses exceed gains, many tax systems let you deduct a limited amount against ordinary income, and carry the remainder forward to future years.
The key move is what you do next. You do not want to leave the market, so you immediately buy a similar but not identical investment — a different index fund tracking a comparable but distinct index. Your money stays invested with roughly the same exposure, and you are holding a realized loss you can apply against taxes.
The Wash-Sale Rule: The Trap That Undoes It
Here is the part the pitch skips. Tax authorities anticipated the obvious abuse: sell at a loss for the tax benefit, then rebuy the identical security a moment later, ending up in exactly the same position but with a “free” deduction. The wash-sale rule exists to block this.
In broad terms, if you sell a security at a loss and buy the same or a substantially identical security within a defined window around the sale, the loss is disallowed for that tax year. In the United States that window is 30 days before and 30 days after the sale — a 61-day span in total. The disallowed loss is not lost forever; it is added to the cost basis of the replacement shares. But the immediate benefit you were harvesting evaporates.
This is why the “buy something similar” step is not optional and not trivial. Buy a fund tracking a meaningfully different index and you are generally fine. Buy the identical fund back the next day and the loss is disallowed. The grey zone — two funds tracking indexes that overlap heavily — is exactly where “substantially identical” gets argued, and the term is not defined with engineering precision.
Tax Deferral Is Not Tax Elimination
The most common misunderstanding is treating the harvested loss as a permanent saving. Usually it is not.
When you sell the original fund and buy the replacement, the replacement carries a lower cost basis — either the new purchase price, or the original basis plus a disallowed loss. A lower basis means a larger taxable gain when you eventually sell the replacement. The tax you avoided today reappears later, when you finally realize the position.
So the honest framing is: tax-loss harvesting mostly defers tax, not eliminates it. Why is a deferral still worth anything? Two reasons. First, money kept invested now rather than paid in tax can compound in the meantime — the time value of money. Second, the tax rate that applies when the deferred gain is finally realized may be lower than today’s — for instance, if it is realized in a lower-income year, or converted from a short-term to a long-term rate, or steps up at inheritance under some tax systems.
There is also a genuine, non-deferral benefit: a loss that offsets a short-term gain taxed at a high ordinary rate, or that offsets up to the annual limit of ordinary income, can convert into a future long-term gain taxed at a lower rate. That rate arbitrage is a real saving rather than a pure deferral. But it is a smaller and more conditional number than “I saved my whole tax bill.”
When It’s Worth the Effort
Harvesting has real costs: transaction friction, the bookkeeping of tracking lots and basis, the risk of a wash-sale mistake, and the constraint it places on your portfolio. It is most likely to be worth it when several conditions line up.
It helps when you actually have gains — or ordinary income within the deductible limit — to offset, since a carried-forward loss with nothing to apply it to is just a deferred IOU. It helps more at higher marginal tax rates, because the loss is worth your rate. It helps when markets are volatile enough to produce real losses to harvest, which tends to mean early in a holding period rather than after years of growth. And it helps when you can find a clean, genuinely non-identical replacement so your market exposure is uninterrupted.
It is usually not worth contorting your portfolio for. Selling a position you would otherwise keep, or buying a worse fund purely to dodge the wash-sale rule, can cost more than the tax it saves.
Treat tax-loss harvesting as a modest, conditional optimization — a few basis points of long-run after-tax return for investors in the right situation — not a strategy that changes the outcome of your investing. The asset allocation and the contribution rate decide the result. Harvesting is a refinement at the edges, and the wash-sale rule means a careless refinement can subtract value instead of adding it. Specific rules, windows, and limits depend entirely on your jurisdiction and your situation, which is exactly when a tax professional earns their fee.
FAQ
Does tax-loss harvesting make sense if I have no capital gains this year?
How do I avoid a wash sale while staying invested?
Is this the same in every country?
Related reading
2026-06-22
Position Sizing and Risk per Trade: The Math Retail Investors Skip in 2026
How to size a trade from risk instead of conviction: the fixed-fractional formula, fractional Kelly, R-multiples, and the drawdown math that decides whether a losing streak is survivable.
2026-06-22
Dollar-Cost Averaging vs Lump Sum: What the Math Really Says
A measured look at why lump-sum investing usually beats dollar-cost averaging on expected return, when DCA still makes sense, and how to decide for your own cash.
2026-06-22
What the Sharpe Ratio Actually Tells You (and Where It Misleads)
The Sharpe ratio measures excess return per unit of volatility. Here is exactly what the number captures, the four assumptions that break it, and when to trust it.
2026-06-22
Tiingo vs Polygon.io: Market Data APIs for Indie Quant Projects in 2026
A practical comparison of Tiingo and Polygon.io for solo quant builders in 2026 — pricing, rate limits, data coverage, and which one fits a weekend backtester.
2026-06-22
Building a Portfolio Rebalancing Script in Python: From Drift to Trades
A practical walkthrough of writing a Python rebalancing script: measuring allocation drift, generating a self-funding trade list, and using threshold bands to avoid over-trading.
Get the best tools, weekly
One email every Friday. No spam, unsubscribe anytime.