How Does the Wash Sale Rule Affect Your Taxes?

Updated July 9, 2026 6 min read

Selling an investment at a loss and buying something nearly identical right back sounds like a clean way to lock in a tax benefit while keeping the same position. The tax code has a specific rule built to stop exactly that.

The short answer

The wash sale rule disallows a tax loss on the sale of a security if a substantially identical security is purchased within a window spanning roughly 30 days before and after the sale. When the rule applies, the loss isn’t simply lost — it gets added to the cost basis of the newly purchased security, effectively deferring the tax benefit rather than eliminating it outright. It’s a timing rule, not a ban on buying back an investment eventually, and the specific mechanics can be adjusted by the government over time.

Why the rule exists

Without a rule like this, an investor could sell a losing position on paper purely to claim a tax deduction, then immediately buy the same or a nearly identical investment back, ending the day in essentially the same market position while still claiming the tax benefit. The wash sale rule closes that loophole by treating a sale-and-quick-repurchase as if the position was never meaningfully closed for tax purposes, even though the trades themselves are entirely real and legal.

What counts as “substantially identical”

This is where a lot of confusion comes in. The rule doesn’t just apply to buying back the exact same security — it can also apply to something considered substantially identical, which can include options or other instruments tied closely to the same underlying investment. It generally does not apply to a different company’s stock, even one in the same industry, since different companies’ shares aren’t considered substantially identical to each other. The line can be genuinely unclear in edge cases, which is one reason this rule causes more filer confusion than most.

The 61-day window, explained

The relevant window isn’t just “30 days after” — it runs from 30 days before the sale through 30 days after, a 61-day span in total. That means a purchase made before the loss-generating sale can trigger the rule just as easily as a purchase made afterward, which surprises people who only think to check their trading activity after the fact. This window applies the same way regardless of whether the position would have been treated as a short-term or long-term holding, since the rule cares about the repurchase timing, not the original holding period.

How the disallowed loss gets handled

Rather than disappearing, a disallowed loss is added to the cost basis of the replacement security, which reduces the taxable gain — or increases the taxable loss — whenever that replacement security is eventually sold for good. In effect, the tax benefit is deferred until a sale happens without triggering the rule again. This connects directly to how a capital loss carryover works, since a wash-sale-adjusted position can still eventually produce a usable loss, just on a different timeline than originally planned. Automatic investment features, like scheduled purchases within a brokerage account, can inadvertently trigger a wash sale if they land inside this window without the investor specifically intending to repurchase anything.

What to weigh

The wash sale rule mostly matters to people trading similar securities frequently or engaging in strategies like dollar-cost averaging around a position they’re also trying to sell at a loss. Being aware of the 61-day window, and what counts as substantially identical, is generally more useful than trying to memorize every technical edge case.