Selling an investment at a loss on purpose is a legitimate tax strategy, covered in how tax loss harvesting works. But one rule can quietly cancel the tax benefit if you are not watching for it, and it catches more beginners by accident than on purpose.
The wash sale rule blocks you from claiming a tax loss if you buy the same security, or one the IRS considers "substantially identical," within 30 days before or after the sale, a 61-day window in total. Trigger it, and the loss is disallowed for that tax year. It is not gone forever: it gets added to the cost basis of the replacement shares, so you eventually get the benefit, just later than planned. The rule applies across every account you own, including a spouse's accounts and your own IRA.
How the wash sale rule works
The window covers 30 days before the sale, the day of the sale, and 30 days after it, 61 days in total. Buy the same or a substantially identical security anywhere in that window, in any account, and the loss on that sale is disallowed.
The rule applies per share, not just per trade, which surprises people. Say you sell 100 shares of a fund for a $2,000 loss on July 1, then buy back 50 shares on July 20, still inside the window. Only half your position was repurchased, so only half the loss is disallowed: $1,000 gets added to the basis of the 50 replacement shares, while the other $1,000, on the 50 shares you did not repurchase, is still a valid deductible loss.
What counts as "substantially identical"
The IRS has never published a precise legal definition, which leaves some judgment involved.
- The same stock or the same fund is always identical. Selling and rebuying shares of the exact same ticker triggers the rule with certainty.
- Two different funds tracking the same index are generally treated as not substantially identical by most tax professionals, which is the standard workaround: sell an S&P 500 index fund from one provider at a loss and buy a different provider's S&P 500 or total-market fund instead. You keep roughly the same market exposure without holding the exact fund through the window.
- Options on a stock, or securities convertible into it, can count as substantially identical to the stock itself. When you are genuinely unsure whether two holdings are close enough to trigger the rule, the safer assumption is that they are, and you should pick something more clearly different.
The trap that catches beginners: dividend reinvestment
The fix is simple once you know to look for it: turn off automatic dividend reinvestment on a position before harvesting a loss in it, or check the fund's dividend schedule against the window before you sell.
What happens if you trigger it anyway
A disallowed wash sale loss is deferred, not destroyed, in a normal taxable brokerage account. It gets added to the cost basis of the replacement shares, and the holding period of the original shares carries over to the replacement shares too. Your broker reports this on Form 1099-B with a wash sale adjustment, so it is worth checking that form each year rather than assuming you tracked every instance correctly yourself.
The one case where the loss is truly gone for good, not just deferred, is repurchasing inside an IRA or 401(k). Those accounts have no cost basis to adjust, so a loss disallowed by a repurchase there simply disappears. See the IRA repurchase trap covered in how tax loss harvesting works for why that version of the mistake is more costly than the ordinary version.
The honest counterargument: this is a timing issue, not a lost-money issue
The wash sale rule gets talked about as if breaking it is a costly mistake. In most cases, that overstates it.
- In a normal taxable account, the loss is only delayed, not eliminated. You still get the tax benefit eventually, when you sell the replacement shares outside any wash sale window, since the disallowed loss raised their cost basis.
- Buy-and-hold investors rarely encounter this rule at all, since it only matters if you are selling something at a loss on purpose and want to stay invested through the sale.
- Triggering it unknowingly still has a real cost in the year it happens: a loss you were counting on to offset this year's gains is unavailable this year, which can produce a tax bill you did not plan for, even though the underlying loss is not gone.
The rule is worth understanding and avoiding on purpose. It is not worth losing sleep over if you accidentally trigger it in a regular brokerage account, since the delay, not a permanent loss, is the actual consequence.
What a beginner should actually do
- Before harvesting a loss, check whether you bought the same security in the past 30 days, including any automatic dividend reinvestment purchases.
- Pick a clearly different replacement fund rather than a same-index fund from the same provider if you are unsure whether they count as substantially identical.
- Turn off automatic dividend reinvestment on any position you might harvest a loss in.
- If you want to buy back the exact same fund, wait the full 31 days rather than counting exactly 30.
- Check your 1099-B each year for wash sale adjustment codes to confirm your broker did not catch something you missed.
The quick version
- The wash sale rule disallows a tax loss if you buy the same or a substantially identical security within 30 days before or after the sale, a 61-day window total
- The rule applies per share, so a partial repurchase only disallows a proportional part of the loss
- Different funds tracking the same index are generally not substantially identical, which is the standard swap workaround
- Automatic dividend reinvestment can trigger a wash sale without any manual buy order, the most common accidental trigger
- In a normal taxable account, a disallowed loss is deferred, added to the replacement shares' cost basis, not permanently lost
- Repurchasing inside an IRA or 401(k) is the one version where the loss is genuinely gone for good, since those accounts have no cost basis to adjust
- The rule applies across every account you and your spouse own, not just the account where the sale happened
Most people encounter this rule only when they are actively tax-loss harvesting on purpose, and the fix is straightforward: know the window, pick a genuinely different replacement, and watch your dividend reinvestment settings.