Tax-loss harvesting is the practice of selling investments at a loss to offset gains elsewhere in your portfolio — reducing your tax bill without changing your actual market exposure. Done correctly, it generates real cash savings with no change to your investment strategy.

It is not a way to avoid paying taxes forever. It is a way to defer taxes and, in some cases, permanently reduce them by converting short-term gains (taxed as ordinary income) into long-term gains (taxed at preferential rates).

Here is exactly how it works, with real numbers.

The Core Mechanics

The U.S. tax code allows you to net capital gains against capital losses. If you sell a stock at a $10,000 gain and another at a $10,000 loss in the same tax year, the two cancel out — you owe zero capital gains tax on the net position.

If your losses exceed your gains, you can deduct up to $3,000 of net capital losses against ordinary income per year. Any losses beyond $3,000 carry forward indefinitely to future tax years.

A concrete example:

You hold two positions in your taxable account:

  • Position A: $50,000 basis, currently worth $60,000 — a $10,000 unrealized gain
  • Position B: $30,000 basis, currently worth $20,000 — a $10,000 unrealized loss

If you sell Position A and take the $10,000 gain without selling Position B, you owe capital gains tax on $10,000. At the 20% long-term capital gains rate (top bracket) plus 3.8% Net Investment Income Tax (NIIT) for high earners, that is $2,380 in tax.

If you sell both Position A and Position B, the $10,000 gain and $10,000 loss cancel out. Tax owed: $0. You save $2,380 in tax.

The key: you still want equity market exposure. So after selling Position B at a loss, you immediately reinvest the proceeds in a similar (but not identical) fund or security. You maintain your market exposure while locking in the tax benefit.

Tax Savings at Different Loss Amounts and Brackets

The savings depend on two things: the size of the loss being harvested and your tax bracket. Here is how it stacks up:

Tax savings from harvesting losses to offset capital gains:

Loss Harvested0% LT Rate15% LT Rate20% LT Rate37% ST Rate (top bracket)
$5,000$0$750$1,000$1,850
$10,000$0$1,500$2,000$3,700
$25,000$0$3,750$5,000$9,250
$50,000$0$7,500$10,000$18,500
$100,000$0$15,000$20,000$37,000

Long-term capital gains rates: 0% (single income under $47K), 15% ($47K–$518K), 20% (over ~$518K). Short-term gains taxed at ordinary income rates. NIIT (3.8%) adds to these rates for high earners on net investment income.

The short-term column is the highest because harvesting losses to offset short-term gains saves at your marginal ordinary income rate. If you have $10,000 in short-term gains and you are in the 37% bracket, harvesting $10,000 in losses saves you $3,700.

Tax savings from the $3,000 ordinary income deduction (net losses exceed gains):

If your losses exceed your gains, the first $3,000 of net losses can be deducted against ordinary income. For someone in the 37% bracket, that is $1,110 in tax savings. For someone in the 22% bracket, it is $660. Modest, but free money that accumulates every year you carry forward excess losses.

The Wash Sale Rule

This is the critical rule that limits how tax-loss harvesting works in practice. The IRS wash sale rule (Section 1091 of the Internal Revenue Code) states:

If you sell a security at a loss and buy a “substantially identical” security within 30 days before or after the sale, you cannot claim the loss for tax purposes.

The disallowed loss is not gone forever — it is added to the cost basis of the new position, deferring it. But you cannot use it in the current tax year, which defeats the purpose of harvesting it.

The 30-day window: The wash sale window is 61 days total — 30 days before the sale, the day of the sale, and 30 days after. If you sell VTI at a loss on October 15 and buy it back on November 5 (21 days later), that is a wash sale. You need to wait until November 16 to buy VTI back — or buy a substantially identical fund instead, immediately.

“Substantially identical” is narrower than it sounds:

  • Selling VTI and buying VTI back within 30 days: wash sale
  • Selling a specific stock and buying it back: wash sale
  • Selling VTI and buying ITOT (iShares Core S&P Total U.S. Stock Market ETF): not a wash sale — same exposure, different fund family, different underlying index methodology
  • Selling an individual stock and buying an ETF in the same sector: almost certainly not a wash sale
  • Selling a bond fund and buying a bond fund with a different duration: not a wash sale

