Think of the wash sale rule as one of those small-but-important “acorns” in investing: easy to miss, but it can matter at tax time.
The wash sale rule is one of those IRS rules that can surprise brand-new investors: you sell an investment for a loss, you try to buy it back right away, and then you find out your tax loss deduction is not allowed (at least not yet). The goal of the rule is simple: it stops people from grabbing a tax break while still keeping basically the same investment.

What the wash sale rule is
A wash sale happens when you sell an investment at a loss and then you buy or otherwise acquire the same or a “substantially identical” investment too close to that sale.
If it’s a wash sale, the IRS says: you cannot claim that loss right now on your taxes.
Here is the timing to remember (this is the statutory idea in plain English):
- A wash sale can happen if you buy a substantially identical investment within 30 days before your loss sale, or within 30 days after your loss sale.
Many people describe that as a 61-day window (30 days before, the sale day, and 30 days after). Either way you say it, the key is this: it is not just “don’t buy it back for 30 days.” It is also “make sure you did not already buy it during the 30 days before you sold.”
Quick example: If you bought shares two weeks ago, then sell today at a loss, that earlier purchase can matter. The wash sale rule looks both backward and forward.
Why the IRS has this rule
Without the wash sale rule, someone could do this:
- Sell a stock at a loss on Monday to create a tax deduction.
- Buy it back on Tuesday to stay invested like nothing happened.
The wash sale rule is meant to prevent that kind of tax-loss “reset” while keeping the same position.
What happens to your disallowed loss
Here’s the part that helps you breathe easier: in many cases, the loss is not gone forever. It is added to the cost basis of the replacement shares you bought.
That means the tax benefit is typically delayed, not destroyed. You may get it later when you eventually sell the replacement shares (as long as you avoid creating another wash sale).
Example:
- You buy 10 shares for $1,000.
- You sell them for $800. That is a $200 loss.
- You buy back the same stock a week later.
If it triggers a wash sale, that $200 loss is disallowed right now and is usually added to the basis of the new shares.
One important real-world detail: Your brokerage may track wash sales in a taxable account, but many brokers only track what they can see inside that one account or that one brokerage. If you use multiple brokerages or multiple account types, you may need to keep an extra-close eye on this yourself.
The “substantially identical” trap
The rule does not only apply to buying the exact same ticker symbol in the same account. It also applies when you buy something the IRS considers substantially identical.
Clear cases include:
- Buying the same stock again.
- Buying a contract or option to purchase that same stock.
Fund situations can get murkier. Two funds can be very similar, but not necessarily “substantially identical,” and IRS guidance is limited.
A practical way to think about it: two ETFs that track the same index in the same way (especially from the same provider) are more likely to be argued as substantially identical than two broad-market funds that track different indexes. If it looks like the same investment wearing a different hat, treat it cautiously.

It can happen across accounts
Wash sales can be triggered by purchases in different accounts, including accounts you might not think about in the moment.
Common ways it happens:
- You sell a stock for a loss in a taxable brokerage account, then your IRA or Roth IRA buys the same stock within the window (including through automatic contributions or reinvestments).
- You sell in one taxable brokerage account, then buy in another taxable brokerage account.
Extra important: If the replacement shares are bought in an IRA or Roth IRA, the disallowed loss is generally not recoverable later the way it often is in a taxable account. This is one of the easiest ways to accidentally turn a “delayed” tax benefit into a loss you do not get back. If retirement accounts are involved, get tax help.
You may also see people mention spouse accounts. This area is fact-dependent and easy to misunderstand. If you file jointly and one spouse sells at a loss while the other spouse buys the same investment within the window, it can create a mess. If you are tax-loss harvesting and your household has multiple accounts, it is worth asking a tax pro how the wash sale rules apply to your situation.
Does it apply to gains?
No. The wash sale rule is about losses. If you sell at a gain, you can buy back immediately and you still owe taxes on the gain (if it was in a taxable account).
If you want the quick refresher on how selling stocks is taxed, hop over to Capital Gains Tax When You Sell a Stock.
How to avoid a wash sale
1) Wait until day 31 to buy back
The cleanest approach is to sell for a loss and wait until day 31 (after the sale date) to buy the same investment again. Also watch purchases in the 30 days before the sale.
2) Buy something similar, not identical
If you want to stay invested during the waiting period, investors sometimes swap into a different investment that serves a similar role in their portfolio but is not the same security.
For example, instead of selling an S&P 500 index fund and buying back the same fund immediately, someone might use a different broad-market fund temporarily. Because “substantially identical” can be a gray area with funds, be cautious and consider tax advice if you are unsure.
If you are still learning the difference between funds, What Is an ETF and How Does It Work? and Index Funds vs Mutual Funds can help.
3) Pause auto-investing and dividend reinvestment
Automatic buys can accidentally create a wash sale.
- If you are planning to sell at a loss, check whether dividend reinvestment (DRIP) is turned on for that holding.
- Check for scheduled recurring buys that might hit during the window.
Dividend reinvestment is a great long-term habit when it matches your plan. If you are building that foundation, Dividend Investing for Beginners is a friendly next step.
Wash sale rule FAQ
Is it 30 days or 31 days?
People say “30 days” because the rule looks 30 days after the sale date. To be safely outside the window for buying the same investment again, many investors wait until day 31 after the sale date.
What if I only buy back part?
Wash sale treatment can be partial. If you sell 100 shares at a loss but buy back 25 shares within the window, the wash sale can apply to the loss tied to those 25 replacement shares. The disallowed portion is generally added to the basis of those replacement shares.
Does it matter if I sell and buy on different days?
Yes. The timing is exactly what triggers the rule. Even if the buy and sell are in different accounts, the window still matters.
Does it matter if it is in a 401(k)?
The wash sale rule is generally discussed in the context of taxable accounts because that is where capital losses and gains are reported. But purchases inside retirement accounts can still create problems, especially if they interact with taxable sales. When retirement accounts are involved, it is smart to get professional tax guidance.
A quick checklist
- Look back 30 days: did you buy or reinvest into this investment recently in any account?
- Look forward 30 days: will you buy it automatically (recurring buys, DRIP, scheduled contributions, or automatic investing)?
- Decide your plan: wait 31 days, or choose a not-identical substitute if you want to stay invested.
- Keep records: your brokerage may track wash sales, but it might not catch activity across multiple brokers or account types.
If you want to zoom out and make sure your investing plan fits your comfort level, Find Your Risk Tolerance Before Buying Stocks is a good companion read.

Pocket is the squirrel drawn for Stocks For Beginners. Pocket isn't a financial adviser and doesn't pick stocks. The articles explain how accounts, funds, credit and taxes work so you can make your own decisions. More about Pocket
