Wash Sale Calculator

Sale and repurchase

Disallowed loss under the wash sale rule$1,500.00
Total loss on the sale$1,500.00
Loss allowed this year$0.00
Adjusted basis per replacement share$57.00
How this was calculated
  1. The wash sale rule (IRS section 1091) defers a loss when substantially identical shares are bought within 30 days before or after a losing sale - a 61-day window in total.
  2. The loss here is $55.00 - $40.00 = $15.00 per share on 100 shares, a total loss of $1,500.00.
  3. Because 100 replacement shares were bought inside the window, the loss on 100 shares is disallowed this year: 100 x $15.00 = $1,500.00, leaving $0.00 of the loss allowed.
  4. The disallowed loss is deferred, not destroyed: it is added to the cost basis of the replacement shares, lifting each from $42.00 to $57.00, and their holding period tacks on the original shares' period.

A wash sale rule calculator tells you how much of a stock loss you can actually deduct after you buy replacement shares. Under the wash sale rule (IRS section 1091), a loss is deferred when substantially identical shares are bought within 30 days before or after the sale, a 61-day window. Enter your sale price, cost basis, share count and replacement purchases, and the calculator returns the disallowed amount and the allowed amount. For example, selling 100 shares at $40.00 against a $55.00 basis loses $1,500.00, and replacing all 100 inside the window disallows the whole $1,500.00. The disallowed loss is added to the replacement shares' basis, lifting each from $42.00 to $57.00. Replacing only 50 of 200 shares disallows $400.00 of a $1,600.00 loss and leaves $1,200.00 allowed.

This method follows the standard wash sale computation: match replacement shares to the sold shares, disallow the loss in proportion to the shares replaced, and add the disallowed amount to the replacement shares' basis. It also reflects a point the rule never touches gains: selling at $60.00 against a $45.00 basis is a $750.00 gain, wash sale or not. This page shows the formula, step-by-step workings, worked examples and sources so you can check every figure yourself.

Worked examples

Full replacement inside the window

(100 · 40 USD · 55 USD · 100 · 42 USD)

Disallowed loss under the wash sale rule$1,500.00
Total loss on the sale$1,500.00
Loss allowed this year$0.00
Adjusted basis per replacement share$57.00

Partial replacement: 50 of 200 shares

(200 · 30 USD · 38 USD · 50 · 31 USD)

Disallowed loss under the wash sale rule$400.00
Total loss on the sale$1,600.00
Loss allowed this year$1,200.00
Adjusted basis per replacement share$39.00

A gain: the rule does not bite

(50 · 60 USD · 45 USD · 50 · 61 USD)

Disallowed loss under the wash sale rule$0.00
Gain on the sale$750.00
Loss allowed this year$0.00
Basis per replacement share$61.00

The 61-day window

The window is the part of the wash sale rule that catches people off guard, because it does not begin on the day you sell. Under IRS section 1091, a loss is deferred when substantially identical shares are bought within 30 days before or after the sale. Count the sale date itself and you get a 61-day window: the 30 days before, the day of the sale, and the 30 days after. A wash sale rule calculator applies that window to your trade dates, so a purchase you made weeks before selling can still disqualify the loss.

What happens inside that window is a deferral, not a permanent forfeiture. Suppose you sell 100 shares at $40.00 against a $55.00 basis, a loss of $1,500.00. If you replace all 100 shares inside the window, the whole $1,500.00 is disallowed. The disallowed loss is not lost forever; it is added to the replacement shares' basis, lifting each from $42.00 to $57.00. You recover the benefit when you eventually sell those replacement shares. Partial replacements are handled proportionally. Replacing only 50 of 200 shares disallows $400.00 of a $1,600.00 loss and leaves $1,200.00 allowed.

The other half of the test is what you bought. The rule applies to substantially identical securities, which generally means the same stock or security rather than something merely similar. A different company in the same industry is not the same security, and the brief's examples turn on replacing shares of the same holding. When you are unsure whether a purchase crosses the line, treat the question as one about identity rather than similarity of performance, and check the specific securities involved before relying on the result.

One boundary is worth remembering: the rule never touches gains. Selling at $60.00 against a $45.00 basis is a $750.00 gain, wash sale or not. Only losses are deferred, so a profitable sale followed by a quick repurchase does not create a disallowed amount. That asymmetry is why the calculator asks about losses specifically, and why a gain reported on the same page should not be reduced by anything the window produces.

Timing is the practical lever. Because the window reaches backward as well as forward, a purchase made in the month before a sale can matter as much as one made the next week. Gather your trade dates for the full 61-day span around each loss sale, note which purchases were substantially identical, and let the calculator match replacement shares to the loss before you file.

