Home › Tax-Loss Harvesting Calculator › The Wash Sale Rule, Explained
The Wash Sale Rule, Explained
Sell at a loss and buy the same security back within 30 days before or after, and the IRS disallows the loss. The window is 61 days, and your spouse and your IRA count.
Filed November 19, 2026 · figures checked against 2026 sources
The short answer
The wash-sale rule disallows a capital loss if you buy the same or a substantially identical security within 30 days before or after the sale. The window is 61 days in total: the sale day plus 30 days on each side. The disallowed loss is not destroyed in most cases. It is added to the cost basis of the replacement shares, and the holding period of the old shares carries over. But if the replacement shares sit in an IRA, the loss is disallowed permanently, and the basis adjustment has nowhere to go. The rule covers you, your spouse, and every account either of you controls, including retirement accounts.
This article states the rule, works the calendar, explains what substantially identical means in practice, and lists the purchases that trigger it when you least expect them.
Where the rule comes from
The rule is section 1091 of the tax code, and it is nearly a century old. Congress wrote it to stop the simplest tax maneuver in the book: sell a stock at a loss on Dec 30, claim the deduction, buy the same stock back on Jan 2, and keep the position while pocketing the tax saving. Without the rule, every investor with a losing position could manufacture a deduction at year-end and change nothing about their portfolio. The rule says the loss is real only if you actually give up the position for a meaningful stretch, and it defines that stretch as 30 days.
The rule applies to stocks and securities, which includes shares, bonds, and options on a security, but not to every asset. It does not apply to a sale of real estate, or to a sale of a business. It also does not apply, as the code is currently written, to digital assets such as Bitcoin: the tax code's wash-sale language covers stocks and securities, and the IRS has not issued guidance applying it to cryptocurrency. A bill in Congress, H.R. 10357, the Digital Asset Tax Certainty Act, would extend the rule to traded digital assets. It cleared the House Ways and Means Committee on Sep 16, 2026, but it was not law as of Oct 13, 2026. Anyone harvesting crypto losses should check its current status before assuming the old treatment still holds, because the rule for crypto is the most likely tax change in this area.
The loss is disallowed, not the sale. The sale itself stands: the proceeds are yours, the position is gone, and the gain or loss on the replacement shares is computed from their own purchase price, adjusted by the disallowed loss. The rule only touches the deduction, and only for the shares that were replaced. If you sell 100 shares at a loss and buy back 40 shares inside the window, the loss on 40 shares is disallowed and the loss on 60 shares stands. The rule is proportional, not all or nothing, unless the repurchase is the same size as the sale or larger.
The 61-day window, worked
The window runs 30 days before the sale and 30 days after it, and the sale day itself is day zero. A sale on Dec 31, 2026, is poisoned by any purchase of the same security between Dec 1, 2026 and Jan 30, 2027. The earliest safe rebuy is Jan 31, 2027, which is 31 days after the sale. A sale on Nov 19, 2026, is poisoned by purchases between Oct 20 and Dec 19, and the earliest safe rebuy is Dec 20, 2026. The backward half of the window is the part people forget: a purchase you already made, three weeks before you decided to harvest, can disallow a loss you have not yet realized.
| Sale date | Window opens | Window closes | Earliest safe rebuy |
|---|---|---|---|
| Nov 19, 2026 | Oct 20, 2026 | Dec 19, 2026 | Dec 20, 2026 |
| Dec 15, 2026 | Nov 15, 2026 | Jan 14, 2027 | Jan 15, 2027 |
| Dec 31, 2026 | Dec 1, 2026 | Jan 30, 2027 | Jan 31, 2027 |
Automatic purchases count. A dividend reinvestment that buys shares inside the window triggers the rule, and so does a monthly automatic investment, an employer stock purchase plan buy, and a 401(k) contribution that buys the same fund. The rule does not care why you bought. It cares that you bought. The most common year-end wash sale is not a deliberate rebuy. It is a dividend reinvestment on Dec 15 that nobody remembered, disallowing a loss on a sale made on Dec 20. Turn off dividend reinvestment on the security before you harvest, and check the automatic buys, because the IRS will not accept that you forgot.
The matching is by share count, and it works in order. If you buy 100 shares on Dec 10 and sell 100 shares at a loss on Dec 20, the whole loss is disallowed. If you buy 40 shares on Dec 10 and sell 100 shares on Dec 20, the loss on 40 shares is disallowed and the loss on 60 shares stands. If you buy 100 shares after the sale, the same matching applies. The brokerage reports wash sales on Form 1099-B, but only for the same account and the same security identifier. It does not see your spouse's account, your IRA, or a different brokerage, and the rule applies across all of them anyway. The 1099-B is a floor, not a ceiling, and the taxpayer is responsible for the rest.
Substantially identical, in practice
The rule covers the same security and any substantially identical security, and the IRS has never published a definition of substantially identical for stocks and funds that settles the question. What is settled is narrow. Selling shares of a company and buying the same company's shares is a wash sale. Selling a stock and buying a call option on the same stock is a wash sale. Selling a bond and buying the same bond is a wash sale. Beyond that, the guidance is thin, and practitioners work from the cases and rulings that exist.
Two funds that track the same index are the grey area that matters most to harvesters. Selling an S and P 500 index fund from one provider and buying an S and P 500 index fund from another provider is the standard harvest swap, and it is widely done on the theory that two funds from different issuers, with different expense ratios, different holdings in practice, and different legal structures, are not substantially identical. The IRS has never ruled on it directly, and the conservative view is that it is safe, because the two funds are different securities issued by different companies. The aggressive view is that it is risky, because the economic exposure is identical. The industry consensus, such as it is, is that different-issuer index funds tracking the same index are acceptable, and that the same fund in a different share class is not. Selling the investor shares of a fund and buying the ETF share class of the same fund is a wash sale, because it is the same fund. Selling a fund and buying a fund that tracks a different index is safe, because the exposure is genuinely different.
Options are a trap inside the trap. Buying a call option on a security you sold at a loss is a wash sale, because the option gives you the same exposure. Selling a put option can also trigger the rule in some circumstances. The safe approach is to avoid options on the sold security entirely during the window, and to treat any derivative that tracks the same underlying as off limits. The same caution applies to a spouse buying the same security, and to a company you control buying it: the rule reaches related parties, and the IRS has ruled that a spouse's purchase counts as yours.
The IRA trap, and why it is permanent
Revenue Ruling 2008-5 is the ruling every harvester should know. It says that if you sell a security at a loss in a taxable account and buy the same security in your IRA within 30 days, the wash-sale rule applies, and the loss is disallowed. The basis adjustment that normally saves the loss has nowhere to go, because an IRA has no cost basis for tax purposes: everything inside an IRA is taxed on withdrawal, not on sale. The loss is gone permanently, not deferred. The same logic applies to a Roth IRA, and the ruling's reasoning extends to a spouse's IRA as well.
The numbers make the trap concrete. Sell $10,000 of a stock at a $4,000 loss in your brokerage account, and buy the same stock in your IRA the next day, and the $4,000 loss is disallowed. At a 22 percent rate, that is $880 of tax saving destroyed, and there is no way to recover it, because the IRA shares carry no basis adjustment. The fix is simple: do not buy the same security in any retirement account during the window, and tell your spouse the same, because a spouse's IRA purchase counts under the related-party rule. Check the 401(k) too, if the plan offers the same fund, because an automatic contribution that buys the fund inside the window is a purchase for wash-sale purposes, even if you never touched it.
What happens to the disallowed loss
Outside an IRA, the disallowed loss is added to the cost basis of the replacement shares, and the holding period of the old shares is tacked onto the new shares. Sell 100 shares at a $4,000 loss, buy 100 shares back at $6,000 the next week, and the new shares have a cost basis of $10,000, not $6,000. When you sell the replacement shares, the $4,000 loss comes back, because the basis is higher by exactly that amount. The loss is deferred, not destroyed, and the deferral is the whole point of the rule: you cannot claim the loss while you still hold the same exposure, but you can claim it when you finally give the exposure up.
The deferral has a cost. The tax saving arrives later, and a later saving is worth less than a saving today, because money today can compound. The deferral also changes the character of the loss in some cases, because the holding period carries over, and a short-term loss can become a long-term loss if the combined holding period crosses a year. That is usually a bad trade, because a long-term loss is worth less than a short-term loss when it offsets a short-term gain. The wash sale is not a disaster outside an IRA, but it is a delay and a discount, and the harvest that triggers one has wasted the December window.
The safe harvest, in five steps
First, check the 30 days before the sale. Look at every account you and your spouse control, including retirement accounts, and list every purchase of the security in the last 30 days, including dividend reinvestments and automatic buys. Second, turn off dividend reinvestment and automatic purchases for that security, so nothing buys it while you wait. Third, sell, and record the trade date, because the trade date is what the IRS counts. Fourth, either wait 31 days before buying the same security back, or buy a different security the same day: a different company's stock, or a fund from a different issuer tracking a different index. Fifth, keep the records, because the brokerage will not report the cross-account wash sale, and the 1099-B will show a loss that the IRS expects you to disallow yourself.
The backward half of the window is where harvests actually die. Everyone remembers not to buy back for 30 days after the sale. Almost nobody checks the 30 days before it, and that is where the dividend reinvestment, the automatic monthly buy, and the spouse's IRA contribution live. On the defaults here, a $3,000 wash-sale disallowance costs $520: $300 of long-term gain stays taxable, and $220 of ordinary deduction disappears. Check the purchases you already made before you make the sale, because a buy from three weeks ago is already inside the window, and the loss it poisons is gone for the year.
Sources: Internal Revenue Code section 1091 (wash sale rule); IRS Publication 550, Investment Income and Expenses (wash sales, basis adjustment, 61-day window); IRS Revenue Ruling 2008-5 (IRA purchase triggers wash sale, loss permanently disallowed); IRS Topic 409, Capital Gains and Losses; H.R. 10357, Digital Asset Tax Certainty Act (wash-sale extension to digital assets; cleared House Ways and Means Sep 16, 2026, not law as of Oct 13, 2026). The scenario figures are this site’s Tax-Loss Harvesting Calculator unless stated otherwise.
The Wash Sale Rule, Explained questions
- What is the wash sale rule?
- If you sell a security at a loss and buy the same or a substantially identical security within 30 days before or after the sale, the IRS disallows the loss. The window is 61 days in total, and it covers your spouse and your IRA.
- How long do I have to wait to buy back a stock after a wash sale?
- Wait at least 31 days after the sale date. The window is 30 days after the sale, so a purchase on the 31st day is safe. A purchase in the 30 days before the sale also triggers the rule.
- Does the wash sale rule apply to my IRA?
- Yes, and it is worse there. Under Revenue Ruling 2008-5, buying the same security in an IRA within 30 days disallows the loss permanently, because the basis adjustment has nowhere to go inside a retirement account.
Keep reading
- How Tax-Loss Harvesting WorksLosses net against gains first, then $3,000 a year.
- Tax-Loss Harvesting Deadline 2026The trade date decides the year, not the settlement.
- Short-Term vs Long-Term Capital GainsOne year is the line, and the rates are far apart.
- Tax-Loss Harvesting Mistakes to AvoidFive ways a good harvest turns into a wasted sale.
- Tax-Loss Harvesting CalculatorEnter your losses and gains: the slip nets them, applies the wash-sale rule, and prices the saving.