The IRA trap: The wash sale rule applies across all your accounts, including IRAs. If you sell VTI at a loss in your taxable account and buy VTI within 30 days in your Roth IRA, that is a wash sale in your taxable account. The loss is disallowed — and unlike in a taxable account where the loss is added to basis, the IRA version of the rule permanently disallows the loss (because there is no accessible basis inside a tax-advantaged account). Be careful about automatic dividend reinvestment in IRAs around the time of a taxable account harvest.

How to Harvest Without Losing Market Exposure

The practical challenge: you want to capture the tax loss without being out of the market. The solution is to swap into a similar but not substantially identical fund immediately after selling.

Common substitution pairs:

SellBuy ImmediatelyExposure
VTI (Vanguard Total Stock Market)ITOT (iShares Core Total U.S. Stock Market)U.S. total market
ITOTSCHB (Schwab U.S. Broad Market)U.S. total market
SPY (S&P 500)IVV or VOO (different S&P 500 ETFs)*S&P 500
QQQ (Nasdaq 100)QQQM (same index, different share class)Nasdaq 100
VXUS (Intl total market)IXUS (iShares Intl total market)International stocks
BND (Total bond market)AGG (iShares Core U.S. Aggregate Bond)U.S. aggregate bonds
Individual stockSector ETF in same industrySector exposure

Note: SPY, IVV, and VOO all track the S&P 500. Whether these are “substantially identical” is a gray area — the IRS has not ruled definitively on ETF-to-ETF swaps tracking the same index. Most tax professionals treat same-index ETFs from different providers as wash sale risks and recommend swapping into a fund tracking a different index (e.g., selling SPY and buying a total market fund like ITOT instead).

The general rule: different fund families tracking different (but similar) indices are safe. Same fund or same index from the same provider is risky. When in doubt, use a fund tracking a broader index or from a different provider.

When to Harvest and When to Skip It

Tax-loss harvesting is valuable in specific situations and less useful in others. Here is when it is worth doing:

Do harvest losses when:

  • You have significant unrealized gains elsewhere that you are planning to realize (selling a position, rebalancing)
  • You are in the 20% long-term capital gains bracket or higher — the tax savings are meaningful
  • The loss is substantial enough to matter (a $200 loss saving $30 in taxes at 15% probably is not worth the administrative effort)
  • You have accumulated short-term gains (taxed at ordinary income rates — harvesting against these saves more)
  • You are near year-end and have gains you plan to realize before year-end
  • You have $3,000 or more in losses beyond what you can offset against gains, which you can deduct against ordinary income

Consider skipping when:

  • You are in the 0% long-term capital gains bracket (single income under ~$47K) — there is nothing to save
  • The position is in a tax-advantaged account (IRA, 401k) — losses inside these accounts are not tax-deductible
  • Transaction costs would eat the savings (less relevant with $0-commission brokers today)
  • The replacement fund has different characteristics that affect your actual investment thesis
  • You plan to donate the appreciated position to charity (donating appreciated securities avoids capital gains tax entirely — potentially more valuable than harvesting)
  • The loss is small and you are likely to move accounts or die holding the position (step-up in basis at death eliminates unrealized gains — no reason to harvest losses if you plan to hold forever)

Practical Implementation

Set a threshold. Do not harvest losses on every tiny dip. Many investors use a threshold of 5–10% unrealized loss or a minimum dollar amount (e.g., $1,000 minimum loss before harvesting). Automated robo-advisors typically harvest any loss above a small percentage continuously.

Do it year-round, not just December. Year-end tax loss harvesting is common, but the best opportunity may come in any month. The 2022 bear market created harvesting opportunities in February–October; investors who waited until December had already missed much of the decline in some positions. Monitor positions with significant unrealized losses throughout the year.

