The Wash Sale Rule: How the 30-Day Window Can Quietly Cancel Your Tax Loss Harvesting

The Wash Sale Rule: How the 30-Day Window Can Quietly Cancel Your Tax Loss Harvesting

The Wash Sale Rule: How the 30-Day Window Can Quietly Cancel Your Tax Loss Harvesting

The short answer

The wash sale rule disallows a capital loss when you buy substantially identical stock or securities within 30 days before or after the sale. The disallowed loss is usually added to the replacement shares' basis, which defers the loss rather than destroying it. The dangerous exception is your IRA: buy the replacement there and the loss is gone for good.

EA, Co-Founder

The wash sale rule disallows a capital loss when you buy substantially identical stock or securities within 30 days before or after the sale. The disallowed loss is usually added to the replacement shares' basis, which defers the loss rather than destroying it. The dangerous exception is your IRA: buy the replacement there and the loss is gone for good.

What is the wash sale rule?

Tax loss harvesting works by selling a losing position to realize the loss, then using it to offset gains elsewhere. The wash sale rule in IRC 1091 exists to stop you from manufacturing that loss while keeping the same economic exposure. If you sell at a loss and acquire substantially identical stock or securities during the wash sale window, the loss is disallowed.

"Substantially identical" is the key phrase. The same company's stock obviously qualifies. So do options or contracts to buy that stock. Different companies' stocks ordinarily do not qualify, even in the same industry. Funds are harder: two different providers' S&P 500 funds hold nearly identical portfolios, and there is no IRS ruling on whether they are substantially identical, so practitioners treat that swap with care.

When does the 30-day window actually run?

It is really a 61-day window: 30 days before the sale, the day of the sale, and 30 days after the sale. The window runs in both directions, which surprises most people.

Illustrative example: you sell 100 shares of XYZ at a $5,000 loss on September 25. If you buy XYZ shares on September 10 (15 days before), the rule applies. If you buy them on October 20 (25 days after), the rule applies. If your first repurchase is on October 26 (31 days after) and you bought nothing in the 30 days before, the loss stands.

The before-and-after symmetry exists to stop the obvious workaround of buying first and selling second. The 30-days-before language has been in the statute all along.

What happens to the disallowed loss?

In an ordinary taxable account, the disallowed loss is added to the cost basis of the replacement shares. You do not lose the loss; you defer it. When you eventually sell the replacement shares (outside any wash sale window), the higher basis produces a smaller gain or a larger loss, and the economics catch up. Your holding period for the replacement shares also includes the time you held the shares you sold, which can turn a later gain or loss long-term sooner.

Illustrative example: you buy 100 shares at $50 ($5,000 basis), sell at $40 (a $1,000 loss), and rebuy at $40 within the window. The $1,000 disallowed loss is added to the replacement basis, making it $5,000. Sell those shares later at $60 and your gain is $1,000 instead of $2,000. The loss was deferred, not destroyed.

The basis adjustment only helps if the replacement shares are ones whose basis matters. Which brings us to the trap.

Why is buying the replacement in an IRA so dangerous?

Under Revenue Ruling 2008-5, if you sell stock at a loss in a taxable account and buy substantially identical stock in your traditional or Roth IRA during the window, the loss is disallowed and the IRA's basis is not increased. The loss vanishes permanently. There is no later sale that recovers it, because IRA distributions are taxed under IRA rules, not on the basis of individual holdings.

This is harsher than the ordinary wash sale outcome, and it is easy to trigger accidentally: the taxable account and the IRA sit at the same broker, the dividend reinvestment in the IRA counts as a purchase, and the rule does not care that you did not intend it. Turn off automatic dividend reinvestment on any security you plan to harvest a loss on, across every account you and your spouse own.

Who else can trigger the wash sale rule for you?

Your spouse. The IRS position (Publication 550) is that a purchase of substantially identical stock for your spouse during your window triggers the wash sale on your sale, just as your own purchase would. Section 1091's text does not mention spouses, but treat the IRS position as the rule, especially if you file jointly. (IRS Publication 550)

