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.
Your trades
Your estimate
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
- It does not decide whether two securities are “substantially identical”. Publication 550 says this depends on all the facts and circumstances; stock of different corporations is ordinarily not substantially identical.
- If you buy replacement shares in an IRA or Roth IRA, the loss is still disallowed, but the rule that adds it to basis does not apply, so the page shows it as lost basis. Check Publication 550 for your case.
- It does not handle a loss and a gain on identical blocks sold the same day, short sales, straddles, dealers or the holding-period dates. The holding period of the shares sold carries over to the matched replacement shares.
- Report adjustments on Form 8949 and Schedule D as the instructions direct.
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
- Total loss equals total cost basis of the shares sold minus total proceeds. The rule only applies when this is a loss.
- Matched shares are replacement shares bought in the window, matched against the shares sold. If you bought more or fewer shares than you sold, Publication 550 says you match the shares bought with an equal number of the shares sold, in the same order you bought them, beginning with the first shares bought.
- Disallowed loss equals total loss times matched shares divided by shares sold. Allowed loss is the rest.
- New basis of each matched replacement lot equals its own cost plus its share of the disallowed loss. The deduction is postponed, not erased: it comes back when you eventually dispose of the replacement shares.
- Holding period of the replacement shares includes how long you held the shares you sold, which can turn a later sale into a long-term one.
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
- Relying on the broker's form. Form 1099-B box 1g shows disallowed wash sale loss only when the shares were covered securities and the replacement shares had the same CUSIP number and were bought in the same account. Publication 550 states that you cannot deduct a loss from a wash sale even if it is not reported on Form 1099-B. Purchases in a different brokerage account, in your spouse's account or in an IRA are your responsibility.
- Forgetting the IRA. Buying the stock in an IRA or Roth IRA within the window still disallows the loss, and Publication 550 excludes that case from the basis-increase rule, so the loss is effectively lost. This tool reports it separately instead of adding it to a basis.
- Assuming "different ticker" means safe. Publication 550 says to decide whether securities are substantially identical by considering all the facts and circumstances. Stock of different corporations is ordinarily not substantially identical, but there are exceptions, for example predecessor and successor corporations in a reorganisation, or convertible preferred stock with common stock under certain conditions. No calculator can decide that for you.
- Mixing a loss and a gain on the same day. A loss from a wash sale of one block cannot be used to reduce gains on identical blocks sold the same day. This calculator handles a single sale lot.
- Dealers, short sales and options. Different rules apply to dealers, short sales, securities futures contracts, warrants and options. They are outside this page.
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.
- IRS Publication 550, Investment Income and Expenses, section Wash Sales (retrieved 2026-10) – definition, matching order, basis and holding period, Form 1099-B box 1g, reporting
- IRS Instructions for Form 8949 (retrieved 2026-10) – code W and column (g) adjustment for wash sale losses
- 26 U.S.C. 1091, Loss from wash sales of stock or securities (retrieved 2026-10) – the statute behind the rule
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.