Track your wash sale calendar. If you harvest a loss and buy a substitute, put a 31-day reminder on your calendar. After 31 days, you can buy back the original security if you prefer it. If you forget and buy back too early, you erase the tax benefit.

Document cost basis lots. Tax-loss harvesting works at the lot level — if you bought a position in multiple tranches at different prices, some lots may be at a loss while others are at a gain. Use specific lot identification (not FIFO, not average cost) at your broker so you can target the loss lots for harvesting while keeping the gain lots.

Track carryforward losses. If you generate more losses than you can use in a single year, the excess carries forward. Keep a record and use those carryforwards strategically in future years when you have large gains to realize — selling a concentrated position, rebalancing significantly, or in a high-income year.

Charles Schwab

Open a Schwab account — $0 commissions make tax-loss harvesting completely cost-free to execute, and Schwab's platform provides detailed lot-level tax reporting.

Open Account

The Long-Term Math

Tax-loss harvesting does not eliminate taxes — it defers them. When you sell the replacement fund years later, the deferred gain is realized. The benefit is the time value of money: a dollar of tax not paid today is worth more than a dollar of tax paid today, because you can invest that deferred dollar in the meantime.

Deferral example:

  • You harvest a $10,000 loss, saving $1,500 in taxes today (15% rate)
  • You invest that $1,500 in your portfolio
  • The $1,500 grows at 8% annually for 20 years → becomes $6,991
  • When you eventually pay the deferred tax on it (say $1,500 + gains) — you have still come out well ahead

The compounding of deferred taxes over long periods is real money. Over a 20–30 year investment horizon, systematic tax-loss harvesting can meaningfully improve after-tax returns — estimates range from 0.2% to 1.5% annually depending on portfolio turnover and market conditions.

The step-up in basis wildcard: Under current law, inherited assets receive a “step-up” in cost basis to their fair market value at the date of the original owner’s death. If you harvest losses and hold the replacement fund for life, and your heirs receive it at a stepped-up basis, the deferred gain is never taxed. This makes systematic harvesting in taxable accounts particularly powerful for investors with estate planning goals — defer the tax year after year, never realize it, leave it to heirs at stepped-up basis.

Tax-Loss Harvesting in Volatile Markets

Market volatility creates the best harvesting opportunities. When markets fall 20–30% as they did in 2022, or crash quickly as in March 2020, significant losses become available across broad market positions. The investors who harvest systematically during downturns lock in tax benefits that persist for years.

The practical discipline: when your portfolio is down meaningfully, the psychological instinct is often to either panic-sell (wrong) or freeze (suboptimal). The right move is to assess which positions are at a tax loss, harvest those losses into similar replacements, and maintain your asset allocation. You stay fully invested, you maintain your strategic allocation, and you generate a tax asset that reduces your future tax burden.

Interactive Brokers

Open an IBKR account — professional tax optimizer tools, lot-level reporting, and the lowest commissions for executing tax-loss harvesting at scale.

Open Account

Common Tax-Loss Harvesting Mistakes

Harvesting inside retirement accounts. Losses in an IRA or 401k are not deductible. There is no tax-loss harvesting inside tax-advantaged accounts — only in taxable brokerage accounts.

Triggering wash sales accidentally through dividend reinvestment. If your taxable account reinvests dividends automatically and you are harvesting losses in a fund that just paid a dividend, you may trigger a wash sale. Turn off automatic dividend reinvestment in taxable accounts during the 30-day window around planned harvests.

Not replacing the position. Harvesting a loss and staying in cash to “wait and see” is a market timing error dressed up as a tax strategy. Replace the position immediately with a similar fund to maintain your market exposure.

Harvesting small positions obsessively. Harvesting $150 in losses to save $22.50 in taxes (at 15%) is a waste of time and creates administrative complexity. Set a meaningful threshold.

Forgetting to use carryforward losses. Harvested losses in excess of the current year’s gains carry forward — but they do not disappear. Use them in high-income years, in years with large capital events, or systematically to reduce the taxes on rebalancing.

For more on how capital gains taxes work, see our guide on capital gains tax explained.