Indexes
IRC 1091 and IRS Publication 550

Wash sale calculator: disallowed loss, the 30 day rule window, and the IRA trap.

Enter the loss sale and the repurchase. This works out whether the trade falls inside the 61 day window, how much of the loss is disallowed once partial buys are matched share for share, what your replacement basis becomes, and the first date you can buy back cleanly.

2026 rates Partial matching Nothing leaves your browser

Most wash sale calculators give you the disallowed number and stop there. The number that matters is what happens next, because in a taxable account the loss is postponed and in a retirement account it is destroyed.

Wash sale calculator

The loss sale

The replacement purchase

What the loss is worth to you

Federal only. If you are choosing which lots to sell in the first place, run them through the cost basis calculator, and use the capital gains tax calculator for the gains the loss is meant to offset. Educational information, not tax advice.

In short

A wash sale happens when you sell stock or securities at a loss and acquire substantially identical stock within 30 days before or 30 days after that sale, a window 61 days wide with the sale date in the middle. The loss is disallowed for the year. In a taxable account that is a timing cost rather than a real one, because Publication 550 tells you to add the disallowed loss to the cost of the replacement shares and carry the old holding period across, so the deduction returns when you eventually sell them. There is one case where the money genuinely disappears: if the replacement shares are bought in your IRA or Roth IRA, no basis adjustment is available and the loss is forfeited permanently. Partial buybacks are matched share for share, so buying back 300 of 400 shares disallows three quarters of the loss and leaves the rest deductible now. The first clean day to repurchase is day 31 after the sale.

Last updated September 2026

// WINDOW

The 30 day rule

The window runs 30 days in both directions

The most common mistake is treating this as a forward-looking rule. Section 1091 disallows the loss where, "within a period beginning 30 days before the date of such sale or disposition and ending 30 days after such date," you acquired substantially identical stock or securities. A purchase you made three weeks before you decided to sell is caught just as firmly as one you make the following morning.

That matters more than it sounds, because the purchases people forget are almost always the ones that happened first. A dividend reinvestment that landed a fortnight ago, an automatic monthly contribution, a vesting event, a rebalancing trade your advisor ran: all of them are acquisitions, and all of them sit inside the 30 days before.

Day What it is Buying here
Day minus 31 and earlier Before the window opens Safe
Day minus 30 to day minus 1 The half everybody forgets Triggers a wash sale
Day 0 The sale itself Triggers a wash sale
Day 1 to day 30 The half everybody knows Triggers a wash sale
Day 31 The window has closed Safe

61 days in total, counting the sale date. Publication 550 lists four acquisitions that trigger the rule: 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.

// IDENTICAL

What counts

What actually counts as substantially identical

The IRS has never published a bright line, and Publication 550 says so directly: you must consider all the facts and circumstances of your case. It does give two anchors that decide most real situations. Ordinarily, stocks or securities of one corporation are not considered substantially identical to those of another corporation. And bonds or preferred stock of a corporation are not ordinarily considered substantially identical to its common stock.

Where it gets uncomfortable is funds. Two S&P 500 index funds from different issuers hold the same 500 companies in the same weights and differ only in fee and wrapper. The IRS has not ruled that these are substantially identical, and it has not ruled that they are not. That silence is why serious harvesting programs move to a fund tracking a genuinely different index rather than a cheaper clone of the same one, and why some advisers refuse the swap entirely.

Caught

The same ticker in any account you control, including a second brokerage, an IRA, a Roth IRA, or an account your spouse owns.

Caught

A call option on the stock you just sold. The rules reach contracts and options to acquire stock or securities, not only the shares themselves.

Caught

A dividend reinvestment that buys a few more shares while the window is open. Size is irrelevant, the matched shares are what count.

Ordinarily clear

A different company in the same industry. Publication 550 treats securities of one corporation as ordinarily not identical to another's.

Ordinarily clear

The bonds or preferred stock of a company whose common stock you sold, which the publication treats as ordinarily not identical.

Outside the rule

Commodity futures contracts and foreign currencies, which Publication 550 excludes from the wash sale rules by name.

// PERMANENT

Wash sale IRA

The one case where the loss is gone for good

A wash sale in a taxable account is an inconvenience. Publication 550 tells you to add the disallowed loss to the cost of the new shares, which "postpones the loss deduction until the disposition of the new stock or securities," and the holding period of the shares you sold carries across. You get the deduction later. Annoying, not expensive.

