Wash Sale Calculator
Bought back within 30 days of selling at a loss? See how much of the loss the wash-sale rule disallows, what you can still deduct, and the new shares' basis.
Wash Sale Calculator
Background.
You sell 1,000 shares at a $10,000 loss in early December, then buy 400 of them back two weeks later because you still like the company. On your return, $4,000 of that loss is gone for now. The wash-sale rule, section 1091 of the tax code, disallows a loss on stock or securities when you buy substantially identical ones within 30 days before or after the sale, a 61-day window centred on the sale date.
The rule exists to stop investors from claiming a loss while keeping the same position, and it is narrower than it first sounds. The loss is not forfeited in the usual case: Publication 550 has you add the disallowed amount to the cost of the replacement shares, so it comes back as a smaller gain or a larger loss when you eventually sell them, and the holding period of the old shares carries over to the new ones. And it only reaches as far as the shares you actually bought back. Repurchase 400 of 1,000 shares and only 400 shares' worth of the loss is caught; the other 600 shares' loss is deductible this year.
The calculator applies that matching to one sale. Enter the loss, the number of shares sold, the number of substantially identical shares bought inside the window and what those replacement shares cost; it returns the loss disallowed, the loss you can still claim and the adjusted basis of the replacement shares.
The window is easy to trip over in ways that have nothing to do with a deliberate buy-back: a dividend reinvestment, a purchase in your IRA, your spouse buying the same stock, or a call option. Those cases, and the reporting on Form 8949, are covered in the questions below. Deciding whether two different securities are substantially identical is a judgement the calculator leaves to you.
What is wash sale calculator?
A wash sale is a sale or trade of stock or securities at a loss where, 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 buy them for your traditional or Roth IRA. It also counts if your spouse or a corporation you control makes the purchase. The loss on the matched shares is not deductible in the year of sale. Instead, except when the replacement was bought in an IRA, it is added to the basis of the replacement shares, and their holding period includes the time you held the shares you sold. That tacking can change the character of the eventual result: if you had owned the sold shares for ten months, the replacement shares start with those ten months, so selling them more than two months later produces a long-term gain or loss. The rule applies only to losses: selling at a gain and buying back the next day is allowed and simply resets the basis.
How to use this calculator.
- In Loss on shares sold, enter the realized loss on the lot, cost basis minus sale proceeds, as shown on your broker's Form 1099-B or trade confirmation. Enter it as a positive number, and use the loss before any wash-sale amount the broker has already reported in box 1g, so the same disallowance is not counted twice.
- In Shares sold at a loss, enter the number of shares in that sale. Fractional shares are accepted.
- In Substantially identical replacement shares, count only shares acquired in the 61-day window: from 30 days before the sale to 30 days after it, across every account you, your spouse or a corporation you control own, IRAs and reinvested dividends included.
- In Original basis of replacement shares, enter what you paid for those replacement shares, including commissions.
- Read the disallowed loss, the loss you can still claim, and the replacement shares' adjusted basis, then report the sale on Form 8949 with code W and the disallowed amount in column (g).
The formula.
The calculation matches replacement shares against the shares sold, one for one. With L the loss on the sale, S the shares sold, R the replacement shares and B their cost, the share of the sale caught by the rule is min(R ÷ S, 1), and the disallowed loss is L × min(R ÷ S, 1). The loss you can still claim this year is L minus that amount. The adjusted basis of the replacement shares is B plus the disallowed loss.
Two assumptions sit inside that. The first is that the loss is spread evenly over the shares sold, which is true when they came from one purchase lot. If the sale mixed lots bought at different prices, the loss per share differs and you should run each lot separately. The second is the cap at 1: once you have bought back as many shares as you sold, the whole loss is disallowed, and buying more cannot disallow more. Publication 550 matches shares in the order you bought them, beginning with the first, so only that many replacement shares carry the adjustment; the rest keep their ordinary cost.
The adjusted-basis output is a total across all the replacement shares you entered. When replacements came in several purchases, the disallowed loss is divided among the matched lots, in the IRS's own example in proportion to their share counts, and each lot's basis must be tracked separately for its eventual sale. When the replacement went into an IRA, ignore the basis output: no adjustment is made there. One more rule the arithmetic does not apply: if you sell several blocks of the same stock on one day, some at a gain and some at a loss, a wash-sale loss on one block cannot be used to reduce the gains on the others.
A worked example.
With the default entries, 1,000 shares were sold at a $10,000 loss, $10 a share, and 400 substantially identical shares were bought back inside the window for $20,000, or $50 each. The share of the sale caught by the rule is min(400 ÷ 1,000, 1) = 0.4, so the disallowed loss is 10,000 × 0.4 = $4,000. The other 10,000 − 4,000 = $6,000 is deductible this year. The replacement shares' basis rises from $20,000 to 20,000 + 4,000 = $24,000, or $60 a share, and their holding period now includes the time you held the shares you sold. The $4,000 surfaces again when the replacement shares are sold. If they later go for $55 each, the 400 shares bring 400 × 55 = $22,000, and against the adjusted $24,000 basis that is a $2,000 loss rather than the $2,000 gain the original $20,000 cost would have shown. Across both sales, 6,000 + 4,000 = $10,000 of loss is eventually recognized: the full amount, a year or more late.
Frequently asked questions.
How long do I have to wait before buying the shares back?
Does buying in my IRA or my spouse's account trigger a wash sale?
Are two index funds that track the same index substantially identical?
Can automatic dividend reinvestment cause a wash sale?
What if I buy back more shares than I sold?
Does the calculator agree with the IRS's own example?
What happens when the sale is in December and the purchase in January?
Will my broker catch wash sales for me?
Do options and short sales fall under the rule?
Can a deferred wash-sale loss ever be lost for good?
References& sources.
- [1]IRS Publication 550, Investment Income and Expenses; capital losses, wash sales and investment income. Retrieved 2026-08-07.
- [2]U.S. Internal Revenue Service. About Form 8949, Sales and Other Dispositions of Capital Assets. Retrieved 2026-08-07.
- [3]U.S. Internal Revenue Service. Publication 551, Basis of Assets. Retrieved 2026-08-07.
- [4]U.S. Internal Revenue Service. Topic no. 409, Capital gains and losses. Retrieved 2026-08-07.
- [5]U.S. Internal Revenue Service. Instructions for Schedule D (Form 1040) — includes the Capital Loss Carryover Worksheet. Retrieved 2026-08-07.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- Primary sources
- 5 cited below
- Method
- disallowed loss = realized loss × min(replacement shares ÷ loss shares sold, 1); disallowed amount is added to replacement basis
- Published
- Last verified
Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 1560 calculators remain free
- No billing is enabled