Guides
The Wash Sale Rule: How It Works and How to Avoid It
The wash sale rule disallows a capital loss when you sell a stock or security at a loss and buy the same or a substantially identical one within 30 days before or after the sale. The disallowed loss is not gone: it gets added to the cost basis of the replacement shares, so the deduction is deferred, not lost, unless the replacement sits in an IRA. The rule lives in Internal Revenue Code Section 1091.
What the wash sale rule is
The wash sale rule (IRC Section 1091) stops you from claiming a tax loss when you sell a security at a loss and reacquire the same or a substantially identical security inside a 61-day window. The IRS blocks the deduction for the year, then shifts the loss into the basis of the shares you bought. It applies to stocks, bonds, mutual funds, ETFs, and options.
The point of the rule is to prevent an artificial loss. Without it, an investor could sell a losing position on December 31, book the loss, and buy back the same stock on January 2 while holding essentially the same economic position. Section 1091 removes that move by treating the pair of trades as a wash.
The rule triggers automatically. It does not require intent, and your broker flags it on Form 1099-B whether or not you meant to repurchase.
The 30-day window (a 61-day period)
The wash sale window runs 30 days before the sale and 30 days after it, plus the sale date itself, for a total of 61 calendar days. Buying a substantially identical security anywhere inside that span disallows the loss. To keep a loss deductible, wait until the 31st day after the sale to repurchase.
Two features of the window catch people:
- It looks backward, not just forward. A purchase made up to 30 days before you sell at a loss can trigger the rule, even though the repurchase came first. This commonly happens with recurring buys or a lot you forgot you added.
- It counts calendar days, not trading days. Weekends and holidays are included, so the 31-day safe repurchase date can land mid-week regardless of market closures.
Example timeline: you sell at a loss on March 10. The window opened February 8 (30 days prior) and closes April 9 (30 days after). The first safe day to rebuy the identical security is April 10.
Disallowed loss added to basis
When a wash sale disallows a loss, that loss is added to the cost basis of the replacement shares, and the holding period of the sold shares tacks onto the replacement. Nothing is permanently lost in a taxable account: you recover the deduction when you eventually sell the replacement, and the tacked holding period can help you reach long-term capital gain treatment.
Worked example:
| Step | Detail | Amount |
|---|---|---|
| Buy 100 shares of XYZ | Original purchase | $5,000 basis |
| Sell 100 shares at a loss | Triggers the loss | $3,500 proceeds |
| Realized loss | Normally deductible | $1,500 |
| Rebuy 100 shares within 30 days | New purchase price | $3,600 |
| Loss disallowed under Section 1091 | Added to new basis | $1,500 |
| Adjusted basis of replacement | $3,600 + $1,500 | $5,100 |
You cannot deduct the $1,500 this year. Instead, the replacement shares carry a $5,100 basis instead of $3,600, so a later sale produces a $1,500 larger loss (or $1,500 smaller gain). The holding period from the original lot also carries over, which can move a future gain into the long-term column.
If you rebuy fewer shares than you sold, only the proportional loss is disallowed. Sell 100 at a loss and rebuy 60, and 60% of the loss is deferred while 40% stays deductible now.
What counts as “substantially identical”
“Substantially identical” is the test that determines whether a repurchase triggers the rule, and the IRS has never published a bright-line definition. For common stock, the same issuer and same share class is clearly identical. Different companies, even competitors in one sector, generally are not. The gray area sits between those poles.
Practical guideposts drawn from IRS guidance and long practice:
- Identical: the same company’s common stock (Apple common vs. Apple common); a stock and an option or contract to buy that same stock.
- Generally not identical: two different companies (Coca-Cola vs. PepsiCo); common stock vs. that company’s preferred stock in many cases; bonds with materially different terms.
- The common workaround: selling a broad index fund and buying a different fund that tracks a similar but not identical index. Because a diversified fund holds many securities, it usually is not substantially identical to a single stock or to a fund tracking a different index. This lets investors stay invested in the market while harvesting the loss.
Because the standard is judgment-based, aggressive fund-swapping that tracks the exact same index carries some risk. When the position is material, professional review is worth it.
The IRA trap
Buying the substantially identical security in your IRA or Roth IRA within the window triggers a wash sale, and here the disallowed loss is permanently forfeited, not deferred. Revenue Ruling 2008-5 confirms that a taxable-account loss is disallowed when the replacement is bought in your IRA, and the IRA’s basis is not increased. There is nowhere for the loss to go.
This is the harshest outcome the rule produces. In a normal taxable-to-taxable wash sale, the loss rides along in the replacement basis and you get it back later. An IRA cannot carry a taxable-account basis adjustment, so the deduction disappears for good.
The trap is easy to spring by accident: a taxable account and a retirement account are treated together for this test. Automatic contributions, target-date fund purchases, or a robo-advisor buying the same fund across accounts can all reach into the window. Coordinate loss sales against every account you and your spouse hold, including retirement accounts.
Other ways a wash sale gets triggered
Several situations pull in trades you might not expect, because Section 1091 looks at your economic position across related accounts.
| Trigger | How it happens |
|---|---|
| Spouse’s account | A loss sale by one spouse plus a repurchase by the other inside the window is treated as one wash sale. |
| IRA or Roth IRA | Replacement bought in a retirement account disallows the loss permanently (Rev. Rul. 2008-5). |
| Dividend reinvestment (DRIP) | Automatic reinvestment that buys the same security within 30 days can trigger a partial wash sale. |
| Options and contracts | Buying a call option or a contract to acquire the substantially identical stock counts as a repurchase. |
| Controlled entity | A purchase by a business or trust you control can be attributed to you in some cases. |
How to report a wash sale
Report a wash sale on Form 8949 by entering code “W” in column (f) and the disallowed loss as a positive number in column (g). Your broker reports the disallowed amount in Box 1g of Form 1099-B when the sale and repurchase happen in the same account at that broker. The adjustment reduces the deductible loss that flows to Schedule D.
One caution: brokers only track wash sales within a single account at their firm. They do not see repurchases at another brokerage, in your spouse’s account, or in your IRA. You are responsible for identifying cross-account wash sales the 1099-B misses and adjusting your Form 8949 accordingly. See our guide to Form 8949 and its box classifications for the mechanics of entering the adjustment, and our explainer on how cost basis works to track the adjusted basis on your replacement shares.
Crypto and the wash sale rule
As of 2026, the wash sale rule does not apply to cryptocurrency under federal law. Section 1091 covers “stock or securities,” and the IRS treats convertible virtual currency as property, not a security. So selling a coin at a loss and rebuying it minutes later generally preserves the loss, a technique unavailable to stock investors.
This gap is a live policy target. Multiple legislative proposals have sought to extend Section 1091 to digital assets, and the status could change. Crypto investors relying on the current treatment should watch for enacted law changes and keep records supporting each loss. For the broader picture on digital asset reporting, see our crypto tax accounting guide.
Note the distinction: the property classification helps on wash sales but drives other consequences, such as ordinary income on mining and staking receipts and capital gain reporting on every disposal.
How to avoid a wash sale
You can harvest a loss and stay near your target allocation without tripping Section 1091. The methods below keep the deduction intact.
- Wait 31 days. Sell at a loss, stay out of the identical security for 31 full calendar days, then repurchase. The cleanest and most certain approach.
- Buy a not-identical substitute. Replace a single stock with a sector or index fund, or swap one index fund for another tracking a different index, to hold similar exposure without a substantially identical position.
- Double up, then sell the old lot. Buy the replacement first, wait more than 30 days, then sell the original losing lot. This avoids repurchasing after the loss, but requires capital and market-timing tolerance.
- Check every account. Pause automatic buys, DRIPs, and robo-advisor purchases of the same security across your taxable, IRA, and spouse’s accounts during the window.
- Never repurchase in an IRA. Because the IRA loss is forfeited, keep retirement accounts out of any loss-harvesting sequence.
Frequently asked questions
Does the wash sale rule apply to gains?
No. Section 1091 only disallows losses. Selling a security at a gain and rebuying it immediately has no wash sale consequence, though you still owe capital gains tax on the gain. The rule exists solely to stop investors from claiming a loss deduction while keeping the same economic position.
How long do I have to wait to rebuy a stock I sold at a loss?
Wait at least 31 calendar days after the sale date before repurchasing the same or a substantially identical security. The disallowance window runs 30 days after the sale, so the first safe day is the 31st day. The window also covers the 30 days before the sale, so avoid buying in that period too.
Is the disallowed loss lost forever?
Usually no. In a taxable account, the disallowed loss is added to the cost basis of your replacement shares, so you recover it when you sell those shares later. The exception is a replacement bought in an IRA or Roth IRA: under Revenue Ruling 2008-5, that loss is permanently forfeited because an IRA cannot take a basis adjustment.
Does the wash sale rule apply to cryptocurrency?
As of 2026, no. The IRS treats crypto as property rather than a security, and Section 1091 applies only to stock or securities. Selling a coin at a loss and rebuying it right away generally keeps the loss deductible. Proposed legislation could extend the rule to digital assets, so this treatment may change.
Can I trigger a wash sale in my spouse’s account?
Yes. The IRS treats a loss sale by one spouse and a repurchase of the substantially identical security by the other spouse within the window as a single wash sale. The same attribution can reach a business or trust you control. Coordinate loss sales across every account in the household.
Are two different index funds substantially identical?
Often not, if they track different indexes. Two funds tracking distinct benchmarks (for example, an S&P 500 fund and a total-market fund) are generally not substantially identical, which is why fund-swapping is a common loss-harvesting tactic. Two funds tracking the exact same index are riskier, and the IRS has not published a bright-line rule.
How do I report a wash sale on my tax return?
Enter code “W” in column (f) of Form 8949 and the disallowed loss as a positive number in column (g). The adjustment flows to Schedule D and reduces your deductible loss. Your broker reports same-account wash sales in Box 1g of Form 1099-B, but you must catch cross-account and IRA wash sales yourself.
Reviewed by The Ledgerism Editorial Team. Last reviewed: July 2026.