Audited 05 Aug 2026·Last updated 28 Oct 2026·5 citations·Tier 1·0 uses

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

Estimated wash-sale loss disallowed
4,000.00
Dollars of the loss you cannot deduct this year because of the replacement purchases: the loss times the share of the sale they match, at most the whole loss.
Replacement-share basis after disallowed loss
24,000.00
Loss not deferred by entered replacement shares
6,000.00

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.

  1. 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.
  2. In Shares sold at a loss, enter the number of shares in that sale. Fractional shares are accepted.
  3. 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.
  4. In Original basis of replacement shares, enter what you paid for those replacement shares, including commissions.
  5. 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.

disallowed loss = realized loss × min(replacement shares ÷ loss shares sold, 1); disallowed amount is added to replacement basis

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.

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.

replacement Shares400
shares Sold At Loss1,000
replacement Shares Cost Basis20,000
realized Loss10,000

Frequently asked questions.

How long do I have to wait before buying the shares back?
More than 30 days after the sale, so a purchase on day 31 or later falls outside the window. Purchases in the 30 days before the sale count too: buying a second lot and then selling the original lot at a loss within 30 days is a wash sale just as much as selling first and buying back. Investors who want to stay invested meanwhile often hold a similar but not substantially identical security for those 31 days.
Does buying in my IRA or my spouse's account trigger a wash sale?
Yes to both. Publication 550 lists buying substantially identical stock for your IRA or Roth IRA among the triggers, and a purchase by your spouse or a corporation you control counts as yours. The IRA case is the costly one: Publication 550 excludes it from the basis adjustment, so the disallowed loss is not added to anything and is effectively lost.
Are two index funds that track the same index substantially identical?
Publication 550 gives no bright-line test for funds. It says the question depends on all the facts and circumstances, that shares of different corporations are ordinarily not substantially identical, and that bonds or preferred stock are not ordinarily identical to the same company's common stock unless convertible into it on close terms. Funds tracking different indexes are generally viewed as safer replacements than two share classes or two providers of the same index, but that is judgement, not a rule.
Can automatic dividend reinvestment cause a wash sale?
Yes, because each reinvested dividend buys new shares. If you sell 1,000 shares at a $10,000 loss and a dividend buys 6 shares of the same fund within 30 days, 6 ÷ 1,000 of the loss is disallowed: $60, added to the reinvested shares' $300 cost for a $360 basis. The rest, $9,940, is deductible. Turning off reinvestment around a planned loss sale avoids the small partial wash sales.
What if I buy back more shares than I sold?
The whole loss is disallowed, but no more than that. Publication 550 matches an equal number of replacement shares with the shares sold, beginning with the first ones you bought, and only those carry the adjustment. Sell 1,000 shares at a $10,000 loss and buy 1,500 at $50, and the first 1,000 replacement shares take a $60,000 basis while the other 500 keep their $25,000 cost; the calculator reports the $85,000 total.
Does the calculator agree with the IRS's own example?
Yes. In Publication 550, 100 shares are sold at a $1,000 loss after 75 substantially identical shares were bought within the prior 30 days for $3,875 in two lots. The IRS disallows $750, allows $250, and raises the two lots' bases to $3,250 and $1,375. Entered here, the same facts give a $750 disallowed loss, $250 still deductible and a combined basis of $4,625, the sum of those two lots.
What happens when the sale is in December and the purchase in January?
The wash sale still applies, because the window runs 30 days on either side regardless of the year end. The loss is disallowed on the return for the year of the sale and the amount moves into the basis of the January shares, so the deduction you expected this year arrives only when those shares are sold. Publication 550's own example uses a December 27 sale and a January 10 purchase.
Will my broker catch wash sales for me?
Only some. Box 1g of Form 1099-B shows a disallowed wash-sale loss when the securities are covered securities and the replacement had the same CUSIP number and was bought in the same account. Purchases in another brokerage, your IRA or your spouse's account will not appear there, and Publication 550 is explicit that a wash-sale loss is not deductible even if the 1099-B does not report it.
Do options and short sales fall under the rule?
Yes. Acquiring a contract or option to buy substantially identical stock within the window is a trigger, and losses on options themselves are covered. Short sales are caught if you sell or short substantially identical stock within 30 days on either side of the date the short sale is complete. The rule does not apply to losses on commodity futures contracts or foreign currencies, nor to a dealer's losses in the ordinary course of business.
Can a deferred wash-sale loss ever be lost for good?
Yes, in two common situations. If the replacement was bought in an IRA, there is no basis adjustment, so the loss never returns. If you hold the replacement shares until death, their basis generally becomes their market value at that date, and the extra basis the deferred loss had added disappears with it. Otherwise the loss comes back when the replacement shares are sold in a transaction that is not itself a wash sale.

How this page was produced

Published by
Quanta Calculator
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.

Embed

Quanta Pro

Paid features are coming later.

  • All 1560 calculators remain free
  • No billing is enabled
Coming soon