The 61-day window runs 30 days before the sale, the sale day itself, and 30 days after. A purchase on either side can defer the loss.

Full and partial replacement

The wash sale rule treats replacement as a matter of degree, not an all-or-nothing event. Whether the loss is fully or only partly disallowed depends on how many of the sold shares you replace inside the 61-day window — the 30 days before the sale plus the 30 days after. Working through both cases shows how a wash sale rule calculator splits a single loss into a deferred piece and an allowed piece.

Start with the full replacement case. You sell 100 shares at $40.00 against a $55.00 basis, which produces a loss of $1,500.00. If you buy back all 100 shares inside the window, the entire $1,500.00 is disallowed — none of the loss can be claimed on the current return. The disallowed amount does not vanish; it is added to the basis of the replacement shares, lifting each from $42.00 to $57.00. The loss is deferred into those shares and is realized later, when the replacement shares are sold.

Now the partial case. You sell 200 shares at a loss of $1,600.00 and replace only 50 of them inside the window. Here the rule disallows $400.00 — the portion of the loss tied to the replaced shares — and leaves $1,200.00 allowed. The remaining loss is claimed now, while the $400.00 is carried into the basis of the 50 replacement shares. The same logic scales in the full case: replace every share and the whole loss is deferred; replace some and only that share of the loss is deferred.

One boundary is worth stating plainly: the rule never touches gains. Selling at $60.00 against a $45.00 basis is a $750.00 gain, wash sale or not. Because section 1091 defers losses rather than adjusting gains, a profitable sale followed by a repurchase inside the window still produces a taxable gain with no deferral. Only the loss side of the ledger is affected.

The table below puts the two loss cases side by side so the split between disallowed and allowed amounts is easy to see. Note that the full case defers the entire $1,500.00, while the partial case defers $400.00 of a $1,600.00 loss and permits the other $1,200.00.

CaseShares soldSale price vs. basisTotal lossShares replacedLoss disallowedLoss allowedReplacement basis
Full replacement100$40.00 vs. $55.00$1,500.00100$1,500.00$0.00$42.00 to $57.00
Partial replacement200Loss of $1,600.00$1,600.0050$400.00$1,200.00Not stated
Replacement is counted share by share: replace all 100 shares and the full $1,500.00 loss is disallowed; replace only 50 of 200 and $400.00 of the $1,600.00 loss is disallowed, leaving $1,200.00 allowed.

Where the loss goes

A disallowed loss does not vanish. Under the wash sale rule, it is added to the basis of the replacement shares, which means the loss is deferred rather than erased. You will see it again when you sell those replacement shares. This is the part most people miss when they run the numbers through a wash sale rule calculator: the loss is still there, just attached to a different lot.

Take the straightforward case. You sell 100 shares at $40.00 against a $55.00 basis, which loses $1,500.00. If you replace all 100 shares inside the 61-day window, the whole $1,500.00 is disallowed. That $1,500.00 is spread across the replacement shares, lifting each one's basis from $42.00 to $57.00. The $15.00 per-share increase is the deferred loss riding along with the new lot. When you eventually sell those shares, the higher basis produces a smaller gain or a larger loss, and the $1,500.00 comes back into your tax picture at that point.

The holding period gets tacked on too. The replacement shares do not start a fresh holding period from the day you bought them. For purposes of the long-term versus short-term question, they inherit the holding period of the shares you sold. So if the original shares had been held for years, the replacement shares can qualify as long-term even though you bought them recently. Basis and holding period both travel with the deferred loss.

Partial replacement works the same way, just in proportion. If you sell 200 shares and replace only 50 of them inside the window, only part of the loss is disallowed. In the numbers here, $400.00 of a $1,600.00 loss is disallowed and $1,200.00 is allowed. The disallowed $400.00 is added to the basis of those 50 replacement shares. The other 150 shares you sold are not matched to a replacement purchase, so their share of the loss stands.

The rule only defers losses. It never touches gains. Sell at $60.00 against a $45.00 basis and you have a $750.00 gain, wash sale or not. Buying replacement shares around that sale does not shelter the gain, and no basis adjustment applies to it.

Remember the window itself: the wash sale rule under IRS section 1091 covers substantially identical shares bought within 30 days before or after the sale, a 61-day window in all. The dates matter as much as the prices, so check both sides of the sale before you conclude a loss is safe.

  • $42.00 basis per replacement share becomes $57.00 after the disallowed loss is added.
  • The replacement shares inherit the holding period of the shares sold.
  • Partial replacement disallows only the matched portion: $400.00 of a $1,600.00 loss, leaving $1,200.00 allowed.
  • Gains are unaffected: $60.00 sale against a $45.00 basis is a $750.00 gain either way.
