Tax-Loss Harvesting Explained: Wash-Sale Rule, Tax Alpha, and How to Do It Right

May 9, 2026 · guides · 11 min read

Tax-Loss Harvesting Explained: Wash-Sale Rule, Tax Alpha, and How to Do It Right

Tax-loss harvesting is one of the few legal strategies that lets you reduce your tax bill without changing your long-term investment outcome. When done correctly, it converts paper losses into real cash savings, reinvested back into your portfolio. When done incorrectly, it triggers the wash-sale rule and wipes out every benefit.

This guide covers how tax-loss harvesting works, the math behind "tax alpha," the wash-sale rule in detail, and how to stay fully invested while still capturing losses.


What Is Tax-Loss Harvesting?

Tax-loss harvesting means selling an investment that has declined in value to realize a capital loss on your tax return. That loss then offsets capital gains you have elsewhere, reducing the amount of income subject to capital gains tax.

The key word is "defers." Tax-loss harvesting does not permanently eliminate taxes. When you sell the losing position, you typically reinvest in something similar. Your new position has a lower cost basis than your original holding, meaning you will owe taxes on a larger gain eventually. But deferring taxes has real value: the money you would have paid in taxes today stays in your account, compounding for years or decades until you eventually sell.

A Simple Example

You hold two positions. Stock A is up $10,000. Stock B is down $8,000.

You decide to take profits on Stock A. Without any action, you owe capital gains tax on $10,000. At the long-term capital gains rate of 15%, that is $1,500 due this year.

If you also sell Stock B before selling Stock A, you realize an $8,000 loss. Your net taxable gain drops to $2,000. You owe $300 instead of $1,500, saving $1,200 in immediate taxes.

That $1,200 stays invested and compounds in your portfolio. If it grows at 7% annually, it is worth roughly $2,370 in ten years. That difference is tax alpha: additional return created not by picking better stocks, but by managing the timing of taxes.


How Capital Loss Deductions Work

The IRS allows capital losses to offset capital gains dollar for dollar. The order of netting matters:

  1. Short-term losses offset short-term gains first (taxed at ordinary income rates, often 22-37%).
  2. Long-term losses offset long-term gains first (taxed at 0%, 15%, or 20%).
  3. If losses exceed gains in one category, the excess flows to the other category.
  4. If total losses exceed total gains, you can deduct up to $3,000 against ordinary income per year.
  5. Any remaining unused losses carry forward to future tax years indefinitely.

The ordering matters because short-term losses are most valuable when they offset short-term gains, which are taxed at the highest rates. If your losses exceed your gains entirely, the $3,000 annual deduction against ordinary income provides incremental savings over time, though the benefit is modest.

Carryforward Example

You harvest $20,000 in losses this year but have no offsetting gains. You can deduct $3,000 against ordinary income this year. The remaining $17,000 carries forward. Next year, if you realize $17,000 in gains, the entire carryforward absorbs them, resulting in zero capital gains tax for the year.


The Wash-Sale Rule: The Critical Constraint

The wash-sale rule is the primary risk in tax-loss harvesting. If you sell a security at a loss and then purchase a "substantially identical" security within 30 days before or after the sale, the IRS disallows the loss. You cannot claim it.

The 30-day window covers 61 days total: 30 days before the sale, the day of the sale, and 30 days after. Many investors focus only on the 30 days after, but the lookback to 30 days before the sale also applies.

What "Substantially Identical" Means

The IRS has never provided a complete definition, but guidance and court cases establish these principles:

The safe approach: when you harvest a loss, replace the sold position with something genuinely different in structure or index methodology, not just a different ticker for the same exposure.

What Happens If You Trigger a Wash Sale

The disallowed loss is not gone. It gets added to the cost basis of the replacement security. You eventually receive credit for it when you sell the replacement, but the timing advantage is lost. If the replacement security is held inside a tax-advantaged account (IRA, 401(k)), the loss is permanently disallowed because those accounts do not generate taxable gains or losses.

This last point is critical. Never trigger a wash sale where the replacement purchase occurs in a retirement account. The loss disappears permanently.


Replacement Securities: Staying Invested While Harvesting

The goal is to capture the tax loss without being out of the market, which would create timing risk. You do this by replacing the sold position with a similar but not substantially identical security immediately.

Common Replacement Strategies

US Large-Cap Equities: Sell an S&P 500 ETF and replace with a total US market ETF or a large-cap value ETF. The correlation is high, so your portfolio's overall exposure changes very little.

International Equities: Sell a developed markets ETF and replace with a different provider's developed markets ETF that tracks a different underlying index (MSCI EAFE vs. FTSE Developed, for example).

Bonds: Sell an intermediate-term Treasury ETF and replace with a short-term or investment-grade corporate bond ETF. Duration and credit quality change slightly, but the fixed-income role in your portfolio is maintained.

Sector Holdings: If you hold a single stock and want to harvest a loss, you could replace it with a sector ETF covering that company's industry. This changes your specific-company risk to sector-level exposure and avoids the wash-sale issue entirely.

