The Wash Sale Rule, Explained

7 min read·Reviewed by the StockTools.ai Research Team

key takeaways
  • If you sell a security at a loss and buy a substantially identical one within 30 days before or after the sale, the loss is disallowed for now.
  • The danger zone is really 61 days: the 30 days before the sale, the sale day itself, and the 30 days after.
  • A disallowed loss is deferred, not destroyed — it gets added to the cost basis of the replacement shares and usually resurfaces when you finally sell.
  • Rebuying inside an IRA is the one version that can erase the loss permanently, and dividend reinvestment can trigger the rule by accident.
  • As of 2026 the details can change and the gray areas are genuinely gray, so confirm your specific situation with a tax professional.

The rule in one sentence

Here is the whole rule: if you sell a stock or other security at a loss and buy the same security — or something substantially identical to it — within 30 days before or after that sale, the IRS disallows the loss for now. You still lost the money; you just do not get to claim the deduction on this year’s return.

A worked example makes it concrete. Say you bought 100 shares of a company at $50 each on March 3, spending $5,000. The stock slides, and on June 10 you sell all 100 shares at $38, collecting $3,800. On paper that is a $1,200 loss. But on June 25 — just 15 days later — you buy 100 shares of the same company back at $40, spending $4,000. Because that repurchase landed inside the 30-day window after the loss sale, the whole thing is a wash sale, and the $1,200 loss cannot be deducted this year.

The rule exists because, without it, tax-motivated churn would be free. An investor could sell every losing position on December 30, buy everything back on December 31, harvest a pile of deductions, and end up holding the exact same portfolio. The wash sale rule says a loss only counts, for now, if you actually stepped away from the position for a meaningful stretch of time.

The 61-day window

The cleanest mental model is a 61-day danger zone: the 30 calendar days before your loss sale, the day of the sale itself, and the 30 calendar days after. Buy a substantially identical security anywhere in that span and the loss gets washed. Most people remember the 30 days after; it is the 30 days before that catches them off guard.

The look-back matters because of situations like this: you buy an extra 50 shares on June 1 while the stock is cheap, then decide on June 10 to sell an older, more expensive lot at a loss. Even though the purchase came first, it sits inside the window, so it can wash the June 10 loss. The order of the trades does not save you — only the distance between them does.

Note that these are calendar days, not trading days, and the counting is unforgiving. A repurchase 31 days after the sale is outside the window; a repurchase on day 30 is not. When people talk about waiting a month, the safe version of that habit is waiting 31 days, not four weeks.

Where the disallowed loss actually goes

This is the most misunderstood part: a washed loss is deferred, not destroyed. The disallowed amount gets added to the cost basis of the replacement shares, which means the loss is still sitting there in your position, waiting.

Back to the example. You rebought 100 shares for $4,000, and the $1,200 disallowed loss gets tacked onto that, so your adjusted basis in the new lot is $5,200 — even though you only paid $4,000. Now suppose the stock recovers and you sell the new lot at $55 per share for $5,500. Without the adjustment you would owe tax on a $1,500 gain; with it, your taxable gain is only $300. The old $1,200 loss finally did its job — it just did it later than you wanted.

There is a second, smaller consolation: the holding period of the original shares gets added to the replacement shares. That can help the new lot qualify for long-term capital gains treatment sooner than its purchase date alone would suggest. For most investors, the true cost of an accidental wash sale is timing — a deduction pushed into a later year — plus some bookkeeping. The exceptions that actually destroy the loss are covered below.

What counts as substantially identical

The same stock is obviously substantially identical to itself. The rule also reaches contracts and options to acquire the stock: selling shares at a loss and then buying a call option on that same stock inside the window is generally understood to trigger a wash sale, because the option is a way of keeping your claim on the same company.

The genuinely gray area is funds. If you sell one S&P 500 index fund at a loss and buy a different company’s S&P 500 fund the next day, is that substantially identical? The IRS has never published a bright-line answer. The common understanding among practitioners is that funds tracking clearly different indexes are not substantially identical, while swapping between two funds that track the exact same index is more debatable. That is a description of how the term is commonly interpreted, not a green light — this is exactly the kind of question worth putting to a tax professional.

