Capital Gains

Wash Sale Rule Explained: When a Capital Loss Is Disallowed

Sold at a loss but got no deduction? The wash-sale rule under IRC Section 1091 disallows a loss when you buy a substantially identical security within 30 days. The loss is not erased, it is added to your replacement basis. Worked example inside.

MH
By Muhammad Haroon · Developer & Researcher, Indie Tax Stack
Educational content only. This article reflects 2026 tax law and is for informational purposes. It is not professional tax, legal, or financial advice. Consult a licensed tax professional before making tax decisions.

If you sold a stock at a loss and got no deduction for it, the wash-sale rule is usually why. Under IRC Section 1091, a loss is disallowed when you buy the same security, or one substantially identical to it, within 30 days before or after the sale. That gives a 61-day window around the sale. The loss is not gone, though. It is added to the cost basis of the replacement shares, and your holding period carries over, so the deduction is postponed rather than erased. You get the benefit later, when you finally sell the replacement in a clean trade.

The 61-day window

The wash-sale window is wider than most people expect. It covers:

  • The 30 days before the sale,
  • The day of the sale,
  • The 30 days after the sale.

That is 61 days in total. A purchase anywhere in that window can trigger the rule, including a purchase you made before you decided to sell. Buying first and selling later can still be a wash sale.

Substantially identical securities

The rule applies to the same security and to anything substantially identical to it. Selling one company’s stock and buying it back is the clearest case. Selling a fund and buying a different fund that tracks the same index can also be substantially identical. Selling one company and buying a genuinely different company is not. The phrase substantially identical is the line that decides whether your replacement is safe, and it is a judgment call the IRS can challenge.

Partial wash sales and where replacements count

If you replace only some of the shares you sold, only the matching portion of the loss is disallowed. The rest stays deductible. The rule also reaches across accounts. A replacement purchase in another taxable account counts, and a purchase in your IRA can trigger it as well, with the harsher result that the disallowed loss is simply lost rather than added to basis. A purchase by your spouse can count too. The rule looks at the household and at all of your accounts, not just the one where you sold.

What happens to the disallowed loss

This is the part worth understanding, because the loss is not a permanent penalty. When a wash sale disallows a loss:

  • The disallowed amount is added to the cost basis of the replacement security.
  • Your holding period carries over from the shares you sold.
  • The deduction is postponed, and you recover it when you sell the replacement in a transaction that is not itself a wash sale.

So a wash sale is a timing setback, not a lost deduction, as long as the replacement is held in a taxable account.

A worked example: a $1,000 loss washed out

Take a single filer with $120,000 of income who has a $5,000 short-term gain and a $1,000 short-term loss, then rebuys the losing position within 30 days. We ran both versions through the Capital Gains Calculator.

  • Loss allowed (no wash sale). The $1,000 loss offsets the gain, leaving a $4,000 net short-term gain. Tax at the 24% ordinary rate: $960.
  • Loss disallowed (wash sale). The $1,000 loss is removed from this year’s netting, leaving the full $5,000 short-term gain. Tax: $1,200.

The wash sale cost $240 more in tax this year, which is 24% of the $1,000 disallowed loss. That $1,000 is now added to the basis of the replacement shares, so you recover it when you sell them later.

Use the Capital Gains Calculator to see how a disallowed loss changes your netting and your tax.

How the calculator handles wash sales

The calculator has a Wash-Sale Disallowed field. Enter only an amount you have already verified as disallowed. The tool then pulls that amount out of your current-year loss netting, which is exactly what the IRS does. It does not identify your tax lots, track your replacement purchases, or decide whether two securities are substantially identical. Those determinations are yours, or your broker’s, or your tax professional’s. The calculator models the tax effect once you know the number.

Open the Capital Gains Calculator to test a harvest that may run into the wash-sale rule.

Sources

Last reviewed: June 21, 2026.

Frequently Asked Questions

What is the wash-sale rule?

The wash-sale rule disallows a capital loss when you buy the same or a substantially identical security within 30 days before or after the sale that produced the loss. The disallowed loss is added to the basis of the replacement security rather than deducted now.

Is a disallowed wash-sale loss gone forever?

No, not if the replacement is in a taxable account. The disallowed loss is added to the basis of the replacement shares and the holding period carries over, so you recover the deduction when you sell those shares in a non-wash transaction. A replacement bought inside an IRA is the exception, where the loss can be permanently lost.

How long do I have to wait to avoid a wash sale?

You must avoid buying the same or a substantially identical security for 30 days before and 30 days after the sale. Waiting until at least 31 days after the sale to repurchase keeps the loss deductible.

Run the numbers yourself

Model a disallowed wash-sale loss in your netting

Open Calculator