About the Wash Sale Calculator
The US wash sale rule stops you from claiming a capital loss on a stock or fund if you buy the same or a substantially identical security within 30 days before or after the sale. The loss is not gone for good — it is added to the cost basis of the replacement shares, and their holding period includes the time you held the shares you sold — but you cannot deduct it this year.
This wash sale calculator takes the sale (shares, price, cost basis and date) and the replacement purchase (date, shares and price), checks whether the purchase falls inside the 61-day window, and works out the disallowed loss, the loss you can still claim and the adjusted basis of the new shares. If you bought fewer shares than you sold, only the matching portion of the loss is disallowed, as IRS Publication 550 describes.
It handles one sale and one replacement purchase at a time. Purchases in an IRA or a spouse’s account, options and automatic dividend reinvestments can also trigger the rule, and brokers only track wash sales within the same account, so check all your accounts before harvesting a loss.
With the default inputs, the disallowed loss (wash sale) is $1,500.00. Change any value above to recalculate instantly.
How to use the wash sale calculator
- 1Enter the number of shares you sold, the sale price and your cost per share.
- 2Enter the sale date.
- 3Enter the date, number of shares and price of the replacement purchase (before or after the sale).
- 4Read whether it is a wash sale, the disallowed loss and the adjusted basis of the new shares.
- 5Repeat for each replacement purchase within the window.
Formula and method
A wash sale occurs when you sell at a loss and acquire substantially identical securities within 30 days before or after the sale date — a 61-day window including the sale date. The calculator measures the calendar days between the two dates and flags a wash sale when they are 30 or fewer apart.
If you buy fewer shares than you sold, only the loss on that many shares is disallowed and the rest can be deducted. The disallowed loss is added to the cost of the replacement shares, so the adjusted basis is what you paid plus the deferred loss; the deferred loss is recovered when you eventually sell the replacement shares in a transaction that is not itself a wash sale.
- Loss
- Realized loss on the shares sold
- Disallowed
- Portion of the loss you cannot deduct now
- New basis
- Adjusted cost basis of the replacement shares
Worked examples
Buying back 15 days after a loss sale
Selling 100 shares bought at $55 for $40 creates a $1,500 loss. Buying 100 shares back at $42 just 15 days later is a wash sale, so the whole loss is disallowed and added to the new shares: $4,200 + $1,500 = $5,700, or $57 per share.
Partial wash sale: bought fewer shares before the sale
The 50 shares bought 18 days before the sale replace a quarter of the 200 shares sold, so a quarter of the $1,400 loss ($350) is disallowed. You can still deduct $1,050, and the 50 new shares have a basis of $975 + $350 = $1,325.
Waiting 36 days avoids the rule
A purchase 36 days after the sale is outside the 30-day window, so the full $1,500 loss is deductible and the new shares keep their $4,200 cost basis.
Frequently asked questions
What is the wash sale rule?+
Under Internal Revenue Code section 1091, you cannot deduct a loss on a stock or security if you acquire substantially identical securities within 30 days before or after the sale. The disallowed loss is added to the basis of the new shares instead.
How many days do I need to wait to avoid a wash sale?+
Wait at least 31 days after the sale before buying back, and make sure you did not buy any shares in the 30 days before the sale. The full window is 61 days: 30 before, the sale date and 30 after.
Is a wash sale loss lost forever?+
Usually not. The disallowed loss is added to the cost basis of the replacement shares, so it reduces your gain or increases your loss when you sell them later. An exception is buying the replacement in an IRA, where the IRS has ruled the loss is not added to basis.
What counts as substantially identical?+
The same stock, and contracts or options to acquire it, are covered by section 1091. The IRS has not published a bright-line test for funds: two funds tracking the same index from different sponsors are a gray area, while stocks of different companies or funds tracking clearly different indexes are generally not considered substantially identical.
Do dividend reinvestments trigger a wash sale?+
Yes. An automatic reinvestment within 30 days of selling shares at a loss is a purchase of substantially identical shares, usually causing a small partial wash sale. Turn off reinvestment before harvesting a loss to avoid it.
Does the wash sale rule apply to crypto?+
As of the statute text reviewed in October 2026, section 1091 covers "stock or securities" (including contracts or options to acquire them) and does not mention digital assets, and the IRS treats cryptocurrency held directly as property. Proposals to extend the rule to crypto have been introduced in Congress, so check the law for the year of your sale; shares of crypto ETFs are securities and are covered.
Tax results are estimates based on published rules and simplified assumptions. They are not tax advice — check official guidance or a tax professional for your situation.