Tax-Loss Harvesting: Turning a Market Decline Into a Tax Refund
Every investor with a taxable brokerage account eventually watches a position sit below what they paid for it, and the instinct is to treat that as pure bad news. It is not. A realized loss is a deductible asset, and selling it deliberately while immediately replacing the exposure with something similar, but not identical, converts a paper loss into a real reduction in this year's tax bill. The mechanism is simple; the details that keep it legal and useful are where most investors go wrong.
The core principle
Tax-loss harvesting is the practice of selling an investment held in a taxable account at a loss in order to realize that loss for tax purposes, while immediately reinvesting the proceeds into a similar but not identical holding so the portfolio's market exposure stays essentially unchanged. A realized capital loss can offset realized capital gains dollar for dollar. If losses exceed gains in a given year, up to $3,000 of the excess can offset ordinary income annually, and any amount beyond that carries forward indefinitely to future tax years. None of this works in a tax-deferred or tax-exempt account, such as a 401(k) or an IRA, because those accounts do not generate a current tax bill on gains or losses in the first place.
The word "similar but not identical" is doing serious work in that first paragraph, and it exists because of the wash sale rule. The IRS disallows the loss if you buy the same security, or one the rules treat as "substantially identical," within 30 days before or after the sale. Sell a total U.S. stock market index fund at a loss and immediately rebuy the exact same fund, and the loss is disallowed; its cost basis is folded into the new shares instead. Sell that fund and buy a different index fund tracking a different but similarly broad benchmark, and the loss survives while your portfolio still holds roughly the same market exposure the whole time.
It is worth being precise about what harvesting actually accomplishes, because it is often oversold as free money. Selling a depreciated position and buying a similar one resets your cost basis lower, at the new purchase price. If the replacement holding later appreciates back to where the original position would have been, you owe capital gains tax on that appreciation when you eventually sell, and you paid a lower basis to start from. In most cases, tax-loss harvesting is a deferral of tax, not a permanent elimination of it. The value comes from the time value of that deferral, from offsetting income taxed at your current marginal rate today, and from the possibility that you never sell the replacement position at a large gain during your lifetime, in which case the deferred tax is forgiven entirely through a step-up in basis at death.
How the math works
Example 1: offsetting a realized gain elsewhere in the portfolio. Suppose an investor sold a concentrated block of former employer stock earlier in the year and realized a $20,000 long-term capital gain, taxed at the 15% federal long-term rate. Later in the year, a broad international index fund held in the same taxable account is down $20,000 from its purchase price. The investor sells the international fund, realizing a $20,000 loss, and immediately buys a different international index fund tracking a similar but not identical benchmark. The formula is direct: tax saved = harvested loss x applicable tax rate, so $20,000 x 15% = $3,000 in federal tax avoided on the gain that would otherwise have been due. If the investor is also subject to the 3.8% net investment income tax, the loss offsets that too, saving an additional $20,000 x 3.8% = $760, for total tax savings of $3,760 this year alone.
Example 2: no gains to offset, so the loss chips away at ordinary income. A different investor has no realized capital gains this year but harvests $8,000 of losses from a declining bond fund position. With no gains to absorb, the tax code allows only $3,000 of net capital loss to offset ordinary income in a single tax year. At a 32% marginal federal tax rate, that $3,000 deduction is worth $3,000 x 32% = $960 this year. The remaining $5,000 of unused loss carries forward to next year and every year after that until it is fully used, either against future gains or against future ordinary income at the same $3,000 annual cap. A large enough harvested loss can effectively become a multi-year tax asset rather than a one-time event.
How it shows up in real portfolios
The clearest real-world case is a broad market downturn. During a year like 2022, when both stocks and bonds fell simultaneously, an investor holding a diversified taxable portfolio typically had several positions sitting below their purchase price at the same time: an international fund, a small-cap fund, a bond fund, sometimes even a total U.S. market fund depending on when shares were purchased. Systematically harvesting each of those losses while swapping into a similar replacement fund converts a rough year into a stockpile of realized losses that can shelter gains for years afterward, long after the market has recovered.
A high-earning professional with a large taxable brokerage account, on top of maxed-out retirement accounts, is the investor who benefits most in absolute dollar terms, for the same reason expense ratios matter more to larger balances: a fixed percentage advantage scales with the size of the account. Some brokerages and robo-advisors now offer automated, algorithm-driven tax-loss harvesting inside taxable accounts, checking daily for harvesting opportunities across dozens of individual positions or a direct-indexed portfolio of hundreds of individual stocks standing in for a single index fund. Direct indexing in particular multiplies harvesting opportunities, because even in a year when the overall index is up, some individual constituent stocks are almost always down, each one a small harvestable loss.
Tax-loss harvesting also interacts with major liquidity events. An executive planning to exercise concentrated stock options or sell a large block of restricted stock units in a future year, generating a large ordinary income or capital gains event, sometimes harvests losses in the years leading up to that event specifically to bank a reserve of losses for the year the bill comes due, since losses carry forward indefinitely and can be timed to offset a known future gain.
Actionable breakdown
- When to check for harvesting opportunities:
- After any broad market decline of 10% or more.
- Near year-end, reviewing every taxable lot.
- Right before a known future large gain event.
- How to stay invested without triggering a wash sale:
- Swap into a fund tracking a different index.
- Wait 31 days before repurchasing the original fund.
- Check that a spouse's account is not also buying it.
- Where the loss can be applied:
- First against realized capital gains, dollar for dollar.
- Then up to $3,000 per year against ordinary income.
- Any remainder carries forward indefinitely.
- Only applies inside taxable brokerage accounts, never inside a 401(k) or IRA.
Common pitfalls
- Rebuying the exact same fund too soon and unknowingly triggering the wash sale rule, which disallows the loss and folds the disallowed amount into the new shares' basis.
- Treating a harvested loss as money earned rather than tax deferred, and forgetting that the replacement holding now carries a lower cost basis that will generate a larger taxable gain later.
- Chasing harvesting opportunities so aggressively that the portfolio drifts away from its intended diversification, accumulating a collection of niche replacement funds that no longer resemble the original target allocation.
- Ignoring dividend reinvestment as a source of accidental wash sales: an automatic dividend reinvestment inside the 30-day window can quietly repurchase a small number of shares of the same fund and disallow part of the loss.
Related concepts
The rule that shapes every harvesting decision is the wash sale rule. For the underlying mechanics of what gets offset, see capital loss and capital gain, and for what basis actually means once a replacement position is purchased, see cost basis. Harvesting is closely related to rebalancing, since both involve deliberately selling and buying to manage a portfolio rather than reacting emotionally to it. For the broader framework, see the guide on tax efficiency.
The bottom line
Tax-loss harvesting turns a decline you already own into a real, immediate tax benefit, as long as you respect the wash sale rule and remember it is usually a deferral, not a gift.