A corporation you control. If you sell at a loss and your controlled corporation buys the same stock during the window, the loss is disallowed.

Your broker's reporting will not save you. Brokers report wash sales on Form 1099-B, but only for activity they can see: the same account, the same CUSIP, the same broker. They do not coordinate across your other brokers, your spouse's accounts, or your IRA. The compliance burden is yours. Report the transaction on Form 8949 with the wash sale adjustment so the return matches the economics, not just the 1099-B. (IRS, Form 8949 instructions)

How do you harvest losses without triggering it?

  • Wait out the window. Sell, wait 31 days, then repurchase. Simple and reliable, provided nothing was bought in the 30 days before the sale and no IRA, spouse or dividend-reinvestment purchase lands in the 30 days after. The cost is that you sit out of the position for a month.

  • Buy something similar but not substantially identical. Sell one company's stock and buy a competitor's, or sell an individual stock and buy a sector fund. You keep market exposure without tripping the rule. Index funds tracking different indexes from different providers are the common version of this trade.

  • Double up, then sell. Buy the replacement shares first, wait 31 days, then sell the original lot at a loss, using specific lot identification at your broker so the sale is matched to the original high-basis shares. This keeps you continuously invested, but it doubles your exposure in the interim.

  • Coordinate every account first. Before harvesting, check the taxable account, the IRA, the Roth IRA, the spouse's accounts, and dividend reinvestment settings. One forgotten DRIP purchase inside the window undoes the whole harvest.

Pending review by Brian Thomas, EA. Updated September 25, 2026.

This article is free educational content, not tax advice for your specific situation. If you want a plan built around your actual numbers, that is what our paid tax planning engagements do.

Frequently asked questions

Frequently asked questions

Does the wash sale rule apply to crypto?
IRC 1091 applies to 'stock or securities.' The IRS treats virtual currency as property (Notice 2014-21, as modified by Notice 2023-34) and has issued no guidance applying 1091 to digital assets, so most practitioners take the position that the wash sale rule does not reach cryptocurrency that is not a security. A token that is itself a security, such as tokenized stock, can still be covered. On September 16, 2026, the House Ways and Means Committee advanced H.R. 10357, the Digital Asset Tax Certainty Act, 38-5. It would extend the wash sale rule to traded digital assets other than qualified U.S. dollar stablecoins. As drafted, it would apply to dispositions after the bill's introduction date, which means crypto losses harvested now could be disallowed retroactively if it is enacted in that form. It has not been enacted, but plan for the risk.

Does it apply to mutual funds and ETFs?
Yes. Shares of mutual funds and ETFs are securities for this purpose. Selling one S&P 500 ETF at a loss and buying a different S&P 500 ETF the next day is the classic gray area: conservative practitioners wait or switch indexes.

What if the replacement purchase is smaller than the sale?
The disallowance is proportional. Sell 200 shares at a loss and rebuy 50 within the window, and the loss on 50 shares is disallowed (added to the replacement basis) while the loss on the other 150 stands.

Can a wash sale create a permanent loss outside an IRA?
Generally no, because of the basis adjustment. The IRA scenario is the main permanent-loss trap. Gifting the replacement shares or dying with them are edge cases where the deferred loss effectively disappears, which is why the IRA version deserves the most attention.

How do I report a wash sale?
Report the sale on Form 8949 with code W, showing the disallowed loss as a positive adjustment. Your return should reflect the wash sale even if the 1099-B did not flag it, because the broker only sees part of the picture.

About the author

EA, Co-Founder

Brian Thomas is a Co-Founder of Gambit and an Enrolled Agent, enrolled to practice before the Internal Revenue Service. He holds CTEC #A355130 and an MBA from UCLA. He serves on the NATP California board and specializes in tax strategy for high-income earners, business owners, and real estate investors.