United States · Investments and tax

Wash sale rule calculator.

Enter a stock sale at a loss and the shares you bought around it. See how much of the loss is disallowed, what is still deductible and how the basis of the new shares changes.

A loss is disallowed when you buy substantially identical stock or securities within 30 days before or after the sale, a 61-day window. The disallowed loss is added to the basis of the replacement shares and their holding period includes the old one.

IRS Publication 550 (2025)Verified October 1, 2026

Advertisement

Your trades

Substantially identical shares you bought

Add up to four purchases. Leave unused rows blank. Purchases outside the 61-day window are ignored.

Purchase 1
Purchase 2
Purchase 3
Purchase 4

Your estimate

Advertisement

How the wash sale rule works

If you sell stock or securities at a loss and, within 30 days before or after the sale, you buy substantially identical stock or securities, acquire them in a fully taxable trade, acquire a contract or option to buy them, or acquire them for your IRA or Roth IRA, the loss is not deductible. If your spouse or a corporation you control buys substantially identical stock, that is a wash sale too. The window runs 30 days before the sale through 30 days after, which is 61 days including the sale date.

Formula: disallowed loss = total loss × matched shares ÷ shares sold. Matched shares are the replacement shares matched to the shares sold, in the order you bought them. Allowed loss = total loss − disallowed loss. Each matched lot’s basis rises by its share of the disallowed loss.

Worked example (IRS Publication 550)

You bought 100 shares of M stock for $5,000 and sold them January 3, 2025 for $4,000, a $1,000 loss. In the 30 days before, you bought 50 shares on December 13, 2024 for $2,750 and 25 shares on December 20, 2024 for $1,125. Seventy-five shares are matched, so $1,000 × 75 ÷ 100 = $750 is disallowed and $250 is deductible. The 50-share lot gets two-thirds of $750 ($500), so its basis is $3,250. The 25-share lot gets $250, so its basis is $1,375. The form above is preloaded with this example.

What this page does not do

Official source: IRS Publication 550, Investment Income and Expenses (2025), section “Wash Sales”, read October 1, 2026. IRS Topic 409 covers general capital gains and losses but not wash sales, so it is not used for these figures. The rule has no dollar thresholds or rates, so there are no yearly numbers to go stale.

The 61-day window, step by step

People call it the 30-day rule, but the window is 61 days long: the 30 days before the sale, the day of the sale, and the 30 days after. Count calendar days, not trading days. For a sale on January 3, 2025, the window runs from December 4, 2024 through February 2, 2025, and the form above prints your exact window dates. A purchase of substantially identical stock anywhere in that span can trigger the rule, including a purchase made earlier than the sale, which surprises people who only watch for buybacks.

The rule is triggered by more than a plain purchase. Publication 550 lists four acquisitions inside the window: buying substantially identical stock or securities, acquiring them in a fully taxable trade, acquiring a contract or option to buy them, and acquiring substantially identical stock for your IRA or Roth IRA. A purchase by your spouse or by a corporation you control also counts.

The arithmetic, variable by variable

A second worked example: several small purchases

This follows the second example in Publication 550. You bought 100 shares of M stock and sold them on January 29, 2025 at a $1,000 loss. On each of four days from February 3 to February 6, 2025 you bought 50 shares of substantially identical stock. Only 100 of the 200 replacement shares can be matched, and they are matched in purchase order, so the February 3 and February 4 purchases are the matched lots. The whole $1,000 loss is disallowed, and $500 is added to the basis of each of those two 50-share lots. The February 5 and 6 purchases are unaffected. If you change the calculator to that sale and enter the four purchases, it will show the same split.

Common mistakes and edge cases

Reporting a wash sale

Publication 550 says to report a wash sale in Part I or Part II of Form 8949 with the appropriate box checked, with all columns completed. The Form 8949 instructions use code W in column (f) for a loss disallowed under the wash sale rules, with the disallowed amount entered as a positive adjustment in column (g). Totals then flow to Schedule D. Keep trade confirmations for every lot so you can show how the basis and holding period were carried over.

Who this is for, and what it does not cover

This is a quick check for individual investors planning a tax-loss sale or reviewing a year of trades: did my purchase inside the window undo my loss, and what is my new cost basis? It does not read broker statements, track many lots over time, handle cryptocurrency or other property that your tax adviser may treat differently, or decide on substantial identity. For gains and the wider picture see the capital gains tax calculator and the net investment income tax calculator. Canadian readers should use the superficial loss calculator, which applies a similar but different rule.

Sources

Primary sources used for this page, each retrieved October 2026.

Advertisement

Frequently asked questions

What is the wash sale rule in simple terms?

If you sell stock or securities at a loss and buy substantially identical stock or securities within 30 days before or after the sale, you cannot deduct that loss. The disallowed loss is added to the basis of the replacement shares, so the deduction is postponed until you sell them.

How long is the wash sale window?

It is 61 calendar days: 30 days before the sale, the day of the sale and 30 days after. Purchases made before the sale count as well as purchases made after it.

Does the wash sale rule apply to gains?

No. It only disallows losses. A sale at a gain is taxed normally.

Is the disallowed loss gone forever?

No. It is added to the basis of the replacement shares, and the holding period of the old shares carries over. The deduction is postponed until you dispose of the replacement shares.

What if I buy back fewer shares than I sold?

Only the loss on the matched shares is disallowed. In the IRS example, buying back 75 of 100 shares disallows $750 of a $1,000 loss and leaves $250 deductible.

Does buying the stock in my IRA count as a wash sale?

Yes. Publication 550 lists acquiring substantially identical stock for your IRA or Roth IRA as a wash sale. In that case the disallowed loss is not added to any basis.

Will my broker track wash sales for me?

Only partly. Form 1099-B box 1g reports disallowed loss only for covered securities bought with the same CUSIP in the same account. The IRS says you cannot deduct a wash sale loss even if the broker does not report it, so check other accounts and your spouse's trades.

Is there a Canadian version of this rule?

Canada has a similar 30-day rule called the superficial loss rule. It works differently in places, so use the Canadian calculator linked on this page for those trades.

Estimate only

This page is educational and is not tax advice. Confirm with Publication 550, your broker’s Form 1099-B or a tax professional. Calculations run in your browser; nothing is sent anywhere.