A wash sale happens when you sell a security at a loss and, within 30 days before or after that sale, buy the same or a substantially identical security. The IRS will not let you deduct that loss yet. In most cases the loss is added to the cost of the new shares, so it is postponed, not lost.
It is late in the year, one of your positions is down, and selling it would give you a loss to offset gains elsewhere. But you still like the company and plan to buy it back. The timing of that buyback decides whether the loss counts on this year's return. Here is how the rule works and how to plan around it.
What counts as a wash sale under IRS rules?
A wash sale is a loss sale paired with a replacement purchase inside a 61-day window: 30 days before the sale, the sale day, and 30 days after. According to IRS Publication 550, Investment Income and Expenses, you have a wash sale if, within 30 days before or after selling at a loss, you:
- buy substantially identical stock or securities,
- acquire them in a fully taxable trade,
- acquire a contract or option to buy them, or
- acquire substantially identical stock for your traditional or Roth IRA.
The rule also reaches your household. Publication 550 says that if you sell and your spouse, or a corporation you control, buys substantially identical stock, you still have a wash sale.
What happens to the disallowed loss?
In most cases the disallowed loss is added to the cost basis of the replacement shares, so you get the tax benefit later when you sell those shares. Your holding period for the new shares also includes the time you held the old ones, which can matter for short-term vs long-term capital gains rates.
A worked example
Say you bought 200 shares for $10,000 and sold them for $8,000, a $2,000 loss. Two weeks later you buy 200 shares of the same stock for $8,400.
| Step | Amount |
|---|---|
| Loss on the sale | $2,000 |
| Loss you can deduct this year | $0 |
| Cost of the replacement shares | $8,400 |
| Adjusted basis of the replacement shares ($8,400 + $2,000) | $10,400 |
If you later sell the new shares for $11,000, your taxable gain is $600, not $2,600. The loss came back, just later.
The IRA exception that makes the loss permanent
If the replacement shares are bought inside your IRA or Roth IRA, Publication 550 excludes that case from the basis adjustment. The loss is not added to anything, which in practice means you lose it. This is the most expensive version of the mistake, and it often happens by accident when an automatic IRA contribution buys the same fund you just sold in a taxable account.
What does "substantially identical" mean?
There is no simple checklist. The IRS says you must consider all the facts and circumstances. Publication 550 gives some guidance:
- Stock of one company is ordinarily not substantially identical to stock of a different company.
- Bonds or preferred stock of a company are ordinarily not substantially identical to its common stock, unless they are convertible and trade closely with it.
- Options to buy the same stock count as a replacement.
Funds are the grey area. Selling one S&P 500 index fund and buying another that tracks the same index from a different provider is a common practice, but the IRS has not published a bright-line ruling either way. If a large loss is at stake, ask a tax professional before you rely on a swap.
How do you avoid a wash sale?
You avoid a wash sale by keeping any purchase of the same or a substantially identical security outside the 61-day window around the loss sale. These are the practical ways people do it.
Wait 31 days before buying back
The simplest approach: sell, then wait at least 31 days before repurchasing. The risk is that the price moves while you are out of the position.
Buy a similar but not identical investment
Replace the position with something that gives you comparable exposure but is a different security, such as a different company in the same industry or a fund tracking a different index. You stay invested while the 31 days pass.
Check all your accounts, not just one
The rule applies across your taxable accounts, your IRAs and your spouse's purchases. Pause automatic investments and dividend reinvestment in the same security for the window, since a small reinvested dividend can trigger a partial wash sale.
Look back 30 days before you sell
Purchases made in the 30 days before the sale count too. If you bought more shares two weeks ago, selling the older lot at a loss can be partly disallowed.
How is a wash sale reported on your tax return?
Your broker may report it for you, but you are responsible either way. Publication 550 explains that box 1g of Form 1099-B shows the disallowed amount when the shares were covered securities with the same CUSIP number bought in the same account. Purchases at a different broker, in an IRA or by a spouse will not show up there, yet the IRS says you still cannot deduct the loss.
On Form 8949, you report the sale with code "W" and enter the disallowed loss as a positive adjustment. Losses that do count are subject to the normal limit: per IRS Topic 409 on capital gains and losses, net capital losses beyond your gains can offset up to $3,000 of other income a year ($1,500 if married filing separately), with the rest carried forward.
Frequently asked questions
How many days is the wash sale window?
It covers 30 days before and 30 days after the sale, plus the sale date, so 61 days in total. A purchase on day 31 after the sale is outside the window.
Does the wash sale rule apply to gains?
No. It only applies to sales at a loss. If you sell at a gain and buy the same stock back the next day, the gain is taxable as normal.
Does the wash sale rule apply in an IRA or 401(k)?
Trades entirely inside a tax-advantaged account do not produce deductible losses in the first place. The risk runs the other way: selling at a loss in a taxable account and buying the same security in an IRA within 30 days disallows the loss and, under Publication 550, it is not added to your basis.
Do wash sale rules apply to crypto?
Publication 550 describes the rule in terms of stock and securities, and it states the rule does not apply to commodity futures or foreign currency. How other assets are treated can change with new legislation, so confirm the current rule with a tax adviser before planning around it.
Related: Short-term vs long-term capital gains tax rates explained · What is a brokerage account? · Traditional IRA vs Roth IRA · What is tax-loss harvesting?
To apply this to your own numbers, use our free days between dates calculator, retirement calculator and days from today calculator and get an instant answer.