A wash sale defers the loss, it does not destroy it. The disallowed amount moves into the replacement shares' basis and returns when you sell them.

Gains and other traps

Most people reach for a wash sale rule calculator because they are worried about a loss being disallowed. That focus is understandable, but it can hide an important asymmetry in the rule: it applies only to losses. A wash sale never touches a gain. If you sell shares at $60.00 against a $45.00 basis, you have a $750.00 gain, and that $750.00 is a gain whether or not you buy substantially identical shares inside the 61-day window. There is no deferral, no basis adjustment, and nothing for the calculator to disallow. The rule exists to stop taxpayers from claiming a tax loss while effectively staying in the same position, and a profitable sale does not create a loss to claim in the first place.

The loss side is where the arithmetic matters. Say you sell 100 shares at $40.00 against a $55.00 basis. That is a $1,500.00 loss. If you replace all 100 shares inside the window, the whole $1,500.00 is disallowed. The disallowed amount is not lost forever in a taxable account, though. It is added to the basis of the replacement shares, lifting each from $42.00 to $57.00. You have not erased the loss; you have postponed it until you sell the replacement shares. Partial replacements follow the same logic. Replacing only 50 of 200 shares disallows $400.00 of a $1,600.00 loss and leaves $1,200.00 allowed. A wash sale rule calculator is most useful for exactly this kind of split, where only part of the sale is matched to replacement shares.

The trap that deserves its own warning is the individual retirement account. When replacement shares are bought inside an IRA, the disallowed loss can vanish permanently rather than being deferred. The reason is structural: the basis adjustment that normally preserves the loss has to attach to the replacement shares, and inside an IRA there is no later taxable sale where that higher basis would reduce a taxable gain. The loss is disallowed for the year of the sale, and the benefit does not reappear when the IRA shares are eventually sold. In a taxable account, a disallowed loss is a timing issue. In an IRA, it can become a permanent one.

This is why the 61-day window needs to be checked across every account you control, not just the one where you sold. The rule looks at purchases of substantially identical shares within 30 days before or after the sale, and a purchase in a retirement account can match a sale in a taxable account. Before you sell at a loss and repurchase, map out the full window and every account that might buy the same or substantially identical security. The gain case needs no such care, but the loss case rewards patience: waiting out the window, or accepting a partial disallowance, is often cheaper than letting a loss disappear into an IRA.

Gains are never disallowed: a $750.00 gain stays a $750.00 gain, wash sale or not. But when replacement shares are bought inside an IRA, a disallowed loss can be lost permanently instead of deferred.

FAQs

What is the wash sale rule?

The wash sale rule is an IRS rule, found in section 1091, that defers a capital loss if you buy substantially identical shares within 30 days either side of the sale. In other words, selling at a loss and then repurchasing the same or nearly identical investment in that window does not let you claim the loss right away.

How much loss is disallowed if I replace everything?

If you replace all the shares you sold, all of the loss is disallowed. In the worked case on this page, 100 shares were replaced at once, and the full $1,500.00 loss was disallowed. The calculator applies the rule to the shares you actually repurchase, so replacing the entire position disallows the entire loss.

Is a disallowed loss lost forever?

Usually not. A disallowed loss is added to the cost basis of the replacement shares, so it is deferred rather than erased. In the worked case here, the basis rises from $42.00 to $57.00 per share. That higher basis reduces the gain, or increases the loss, when you later sell the replacement shares.

What if I replace only some shares?

If you replace only some shares, only that portion of the loss is disallowed. In the worked case, 50 of 200 shares were replaced, which disallowed $400.00 and left $1,200.00 of the loss allowed. The disallowed amount is tied to the replacement shares, and the rest of the loss can still be claimed.

Does the wash sale rule apply to gains?

No. The wash sale rule only defers losses, not gains. A $750.00 gain is taxed as usual even if you buy substantially identical shares within the 30-day window. The rule exists to prevent claiming a loss while keeping the same position, so it does not reach profitable sales.

What about buying in an IRA?

Buying replacement shares in an IRA is the harsh case. The IRS has ruled that the loss can be permanently disallowed, with no basis adjustment inside the IRA. Because the replacement shares sit in a tax-advantaged account, the deferred loss does not carry over to raise their basis, so it may never be recovered.

Sources

Related calculators

Capital Gains Tax Calculator
A simplified US federal estimate of the tax on a capital gain — the 0/15/20% long-term brackets stacked on your other income, short-term gains at your marginal rate, and the 3.8% NIIT where it applies.
Stock Average Price Calculator
The blended cost basis of up to three share purchases, with the gain or loss against that average at today's price.
Loan Amortization Calculator
Monthly payment for any fixed-rate loan, with total interest and the first payment's interest/principal split shown explicitly.