A wash sale occurs when an investor sells a stock or security at a loss and repurchases the same or a substantially identical asset within 30 days before or after the transaction date. Under IRS regulations, the loss cannot be deducted on that year's tax return; instead, the disallowed loss is added to the cost basis of the newly acquired shares in taxable accounts.
That's exactly what is a wash sale in practice — a rule every long-term investor tracking cost basis should understand.
A wash sale occurs when an investor sells a stock or security at a loss and buys the same or a substantially identical asset within 30 days before or after the sale.
Selling losing positions to reduce your taxable income is a common tax strategy. However, if you buy back the same stock too quickly, tax authorities disallow that deduction. This guide explains how the wash sale rule works, how disallowed losses affect your cost basis, and how long-term investors can avoid triggering accidental tax traps.
Quick Takeaways
01The wash sale rule prevents investors from claiming an immediate tax deduction if they re-buy a stock within 30 days of selling it at a loss.
02The full wash sale period spans 61 calendar days: 30 days before the sale, the sale date itself, and 30 days after the sale.
03When a loss is disallowed in a taxable account, the tax benefit is added to the cost basis of the new shares rather than lost completely.
04Buying replacement shares inside an IRA destroys the tax write-off permanently because tax-advantaged accounts do not track cost basis.
05Turning off automated dividend reinvestment plans during tax-loss harvesting prevents accidental wash sales.
What Is a Stock Wash Sale?
A stock wash sale is a transaction where you sell a security at a loss and purchase a substantially identical security within a specific 61-day timeframe.
Tax regulations include the wash sale rule to prevent investors from creating artificial losses for tax benefits while maintaining their position in the market. If you sell 100 shares of a stock at a $1,000 loss on Monday and buy 100 shares of that same stock back on Tuesday, your portfolio has not meaningfully changed. Because your market position remains the same, tax authorities do not allow you to claim that $1,000 loss on your tax return for that year.
Understanding what is a stock wash sale is essential when managing a portfolio. If you sell an asset for less than you paid, that capital loss normally offsets capital gains from other investments. If your losses exceed your gains, the IRS allows you to use up to $3,000 of capital losses each year to offset ordinary income on your US tax return, as outlined in IRS Publication 550. However, triggering what is a wash sale in stocks delays that tax benefit until you permanently exit the position.
The 61-Day Wash Sale Window
The wash sale window is a 61-day calendar period. It includes the 30 days before the sale, the day of the sale itself, and the 30 days after the sale.
Timeline illustrating the 61-day wash sale window, covering 30 days before and 30 days after the stock sale date.
Many investors focus only on the 30 days after a sale, but purchases made in the 30 days before selling at a loss also trigger the rule. For example, if you buy 50 shares of a stock on October 1, sell your original 50 shares of that same stock at a loss on October 15, and make no other trades, the October 1 purchase creates a wash sale.
The rule counts calendar days, not trading days. Official rules defining identical assets are published by the IRS in Publication 550.
To violate the rule, the replacement security must be "substantially identical."
Substantially Identical: Buying the same stock, buying stock options for that stock, or selling a stock at a loss and buying it back in a different brokerage account.
Not Substantially Identical: Selling an individual stock (such as Apple) and buying a broad market ETF (such as an S&P 500 fund), or selling an S&P 500 ETF and buying a Total Stock Market ETF.
What Is a Wash Sale Loss Disallowed?
A disallowed wash sale loss means you cannot deduct the capital loss on your current tax return when you trigger the rule.
When your tax statement shows a wash sale loss disallowed, the tax deduction does not vanish forever in a taxable account. Instead, the disallowed loss is added to the cost basis of the new replacement shares.
Adjusted Cost Basis = Purchase Price of New Shares + Disallowed Loss
Consider this step-by-step example:
Initial Purchase: You buy 100 shares of Stock A at $50 per share ($5,000 total).
Sale at a Loss: The stock price falls to $30 per share. You sell all 100 shares for $3,000, realizing a $2,000 loss.
Repurchase: 10 days later, you buy 100 shares of Stock A back at $32 per share ($3,200 total).
Because you bought replacement shares within the 30-day window, your $2,000 loss is disallowed on your current tax return. Instead, that $2,000 loss is added to the cost basis of your new shares:
New Cost Basis = $3,200 + $2,000 = $5,200 (or $52 per share)
When you eventually sell those replacement shares in the future without triggering another wash sale, that higher cost basis will reduce your future taxable gain or increase your future deductible loss.
Over a 10-year holding period, delaying a tax deduction reduces your immediate tax savings. Paying higher taxes today means you have less capital left in your taxable account to compound over time.
The Hidden Traps: IRAs and Automated Reinvestment
Wash sale rules apply across all your brokerage accounts combined, which creates severe traps in retirement accounts and automated trading settings.
Diagram illustrating how buying replacement shares in an IRA permanently destroys a tax loss deduction.
The Permanent IRA Loss Trap
If you sell a stock at a loss in a taxable brokerage account and purchase replacement shares inside a Roth IRA or Traditional IRA within 30 days, the tax loss is disallowed.
However, unlike in a taxable account, you cannot add the disallowed loss to the cost basis of the IRA shares because retirement accounts do not track cost basis for tax deductions. As a result, the tax deduction is permanently destroyed. This same trap applies if you move capital from a 401(k) rollover to an IRA and buy replacement shares shortly after selling positions for a loss in your taxable account.
Automated Dividend Reinvestment (DRIP)
Dividend Reinvestment Plans (DRIP) automatically buy shares when a company pays a dividend. If a dividend reinvests into a stock within 30 days before or after you sell shares of that same stock at a loss, it triggers a wash sale on the number of shares bought by the dividend.
Even a small automatic dividend reinvestment of $15 can disallow the tax loss on those reinvested shares, complicating your tax reporting for the year.
How Long-Term Investors Avoid Accidental Wash Sales
Avoiding accidental wash sales requires simple coordination across your accounts and automated features.
Observe the 31-Day Rule: Wait at least 31 full calendar days after selling a security at a loss before buying the exact same asset back.
Turn Off Automatic Reinvestment: Disable DRIP and recurring dollar-cost averaging buys for any stock or ETF you plan to sell for tax-loss harvesting.
Use Non-Identical Funds: If you sell a broad market index fund to capture a tax loss, buy a fund tracking a different benchmark during the 30-day waiting period to stay invested in the market.
Coordinate Across Accounts: Tax rules treat you and your spouse as a single entity for wash sales. Buying replacement shares in a spouse's account or a company retirement account still triggers the rule.
Conclusion
Understanding what is a wash sale ensures you do not accidentally forfeit valuable tax write-offs while managing your portfolio. A wash sale occurs when you buy replacement shares within 30 days before or after selling a security at a loss. While taxable accounts allow you to push the loss forward into the new shares' cost basis, triggering the rule inside a retirement account forfeits the tax write-off permanently. By tracking the 61-day window and turning off automated reinvestment during sales, long-term investors can protect their tax deductions and keep their wealth compounding smoothly. When you are ready to evaluate trading platforms that track cost basis automatically, our Broker reviews & rankings provide a helpful starting point. Remember that tax regulations carry detailed conditions and market values fluctuate over time, so treat this guide as educational information rather than individualized legal or tax advice.
FAQ
4 questions
What is the wash-sale rule?
The wash-sale rule prevents investors from claiming a tax deduction on a security sold at a loss if they repurchase the same or a "substantially identical" asset within a specific timeframe.
How long is the wash-sale window?
The window spans a total of 61 days: 30 days before the sale, the day of the sale, and 30 days after the sale.
What happens to my tax deduction if a wash sale occurs?
You cannot claim the loss on your current tax return. Instead, the disallowed loss is added to the cost basis of the newly purchased security, which delays the tax benefit until you sell the new position.
Does the wash-sale rule apply across different accounts?
Yes. The IRS applies the rule across all accounts you or your spouse own, including taxable brokerage accounts and individual retirement accounts (IRAs).
Disclaimer
This guide was written with AI assistance and reviewed by the StockEmber editorial team for accuracy. StockEmber provides independent education, not personal financial advice. Some links may support our work at no additional cost to you.
The StockEmber Team is our in-house desk of independent research writers. We test brokerage platforms, read the fine print on fees and custody, and cover ETFs and long-horizon investing for people who plan to hold for decades — not days.