Now read the same sentence again with its parenthesis restored. You add the disallowed loss to the cost of the new stock "(except in (4) above)." Item (4) is acquiring substantially identical stock for your IRA or Roth IRA. So where the replacement shares were bought inside a retirement account, the loss is disallowed and there is no basis anywhere to add it to. Rev. Rul. 2008-5 is the ruling that settled this: the loss is denied and the taxpayer's basis in the IRA is not increased. The deduction is not postponed. It ceases to exist.

The reason this is worth a whole section is that almost nobody triggers it deliberately. It happens because a 401(k) or IRA is on an automatic monthly contribution into a target date fund or an S&P 500 fund, and the taxable harvest lands somewhere in that 61 day window. Nothing in the taxable brokerage account can see it, nothing on the 1099-B will mention it, and the loss quietly evaporates.

If you harvest losses regularly and you also contribute automatically to a retirement account, this is worth ten minutes with a calendar once. Line up your contribution dates against your harvest dates and check whether the funds overlap. Our page on the tax loss harvesting rules walks through the rest of the constraints that apply to the same trade.

// BLIND SPOT

Form 1099-B

Why your broker misses most wash sales

People assume that if a wash sale had happened, the 1099-B would say so. Publication 550 states the reporting condition precisely enough to show why that assumption fails. Box 1g shows a disallowed wash sale loss only where the securities sold were covered securities and where the replacement securities "had the same CUSIP numbers as the stock or securities you sold and were bought in the same account as the stock or securities you sold."

Same CUSIP, same account. Those two conditions define the whole of what a broker is able to report, and they exclude a large share of the wash sales real households actually create. Then comes the sentence that puts the obligation back on you: "However, you cannot deduct a loss from a wash sale even if it is not reported on Form 1099-B."

The situation Is it a wash sale Will box 1g show it
Same ticker, rebought in the same account Yes Yes
Same ticker, rebought at a different brokerage Yes No
Same ticker, bought in your IRA or Roth IRA Yes, and permanently No
Same ticker, bought by your spouse Yes No
A different fund tracking the same index Unsettled, facts and circumstances No, the CUSIP differs
A call option on the stock you sold Yes Usually not

Reporting one is mechanical once you have the number. Publication 550 asks you to report the transaction in Part I or Part II of Form 8949 with the appropriate box checked, enter code W in column (f), and enter the disallowed loss as a positive number in column (g). If the compensation element of restricted stock or an employee purchase plan is also involved, the basis your broker reported is understated for a second, unrelated reason, which is covered in our note on which brokers support HIFO cost basis.

// MATCHING

Partial buybacks

Buying back some of the shares disallows some of the loss

A wash sale is not all or nothing. Where the number of replacement shares differs from the number you sold, Publication 550 requires you to match the shares bought against an equal number of the shares sold, taking the shares bought in the order you bought them, beginning with the first. Only the matched shares carry a disallowed loss.

The publication's own example is worth having in front of you, because it shows both halves of the arithmetic. A taxpayer bought 100 shares of M stock for $5,000, then 50 more for $2,750 and 25 more for $1,125 within the following weeks, then sold the original 100 for $4,000, a $1,000 loss. Because 75 substantially identical shares had been bought inside the window, $750 of the loss is disallowed and $250 remains deductible. The $750 is then spread across the replacement lots in proportion, two thirds to the 50-share lot and one third to the 25-share lot.

Notice that the replacement purchases in that example came before the sale. This is the case the calculator above is built around, and it is the one people miss when they reconstruct a year of trading in April.

// DIGITAL ASSETS

Crypto wash sale rule

Where the rule stops at the edge of a crypto position

Section 1091 disallows losses on "stock or securities." The IRS treats virtual currency as property rather than as a security, so a direct holding of bitcoin or ether sits outside the section as written. Sell at a loss, rebuy the same afternoon, and the loss is currently allowed. Bills to extend the rule to digital assets have been introduced repeatedly and none has been enacted as of September 2026, so treat this as the current state rather than a settled one.

