---
title: "The wash-sale rule: why your tax loss can vanish, for a while"
description: "Sell a stock at a loss and rebuy it within 30 days and the IRS will not let you deduct the loss that year. The loss is not destroyed, it is deferred into the cost of the new shares. Understanding that one mechanic clears up most of the confusion around the rule."
category: "Personal Finance"
category_url: https://boursel.com/category/personal-finance
author: "Olivia Chen"
published: 2026-07-20T22:18:00.000Z
updated: 2026-07-20T22:18:00.000Z
canonical: https://boursel.com/article/the-wash-sale-rule-why-your-tax-loss-can-vanish-for-a-while
tags: ["taxes", "investing", "capital-gains", "irs"]
---
# The wash-sale rule: why your tax loss can vanish, for a while

Sell a stock at a loss and rebuy it within 30 days and the IRS will not let you deduct the loss that year. The loss is not destroyed, it is deferred into the cost of the new shares. Understanding that one mechanic clears up most of the confusion around the rule.

The wash-sale rule is one of the most misunderstood corners of the US tax code, and most of the confusion comes from one wrong assumption: that a disallowed loss is a lost loss. It is not. It is a delayed one.

Everything below on the core mechanic is from [IRS Publication 550](https://www.irs.gov/publications/p550), the authoritative source. Where the rule reaches into areas that publication does not spell out, this piece says so rather than filling the gap.

## The rule itself

In the IRS's words, "you generally cannot deduct a loss on the sale or trade of stock or securities if you acquire substantially identical stock or securities within 30 days before or after the sale."

Count the days and it is a 61-day window: the 30 days before the sale, the day of the sale, and the 30 days after. Buy back the same holding anywhere inside that window and the loss is disallowed for that year.

## What happens to the disallowed loss

This is the part to hold onto, because it defuses most of the worry.

Per Publication 550, "the disallowed loss is added to the basis of the new stock. The holding period of the new stock includes the holding period of the stock sold."

In plain terms, the loss moves into the cost basis of the replacement shares. Say you buy a fund for $10,000, it falls to $8,000, you sell for a $2,000 loss, and within the window you rebuy for $8,500. The $2,000 deduction is denied this year, but your basis in the new shares becomes $10,500, the $8,500 you paid plus the $2,000 disallowed. When you eventually sell those shares for good, that higher basis produces a larger loss or a smaller gain. The benefit reappears, just later.

The rule also lets you keep the original holding period: the time you held the first lot carries over to the replacement, which matters for whether a future gain is long or short term.

So the wash-sale rule is a timing rule, not a confiscation. It stops you from booking a tax loss while staying economically in the same position, which is exactly the maneuver it was written to prevent: sell for the deduction, rebuy immediately, keep the investment.

## "Substantially identical," and why it is fuzzy

The rule bites only on "substantially identical" securities, and Publication 550 uses the phrase without laying out an exhaustive test.

The clear cases are clear. Selling a company's common stock and rebuying the same common stock is substantially identical. Selling one company's stock and buying an unrelated company's stock is not.

The genuinely uncertain zone is index funds. Two S&P 500 funds from different providers hold almost the same securities in almost the same weights, and are widely treated as substantially identical in practice even though they are different legal products. Move to funds tracking similar-but-different indexes, or bond funds with slightly different profiles, and the boundary gets blurry. This is why "substantially identical" is the part practitioners argue about, and it is not resolved by the plain text of the publication.

## Two complications the core text does not settle

Two situations come up constantly and are worth flagging precisely, because Publication 550's basic wash-sale section does not resolve them and this piece will not pretend otherwise.

**Retirement accounts.** A widely discussed scenario is selling at a loss in a taxable account and buying the same security in an IRA inside the window. The tax treatment of that case is governed by separate IRS guidance rather than the basic rule quoted above, and it is materially harsher than an ordinary wash sale, because the usual basis-add-back does not work the same way inside an IRA. If you hold the same security in a taxable account and a retirement account, this is a situation to check against current IRS guidance or with a tax professional before acting, not to assume.

**Dividend reinvestment.** If a fund or stock automatically reinvests dividends into new shares, those automatic purchases are still purchases. In principle they can fall inside a wash-sale window around a loss sale without any deliberate action. The interaction is real enough to be aware of; the specifics are exactly the kind of detail to confirm rather than guess.

We flag both rather than detailing them because we could not verify the specific mechanics from the primary source available for this piece, and getting tax specifics wrong is worse than pointing readers to the right question.

## Where it connects to tax-loss harvesting

The legitimate practice the rule constrains is tax-loss harvesting: deliberately selling losers to realize losses that offset capital gains, or up to a limited amount of ordinary income, while keeping your overall investment plan intact.

The wash-sale rule is the boundary on that practice. To harvest a loss and keep it, you generally either stay out of the sold security for 31 days, or replace it with something that is genuinely not substantially identical so your portfolio keeps its shape without tripping the rule. That second path is why harvesting so often involves swapping one broad-market fund for a different one, and it is also why the "substantially identical" fuzziness above matters in real money.

## The practical takeaway

Three things carry most of the value here.

A disallowed wash-sale loss is deferred, not destroyed; it lives on in the basis of your replacement shares.

The window is 61 days, centered on the sale, and it counts purchases before the sale as well as after.

And the rule's hardest edges, retirement-account interactions and what counts as substantially identical, are exactly where confident-sounding internet advice is most likely to be wrong. Those are the points to verify against the IRS or a professional, because the cost of getting them wrong shows up at tax time when it is too late to fix.
