The wash sale rule, explained with an example
Sell at a loss and buy back within 30 days, and the loss can be disallowed. How the rule works, where it catches people out, and what Portfolio Tracker does and doesn't flag.
Last reviewed 2026-09-17
Selling an investment at a loss can lower your tax bill. The wash sale rule stops you from claiming that loss if you effectively kept the position by buying it back around the same time.
The rule in one sentence
If you sell a security at a loss and buy the same or a substantially identical security within 30 days before or after the sale, you can't deduct the loss for that year (26 U.S.C. §1091).
That's a 61-day window: the 30 days before the sale, the day of the sale, and the 30 days after.
The loss isn't gone — it moves
In most cases a wash sale defers the loss rather than erasing it:
- The disallowed loss is added to the cost basis of the replacement shares.
- The holding period of the shares you sold is added to the holding period of the replacement shares.
You get the benefit later, when you sell the replacement shares.
A worked example
| Date | Action | Shares | Price | Amount |
|---|---|---|---|---|
| 5 Jan | Buy | 100 | $50 | $5,000 |
| 1 Mar | Sell | 100 | $40 | $4,000 |
| 15 Mar | Buy | 100 | $42 | $4,200 |
- The 1 March sale creates a $1,000 loss.
- You bought the same stock again 14 days later, inside the 30-day window, so the loss is disallowed this year.
- The $1,000 is added to the new shares' cost: $4,200 + $1,000 = $5,200, or $52 a share instead of $42.
- If you later sell those shares for $50 each, you report a $200 loss — not an $800 gain.
If you buy back fewer shares than you sold, only a matching fraction of the loss is disallowed. Buying back 50 of the 100 shares would disallow $500 and leave $500 deductible.
Where people get caught out
The 30 days before count too
Buying more shares, then selling your older, higher-cost shares at a loss within 30 days, is a wash sale — even though the purchase came first.
Your other accounts count
The rule looks at you, not one account. A purchase in a different brokerage account, or by your spouse, can trigger it. A purchase in your IRA is especially costly: under Revenue Ruling 2008-5 the loss is disallowed and is not added to your IRA basis, so it's lost for good.
Reinvested dividends count
Automatic dividend reinvestment is a purchase. A small reinvestment inside the window can trigger a partial wash sale.
Your broker only sees part of the picture
Brokers report wash sales on Form 1099-B only for identical securities within the same account. Anything that crosses accounts is yours to track and report.
"Substantially identical" isn't clearly defined
The same stock clearly counts. Two funds from different companies tracking different indexes generally don't. Cases in between — for example, two funds tracking the same index — have no clear IRS guidance, so ask a tax professional before relying on them.
What Portfolio Tracker flags — and what it doesn't
For every sale at a loss, Portfolio Tracker looks for a purchase of the same ticker, in the same account, within 30 days before or after. Matches are marked with a wash-sale badge in the Tax tab.
| Situation | Flagged? |
|---|---|
| Same ticker, same account, within 30 days | Yes |
| Same ticker, a different account or an IRA | No — check these yourself |
| A different but substantially identical security | No |
| Purchases by a spouse | No |
Flags only. Portfolio Tracker does not adjust cost basis or holding periods for wash sales. Its figures show the loss as if it were allowed, with a flag so you can review it. Your broker's 1099-B, adjusted for anything across accounts, is what goes on your return.
How to avoid an accidental wash sale
- Wait at least 31 days after a loss sale before buying the same security back.
- Turn off dividend reinvestment on positions you might sell at a loss.
- Check your other accounts, including IRAs, before and after harvesting a loss.
- If you want to stay invested, consider a similar but not substantially identical investment for the 31 days — and confirm the choice with a tax professional.