What generally does not trigger the rule: buying a different company in the same industry. Selling one airline at a loss and buying a competitor is not a wash sale as commonly understood, even though the two stocks may move together. There is no official checklist, though, and the phrase substantially identical has never been exhaustively defined — which is the honest reason so much wash sale content hedges the way this paragraph just did.

The traps that actually hurt

The IRA trap is the worst one. If you sell a stock at a loss in a taxable brokerage account and buy it back inside your IRA — traditional or Roth — within the window, the IRS has taken the position that the loss is disallowed and there is no basis adjustment inside the IRA to preserve it. The deferral mechanism breaks, and the loss is simply gone, permanently. This is the one common scenario where a wash sale destroys value instead of just delaying it.

The cross-account trap is quieter. The rule looks across all of your accounts, and repurchases by your spouse are generally treated the same way — selling in one brokerage and rebuying in another, or in a spouse’s account, still washes the loss. Meanwhile, brokers are only required to flag wash sales involving identical securities within a single account, so the trades most likely to slip through are precisely the ones nobody flags for you.

The dividend reinvestment trap is the most accidental. If you sell most of a position at a loss but a DRIP quietly buys a few replacement shares inside the window, you have a partial wash sale. The good news is that partial means partial: if you sold 100 shares at a loss and the reinvestment bought back 3, only 3 percent of the loss is disallowed and rolled into the basis of those 3 shares. The rest of the loss survives. Still, it is a common reason a clean-looking tax return sprouts wash sale adjustments.

December, tax-loss harvesting, and staying current

The wash sale rule is why December tax-loss harvesting requires a calendar, not just a motive. Selling losers before year-end to offset realized gains is a well-known practice, but the 61-day window does not care about December 31. Sell at a loss on December 20 and rebuy on January 8, and the loss is washed — and because it is washed, it disappears from the current year’s return, which was the entire point of harvesting it in December.

People handle the window in a few well-known ways, described here for education rather than as recommendations: some simply wait 31 days after the sale before repurchasing, accepting the risk that the stock moves without them; some hold a similar-but-not-identical fund during the gap to keep market exposure; and some buy the replacement shares more than 30 days before the planned sale, temporarily doubling the position so the eventual sale falls outside the window. Each approach trades one kind of risk for another, and the middle option leans on the gray area from earlier.

A final honesty note: tax law moves. Over the years there have been proposals to extend wash-sale-style treatment to more asset types and to tighten various edges of the rule, and thresholds and interpretations shift. Everything above describes the rule as commonly understood as of 2026. Before acting on any of it — especially the gray areas — the boring advice is the right advice: run your specific situation past a qualified tax professional.

FAQ

Does the wash sale rule apply to gains?

No. The rule only disallows losses. If you sell at a gain and rebuy the same stock a minute later, the gain is fully taxable as usual — the IRS has no objection to you realizing income.

Is the loss gone forever after a wash sale?

Usually not. The disallowed loss is added to the cost basis of the replacement shares, so it typically resurfaces when you sell that new lot. The big exception is rebuying inside an IRA, where the basis adjustment is lost and the loss can be permanently erased.

Will my broker track wash sales for me?

Only partly. Brokers generally flag wash sales involving identical securities within the same account and report the adjustment on your 1099-B. Repurchases in a different account, in a spouse’s account, or in similar-but-not-identical securities are typically on you to track.

Does the wash sale rule cover crypto?

Historically the rule applied to stocks and securities, and crypto was commonly treated as falling outside it — but this has been an active area of legislative proposals for years. As of 2026, verify the current status with a tax professional before assuming either answer.

What happens if I sell at a loss and never rebuy?

Then there is no wash sale at all. The rule only activates when a substantially identical purchase lands inside the 61-day window. Sell, stay out of the position, and the loss is claimable under the normal capital loss rules.

If only some shares are repurchased, is the whole loss disallowed?

No — wash sales are proportional. If you sell 100 shares at a loss and repurchase 20 within the window, only the loss attributable to 20 shares is disallowed and rolled into the new basis. The loss on the other 80 shares is still allowed.

Put it to work

More to learn

Browse all guides →

Educational only — not financial advice. Concepts simplified for clarity; markets are messier than definitions.