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:

You get the benefit later, when you sell the replacement shares.

A worked example

DateActionSharesPriceAmount
5 JanBuy100$50$5,000
1 MarSell100$40$4,000
15 MarBuy100$42$4,200

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.

SituationFlagged?
Same ticker, same account, within 30 daysYes
Same ticker, a different account or an IRANo — check these yourself
A different but substantially identical securityNo
Purchases by a spouseNo

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