Every investor has positions that are underwater at some point. Most people just wait and hope the price recovers. Smart investors do something different: they sell the losing position, lock in the tax deduction, and immediately reinvest in a similar asset to maintain their market exposure. This is tax-loss harvesting, and it can save you thousands of dollars every single year.
The concept is simple. The execution requires knowing a few key rules, especially the wash sale rule that trips up most beginners. This guide covers everything you need to know to start harvesting losses effectively.
How Tax-Loss Harvesting Works
When you sell an investment at a loss in a taxable brokerage account, the IRS lets you use that loss to offset capital gains. If your losses exceed your gains in a given year, you can deduct up to $3,000 of the excess against your ordinary income. Any remaining losses carry forward to future tax years indefinitely.
Here is the key insight: you do not have to leave the market. You sell the losing position and buy a different but similar investment. Your portfolio stays roughly the same, your market exposure is maintained, but you have generated a tax deduction out of thin air.
A quick example
You bought $50,000 of a total US stock market fund (VTI) earlier this year. The market drops 15%, and your position is now worth $42,500. You have a $7,500 unrealized loss.
- You sell VTI for $42,500, realizing a $7,500 loss.
- You immediately buy $42,500 of a similar but not identical fund, like ITOT (iShares Core S&P Total US Stock Market ETF).
- Your market exposure is essentially unchanged. You still own broad US equities.
- On your tax return, you can use the $7,500 loss to offset capital gains from other sales. If you have no gains, you deduct $3,000 against ordinary income this year and carry the remaining $4,500 forward.
At a 24% marginal tax rate, that $3,000 deduction saves you $720. The carried-forward $4,500 saves you more in future years. And your investment portfolio is still positioned to capture the recovery. Run your own numbers with our Tax-Loss Harvesting Calculator.
The Wash Sale Rule: The One Rule You Cannot Break
The IRS is fine with tax-loss harvesting. What they do not allow is selling at a loss and buying back a "substantially identical" security within 30 days before or after the sale. This is the wash sale rule, and violating it means your loss is disallowed.
The 30-day window applies in both directions. If you buy the replacement security within 30 days before the sale, or 30 days after, the loss is disallowed. This creates a 61-day total window (30 days before + sale day + 30 days after).
What counts as "substantially identical"?
- Same security: Selling VTI and buying VTI within 30 days. Obviously a wash sale.
- Same fund, different share class: Selling Vanguard Total Stock Market ETF (VTI) and buying Vanguard Total Stock Market Admiral Shares (VTSAX). Same underlying fund, different wrapper. This is a wash sale.
- Different fund, same index: Selling one S&P 500 fund and buying another S&P 500 fund from a different provider. The IRS has not given definitive guidance here, and opinions vary. Most tax professionals consider this a grey area and recommend avoiding it.
- Different index, similar exposure: Selling a total US stock market fund and buying an S&P 500 fund. These track different indexes with different methodologies. This is generally considered safe, though the overlap is high.
Safe swap pairs: VTI (Total US Market) to VOO (S&P 500). VXUS (Total International) to IXUS (iShares International). BND (Total Bond) to AGG (iShares Aggregate Bond). Different index, different provider, same broad exposure.
When to Harvest Losses
The best time to look for harvesting opportunities is not December, despite what most articles tell you. The best time is throughout the year, whenever a position drops meaningfully. Here is why:
- Markets recover. If you wait until December, that losing position from March might be a winning position by year-end. The harvesting opportunity is gone.
- You can harvest the same position multiple times. If VTI drops in February, you harvest. If it drops again in July (in your replacement fund), you harvest again. Multiple harvests in a single year are perfectly legal as long as you respect the wash sale rule each time.
- Volatility creates opportunities. Market corrections, sector rotations, and earnings misses create temporary losses that are perfect harvesting candidates. Monitor your portfolio regularly.
See how much tax-loss harvesting could save you
Use our free calculator to estimate your annual tax savings from harvesting losses, based on your portfolio size and tax bracket.
Try the Tax-Loss Harvesting CalculatorStep-by-Step: How to Execute a Tax-Loss Harvest
Identify Positions with Unrealized Losses
Review your taxable brokerage accounts for any positions currently trading below your cost basis. Focus on individual tax lots, not just the overall position. You might have some lots at a gain and others at a loss.
Important: Tax-loss harvesting only works in taxable accounts. Losses in your 401(k), IRA, or Roth IRA have no tax impact and cannot be harvested.
Choose Your Replacement Investment
Before you sell, decide what you will buy. The replacement should:
- Track a different index or have a meaningfully different portfolio composition
- Provide similar broad market exposure so your asset allocation stays on target
- Not be "substantially identical" to the security you are selling
Sell the Losing Position Using Specific Lot Identification
When selling, use "specific lot identification" (SpecID) rather than the default FIFO (first in, first out) method. This lets you select exactly which tax lots to sell, maximizing your harvested loss. Most brokers support this in their trade settings.
Buy the Replacement Immediately
Place the buy order on the same day, ideally within minutes. You want to minimize the time you are out of the market. Even one day out can mean missing a 2% recovery that wipes out the tax benefit.
Wait 31 Days Before Swapping Back (If Desired)
After 31 days, you can sell the replacement and buy back your original fund if you prefer it for the long term. Many investors just keep the replacement permanently, since the broad exposure is similar enough that the difference does not matter.
The Real Dollar Impact
How much can tax-loss harvesting actually save? Let us look at a realistic scenario over 20 years.
Assume you have a $500,000 taxable portfolio. In an average year, you find 3-5% of the portfolio in harvestable losses (market volatility creates this naturally). That is $15,000 to $25,000 in harvested losses per year.
- Year 1: $20,000 in harvested losses. $10,000 offsets capital gains (saving $2,380 at 23.8% long-term rate). $3,000 offsets ordinary income (saving $720 at 24%). Remaining $7,000 carries forward.
- Over 20 years: Cumulative harvested losses of $300,000+. Total tax savings of $50,000 to $80,000, depending on your tax bracket and how gains materialize.
- Reinvested savings: If you reinvest those tax savings, the compounding effect adds another $20,000 to $40,000 over 20 years.
That is $70,000 to $120,000 in additional wealth from a strategy that takes maybe 30 minutes per quarter to execute. The returns on your time are exceptional.
Advanced Strategies
Pair harvesting with Roth conversions
If you harvest $20,000 in losses, you can convert $20,000 from a traditional IRA to a Roth IRA and pay zero additional tax. The loss offsets the conversion income. This is one of the most powerful combinations in tax planning, allowing you to shift money into tax-free accounts at no cost. Use our Roth Conversion Calculator to find your optimal annual conversion amount.
Harvest across accounts
The wash sale rule applies across all your accounts, including your spouse's accounts. If you sell VTI at a loss in your taxable account, your spouse cannot buy VTI in their taxable account within 30 days. Similarly, if your 401(k) automatically buys a fund that is substantially identical to what you just sold at a loss, it can trigger a wash sale. Review all accounts before harvesting.
Use losses to offset concentrated stock gains
If you are selling employer stock (RSUs, stock options, ESPP shares), the gains can be substantial. Harvested losses are the perfect offset. Plan your stock sales and loss harvesting together for maximum tax efficiency.
Common Mistakes
1. Triggering wash sales accidentally
The most common mistake is having automatic dividend reinvestment (DRIP) enabled. If you sell a fund at a loss and your DRIP buys more shares of the same fund 10 days later, that is a wash sale. Turn off DRIP for any fund you might harvest.
2. Harvesting in retirement accounts
Losses in a 401(k) or IRA are invisible to the tax code. Selling at a loss inside these accounts does not generate a deduction. Only harvest in taxable brokerage accounts.
3. Letting the tax tail wag the investment dog
Do not hold a losing investment just because you want to harvest the loss later. If the investment thesis is broken, sell it and take the loss now. The tax benefit is a bonus, not the reason to invest.
4. Forgetting to track cost basis adjustments
When you swap from one fund to another, your new cost basis is the purchase price of the replacement fund. If you swap back after 31 days, keep careful records. Your broker tracks this for securities they hold, but if you move between brokers, basis information can get lost.
Track cost basis and gains across all your accounts
Optionality pulls in your positions from every brokerage account and gives you a unified view of gains, losses, and tax optimization opportunities.
Get started free