What Is the Wash Sale Rule and How Do You Avoid It?
Direct answer
Wash sale rule at a glance
Under the US wash sale rule, you cannot deduct a loss on selling a stock or security if you buy the same or a substantially identical one within 30 days before or after the sale. The loss is not lost forever: it is added to the cost basis of the new shares, and their holding period carries over. The window is 61 days in total, and purchases in your IRA or by your spouse can also trigger it.
- Window: 30 days before to 30 days after the loss sale (61 days)
- Triggered by buying the same or a substantially identical security, including options to buy it
- The disallowed loss is added to the new shares' cost basis
- Buying in an IRA can trigger it, and that loss may be lost permanently
Tax-loss selling is one of the few free lunches in investing, and the wash sale rule is the fence around it. Most people who trip it do so by accident, often through automatic purchases.
What people on X are asking
In December 2025 a post warned about the "accidental" wash sale that happens when you sell an index fund at a loss while monthly automatic investments keep buying it. In April 2026 an options trader asked how a wash sale works when closing and opening a different strike. And crypto tax accounts keep noting that the rule does not currently apply to cryptocurrency, which matches the wording of the statute but is a point lawmakers have debated.
The fact-checked answer
The rule. Section 1091 of the Internal Revenue Code disallows a loss from selling stock or securities if, within 30 days before or after the sale, you acquire (or acquire a contract or option to acquire) substantially identical stock or securities. IRS Publication 550 explains how it is applied.
What happens to the loss. It is deferred, not destroyed: you add the disallowed loss to the cost basis of the replacement shares, and the holding period of the old shares is added to the new ones. When you eventually sell the replacement shares in a taxable account, the loss counts.
Worked examples of the wash sale rule
Illustrations by UXS based on IRS Publication 550 and 26 U.S.C. § 1091. "Substantially identical" for two funds tracking different indexes is not defined precisely; ask a tax professional. Tap a column header to sort.
| Sell 100 shares of Stock A at a $1,000 loss on Nov 10; buy 100 shares of A on Nov 25 | Yes | $1,000 loss disallowed; new basis = purchase price + $1,000 |
| Buy 100 A on Oct 20; sell 100 older A shares at a loss on Nov 10 | Yes | The purchase 21 days before the sale counts |
| Sell A at a loss; buy A on Dec 15 (35 days later) | No | Loss allowed |
| Sell an S&P 500 fund at a loss; dividends automatically reinvested 10 days later | Partly | Loss disallowed for the number of shares reinvested |
| Sell A at a loss in a taxable account; buy A in your IRA within 30 days | Yes | IRS Revenue Ruling 2008-5: the loss is disallowed and is not added to the IRA basis |
| Sell A at a loss; buy a call option on A within 30 days | Yes | An option to acquire counts |
| Sell A at a loss; buy Stock B, a competitor | No | Different company is not substantially identical |
Spouse and controlled accounts. Publication 550 says a purchase by your spouse, or by a corporation you control, can also trigger a wash sale.
Crypto. The statute covers "stock or securities". The IRS treats digital assets as property, and as of November 2026 the wash sale rule as written does not cover them. Proposals to extend it have appeared in Congress, so check the current year's rules. Our crypto tax page covers the basics.
UXS decision diagram
Will this purchase create a wash sale?
Text version of the diagram
- Did you sell at a loss in a taxable account? If no: No wash sale: the rule only applies to losses
- Did you (or your spouse or IRA) buy the same or substantially identical security within 30 days before or after? If no: No wash sale: the loss should be allowed
- Was it an automatic purchase such as dividend reinvestment or a recurring buy? If yes: Wash sale for those shares: pause automatic buys around loss sales
- Was the purchase in an IRA or 401(k)? If yes: Wash sale, and the loss may be lost permanently
- Otherwise: Wash sale: add the disallowed loss to the new shares' basis and carry over the holding period
Diagram drawn by UXS. A simplified decision aid for education, not a recommendation.
Holding period also changes the tax rate; see how long to hold a stock for long-term capital gains.
Which lot you sell also matters for losses; see FIFO vs specific lot identification for how the lot choice changes your tax.
Decision helper
| Goal | Option | Watch out for |
|---|---|---|
| Harvest a loss and stay invested | Buy a similar but not identical fund or stock | Make sure it is genuinely different |
| Harvest a loss, same holding | Wait 31 days to rebuy | Market can move in the meantime |
| Keep it simple | Sell and do not rebuy | Lose exposure |
| Using options | Avoid buying calls or selling puts on the same stock within the window | Options rules are complex |
Checklist before selling at a loss
- List every account that could buy the same security: taxable, IRA, spouse's accounts.
- Pause dividend reinvestment and recurring buys for 31 days.
- Check purchases in the 30 days before the sale too.
- Pick a replacement that is not substantially identical, if you want to stay invested.
- Keep records; broker 1099-B forms track wash sales only within the same account.
- Ask a tax professional for options and fund-switch cases.
Common mistakes
- Forgetting the 30 days before the sale.
- Assuming brokers catch wash sales across different accounts or brokers. They usually report only within one account.
- Buying back in an IRA, which can make the loss permanent.
- Assuming the rule covers crypto, or assuming it never will.
- Tax-loss selling in December and buying back on January 2 (within 30 days).
FAQ
What is the 30-day wash sale rule?
If you sell a security at a loss and buy the same or a substantially identical one within 30 days before or after, you cannot deduct the loss now.
Is the loss gone forever?
Usually not. It is added to the cost basis of the new shares. The exception is when the replacement is bought in an IRA.
Does the wash sale rule apply to gains?
No. It applies only to losses.
Does it apply to crypto?
Under the statute as written, which covers stock and securities, digital assets are not included as of November 2026. Check for changes in the law.
Does selling one ETF and buying another trigger it?
Not if they are not substantially identical. Two funds tracking the same index from different providers are a grey area.
How long must I wait to rebuy?
At least 31 days after the sale to be outside the window, and you must not have bought in the 30 days before.
Sources
- IRS: Publication 550, Investment income and expenses (wash sales)
- IRS: Topic no. 409, Capital gains and losses
- Cornell LII: 26 U.S. Code § 1091, Loss from wash sales of stock or securities
- IRS: Digital assets
Facts checked November 10, 2026. X posts are cited as evidence of the question, not of the answer.