Retirement & Taxes
The Wash Sale Rule: 30 Days That Can Erase a Tax Loss
Selling a stock at a loss for tax purposes only works if you avoid repurchasing a 'substantially identical' security for 30 days. Here is what counts.
Tax-loss harvesting — the practice of selling losing investments to generate a capital loss that offsets capital gains elsewhere — is one of the few reliably valuable tax strategies available to ordinary investors. It is also one of the easiest to accidentally disqualify, because of a single IRS rule called the wash sale rule.
What the rule says
If you sell a security at a loss and buy the same security, or a "substantially identical" security, within 30 days before or after the sale, the loss is disallowed for tax purposes. The 30-day window runs in both directions, so the total prohibited window is actually 61 days: 30 days before the sale, the day of the sale, and 30 days after.
The disallowed loss is not lost forever. It is added to the cost basis of the replacement shares, which means you will eventually get the deduction when you sell the replacement shares. But the timing benefit — and any plans to use the loss against this year's gains — is gone.
What "substantially identical" means
This is where most accidental wash sales happen. The IRS has never published a comprehensive list, but in practice:
- Selling Apple stock and buying Apple stock back is obviously a wash sale.
- Selling an S&P 500 index fund from Vanguard and buying an S&P 500 index fund from Fidelity is almost certainly a wash sale, because they track the same index.
- Selling an S&P 500 index fund and buying a Total Stock Market index fund is generally not a wash sale, because the underlying indexes are different.
- Selling individual stock options and buying back the underlying stock can be a wash sale.
The household-level trap
The wash sale rule applies at the household level, not the account level. If you sell a stock at a loss in your taxable brokerage account and then buy it in your IRA within 30 days, the IRS still calls that a wash sale — and unlike a normal wash sale, the disallowed loss inside an IRA is gone for good, because IRA cost basis adjustments do not carry over.
The same applies to your spouse's accounts. If your spouse buys the same security in their account within the 30-day window, you have triggered a wash sale on your loss.
How to harvest losses without tripping the rule
The standard approach is to sell the losing position and immediately replace it with a similar-but-not-identical position. For example, sell a large-cap growth ETF and buy a large-cap blend ETF; sell a Vanguard total market fund and buy a Schwab total market fund (the indexes differ slightly); or sell an individual stock and buy an industry ETF for 31 days.
After the 31-day window is clear, you can rotate back into the original position if you want, though many investors discover the replacement was just as good.
What automatic investments can do to you
The wash sale window includes the 30 days before the sale. If you have a recurring automatic purchase of a security — for example, a monthly 401(k) contribution that buys an S&P 500 fund — and you sell the same security at a loss in a taxable account, the prior automatic purchase can trigger the rule. The fix is usually to pause the automatic purchase for the relevant window or change the target fund.
Our Wash Sale Gate tool lets you enter the sale date and any planned purchases to check whether the harvest is clean.
Related tool
Wash Sale Gate →