The 31-day replacement period matters in both directions. After you swap into the replacement, wait at least 31 days before swapping back to the original holding, or you may trigger the rule on the replacement security's position.


Taxable vs. Tax-Advantaged Accounts

Tax-loss harvesting only applies to taxable brokerage accounts. Gains and losses inside Roth IRAs, traditional IRAs, and 401(k)s are not reported on your tax return. Selling at a loss in a retirement account generates no tax benefit.

This also means you need to monitor wash sales across all your accounts simultaneously. If you sell a fund in your taxable account at a loss but your spouse's IRA holds the same fund and happens to make a scheduled purchase that week, the IRS could potentially argue that a wash sale occurred. The IRS rules technically apply to your individual tax situation, but many practitioners advise treating all accounts in a household as a unified wash-sale window to be safe.

The Value of Timing in Taxable Accounts

The highest-value opportunities for tax-loss harvesting in taxable accounts occur in three situations:

  1. Volatile years with significant drawdowns in specific positions.
  2. Concentrated single-stock positions that have declined from purchase price.
  3. Years with large capital gain distributions from mutual funds you own.

Many mutual funds distribute large taxable gains in December. Harvesting other losses before year-end to offset these distributions is a common strategy.


The Math of Tax Alpha

Tax alpha is the extra after-tax return generated by smart tax management. It does not show up in your brokerage statement's gross returns, but it compounds in your net portfolio value over time.

Quantifying the Benefit

Assume you harvest $10,000 in losses each year for 10 years in a taxable account. Your marginal tax rate on capital gains is 23.8% (15% federal plus 3.8% net investment income tax, which applies to higher earners).

Each year's harvest saves $2,380 in taxes that would otherwise have been owed. That $2,380 remains invested and compounds at 7% per year. After 10 years, the cumulative after-tax benefit (including compounding) is approximately $33,000, using a simple annuity calculation of $2,380 growing at 7% for periods ranging from 1 to 10 years.

The actual benefit depends on your specific gains in each year, your tax rate, and how long you defer before ultimately paying the deferred taxes. Investors in higher tax brackets benefit more. Investors who plan to hold until death benefit most of all: assets held until death receive a stepped-up cost basis, meaning deferred capital gains taxes can disappear entirely.

Loss Harvesting with a "Step-Up" Exit Strategy

If you harvest losses throughout your life and your heirs inherit the portfolio, they inherit the assets at their fair market value on the date of your death, not your original cost basis. All the "lower cost basis" created by tax-loss harvesting throughout your investing life resets to market value. The deferred taxes are never collected. This makes the deferral strategy especially powerful for investors who do not plan to spend down their portfolio.


Automated Tax-Loss Harvesting: Robo-Advisors

Robo-advisors including Betterment, Wealthfront, and Schwab Intelligent Portfolios offer automated daily tax-loss harvesting. Instead of manually reviewing your portfolio a few times a year, these platforms scan your positions daily and execute harvests automatically when thresholds are triggered.

How Automated TLH Works

The robo-advisor monitors the current market value of each position against its cost basis. When a position falls below a set threshold, typically 2-5% below cost or a minimum dollar amount, the platform sells the position, reinvests proceeds in a pre-defined replacement security, and sets a 31-day reminder to evaluate switching back to the original or permanent replacement.

Because it runs daily, automated TLH captures small and short-lived dips that a human reviewing quarterly would miss. Studies from Wealthfront suggest automated daily harvesting can generate 0.5-1.5% additional after-tax return annually in volatile markets, though results vary significantly by year.

Limitations of Automated TLH


Common Mistakes to Avoid

Ignoring the lookback window. The wash-sale rule starts 30 days before the sale, not 30 days after. If you purchased shares in the month before your harvest sale, the loss may already be at risk.

Using two S&P 500 ETFs as "different" replacements. Selling SPY and immediately buying IVV (both track the S&P 500 index) is widely considered a wash sale by tax professionals. Use a different index.

Harvesting small losses. Transaction costs, bid-ask spreads, and the time value of your attention make very small harvests not worth pursuing. Most practitioners set a minimum threshold of $1,000 in losses before executing a harvest.

Forgetting state taxes. Some states do not follow the federal wash-sale rule exactly, and state capital gains tax rates vary widely. In California, capital gains are taxed as ordinary income at rates up to 13.3%. The tax alpha calculation looks different in each state.

Harvesting in the last days of December without accounting for settlement. Trades settle in one business day (T+1 as of May 2024). If you want losses to count in the current tax year, execute the trade with enough time for settlement before December 31.


Tax-Loss Harvesting and Long-Term Portfolio Discipline

The biggest risk in tax-loss harvesting is behavioral: using the need to avoid wash sales as a reason to drift your portfolio away from your intended allocation. Every replacement security you hold for 31 days is a deviation from your target allocation. Most of the time, that drift is small and temporary. But if you are not disciplined about tracking your replacement positions and returning to your target, your portfolio can become a patchwork of substitutes that no longer reflects your actual investment goals.

Build a simple tracking system. For each harvest, record the original security, the replacement security, the sale date, the 31-day re-evaluation date, and whether you plan to swap back or make the replacement permanent.


Key Takeaways