The distinction that catches people is the wrapper. A spot crypto exchange traded product is a security, and shares in a listed company whose business is crypto are securities, so both are fully inside the rule. If you hold your exposure through a fund rather than on-chain, you are back under section 1091 with everyone else. That difference is worth understanding before you decide how to hold the position, which is one of the questions our crypto index builder exists to answer.

// WHY IT IS HARD

Harvesting at scale

The wash sale rule is the reason harvesting is a product

Checking one trade against one window is a five minute job, and the calculator above does it. The difficulty scales badly. Hold an index directly rather than through a fund and you are not managing one position, you are managing several hundred, each with its own lots, its own loss, and its own 61 day window that has to be checked against every other purchase you or your spouse made in any account during those 61 days.

That is the whole reason automated harvesting exists as something people pay for rather than something they do in a spreadsheet. The value is not spotting the loss, which is easy. It is scanning every account continuously, choosing a replacement that keeps your exposure without being substantially identical, and never letting an automatic contribution land in the middle of a window. We compare what the platforms actually do on tax loss harvesting software, and set out how the mechanism works inside a directly held index on direct indexing and tax loss harvesting.

If you would rather run the index yourself, that is what this site is for. Build the weighted basket you want, hold the individual names rather than a fund, and you get the harvesting opportunities a single ticker can never give you, along with the obligation to watch the windows properly.

// FAQ

Wash sale rule questions

Questions people ask before they file

What is the 30 day rule for wash sales?

The rule runs 30 days in both directions, not just forward. Section 1091 disallows the loss if you acquire substantially identical stock within a period beginning 30 days before the sale and ending 30 days after it, so the danger zone is 61 days wide with the sale date in the middle. Buying before you sell counts exactly the same as buying after.

How do I calculate the disallowed loss on a wash sale?

Match the replacement shares against the shares you sold, oldest purchase first, and disallow the loss on the matched shares only. If you sold 400 shares at a $12,000 loss and bought 300 back inside the window, 300 of the 400 are matched, so $9,000 is disallowed and $3,000 stays deductible this year. The disallowed amount is then added to the cost of the replacement shares.

Does a wash sale mean you lose the loss forever?

Usually no. In a taxable account the disallowed loss is added to the basis of the replacement shares and your holding period carries over, so the deduction is postponed rather than destroyed. The exception is real and expensive: if the replacement shares are bought inside an IRA or Roth IRA, Publication 550 gives no basis adjustment, so that loss is gone permanently.

Do wash sales apply across different accounts?

Yes. The rule follows the taxpayer, not the account. A sale in your brokerage account and a purchase in a second brokerage account, your IRA, your Roth IRA, or an account your spouse owns can all combine into one wash sale. Publication 550 states plainly that if your spouse or a corporation you control buys substantially identical stock, you also have a wash sale.

Will my broker tell me if I had a wash sale?

Only sometimes. Publication 550 says box 1g of Form 1099-B is populated when the replacement security had the same CUSIP number and was bought in the same account. Anything else, a second brokerage, a retirement account, your spouse, or a different fund tracking the same index, falls outside what your broker can see, and the publication adds that you still cannot deduct the loss.

When can I buy back a stock after selling at a loss?

The first clean day is 31 days after the sale date. Waiting until day 31 puts the purchase outside the window that ends 30 days after the sale, so the loss stays deductible. If you want market exposure in the meantime, hold something that is not substantially identical, which ordinarily means a security of a different issuer.

Does the wash sale rule apply to crypto?

Not to a direct holding, at least for now. Section 1091 reaches "stock or securities" and the IRS treats virtual currency as property rather than a security, so selling bitcoin at a loss and rebuying it the same day does not trigger the rule. Crypto ETFs and listed crypto companies are securities and are fully inside it. Bills to extend the rule to digital assets have been introduced repeatedly and none has passed as of September 2026.

Is there a penalty for a wash sale?

There is no separate penalty and a wash sale is not a violation of anything. It is a timing rule: the deduction is denied this year and moved into the basis of the replacement shares. What does create exposure is failing to report it, since you are required to enter code W in column (f) of Form 8949 and the disallowed amount as a positive number in column (g) whether or not your 1099-B flagged it.

Harvest losses across a whole index, not one ticker at a time

Build the allocation you want as a weighted index and hold the individual names. Every position becomes its own loss opportunity, and every replacement decision becomes one you can make deliberately instead of discovering it on a 1099-B.

See how it works