Tax documents and a calculator illustrating the wash sale rule and tax-loss harvesting

The Wash Sale Rule, Explained: How a 61-Day Window Can Quietly Erase Your Tax-Loss Deduction in 2026

Sell a losing investment, claim the tax deduction, then buy it right back a week later — it sounds like the perfect move, and the wash sale rule exists specifically to stop it. Run afoul of it and the IRS quietly disallows the very loss you were counting on, sometimes for the entire tax year.

This is the rule that trips up a huge share of do-it-yourself investors during tax-loss harvesting on smaller portfolios, and it is built on a 61-day window that almost everyone counts wrong. Here is exactly what the wash sale rule says, how a violation is taxed, the IRA trap that can erase a loss permanently, and how to harvest losses cleanly in 2026.

This article is part of our Tax Strategy Guide — a comprehensive overview of the topic with related deep dives.

What the Wash Sale Rule Actually Says

The wash sale rule lives in Section 1091 of the Internal Revenue Code, and the IRS spells out the mechanics in Publication 550. The definition is narrow but strict: a wash sale happens when you sell a stock or security at a loss and, within 30 days before or after that sale, you buy the same or a “substantially identical” stock or security. When that happens, the loss is disallowed for the current year — you cannot use it to offset gains or income.

Notice what the rule does not do. It does not erase the trade, and it does not stop you from selling. It simply postpones the tax benefit. The disallowed loss is not gone; it gets folded into the cost basis of the replacement shares, which matters a great deal and is where the next section gets practical.

One more thing the statute makes clear: the rule keys on a loss. If you sell at a gain and rebuy immediately, the wash sale rule has nothing to say — there is no loss to disallow. It only ever bites when you are trying to capture a deduction.

The 61-Day Window Most People Get Wrong

Ask a casual investor how long they have to wait and most will say “30 days.” That is half the answer. The IRS window runs 30 days before the sale and 30 days after it — plus the day of the sale itself. That is a 61-day danger zone, not a 30-day one.

The “before” half is the part that surprises people. If you bought additional shares of a fund three weeks ago, then sell your original lot at a loss today, that earlier purchase can trigger a wash sale on the shares you just sold. Dividend reinvestment is the classic silent offender here: an automatic reinvestment that drops a few new shares into your account during the window counts as a purchase.

Action within the 61-day window Triggers a wash sale?
Rebuy the same ETF you just sold at a loss Yes
Automatic dividend reinvestment in that fund Yes
Spouse buys the identical security in their account Yes
Buy substantially identical shares inside your IRA Yes (and worse — see below)
Buy a different fund tracking a different index No
Wait 31+ days, then rebuy the same fund No

To be unambiguously safe, many investors treat the waiting period as 31 days after the sale before repurchasing the same security. That clears the back half of the window with a day to spare.

What Counts as “Substantially Identical”

The phrase “substantially identical” carries the whole rule, and the IRS has never published a bright-line list. Publication 550 gives the principle and leaves the edges fuzzy. A few things are clear, though. Buying back the exact same stock or the exact same fund is plainly identical. Selling an S&P 500 fund from one company and buying an S&P 500 fund from another that tracks the same index is widely treated as substantially identical, because you are holding economically the same basket.

Where it opens up: a total-market index fund and an S&P 500 fund track different indexes with different holdings, so they are generally not considered substantially identical, even though they move almost in lockstep. That distinction is the engine behind clean tax-loss harvesting, and it pairs naturally with a simple, low-overlap setup like the three-fund portfolio where swapping between distinct index funds is straightforward.

Bonds, preferred shares, and options of the same company can also be pulled in depending on their terms. When in doubt, the conservative read is the safe one — if two securities would behave identically in your portfolio, assume the IRS may see them as substantially identical.

How a Wash Sale Rule Violation Is Taxed

Here is the part that makes the wash sale rule survivable rather than catastrophic in a taxable account: the disallowed loss is not destroyed, it is deferred. The amount you could not deduct gets added to the cost basis of the replacement shares, and the holding period of the old shares carries over to the new ones. You eventually get the loss back when you finally sell the replacement shares in a non-wash transaction.

A simple example shows the mechanics:

Step Figure
Buy 100 shares $5,000 cost basis
Sell all 100 at a loss $3,800 proceeds = $1,200 loss
Rebuy 100 within 30 days $3,800 — wash sale triggered
$1,200 loss disallowed this year Added to new basis
New cost basis on replacement shares $3,800 + $1,200 = $5,000

Why bother avoiding a wash sale at all if the loss comes back later? Timing and the value of a deduction now. Capital losses first offset capital gains, and any leftover loss can offset up to $3,000 of ordinary income per year ($1,500 if married filing separately), with the remainder carrying forward indefinitely — that is straight from the IRS rules on capital gains and losses. A deduction you can use this April is worth more than one stranded in a higher cost basis you may not realize for years. That immediacy is exactly why harvesters care, and it ties into the broader question of whether harvesting is even worth the effort on a small portfolio.

The IRA Trap That Makes a Loss Disappear Forever

Everything above assumes the wash sale happens entirely inside a taxable account, where the disallowed loss at least survives as a basis adjustment. There is one scenario where the loss does not come back: selling at a loss in your taxable account and buying the substantially identical security inside your IRA within the window.

The IRS addressed this directly in Revenue Ruling 2008-5. When the replacement shares land in an IRA, the wash sale loss is disallowed — and because IRA shares do not carry an outside cost basis you can later adjust, there is no basis add-back. The deduction is gone permanently. This is the single most expensive wash sale mistake a DIY investor can make, and it is invisible to most brokerage wash-sale tracking, which only watches within a single taxable account.

The same logic extends to a Roth IRA. If you are coordinating accounts — say weighing tax-loss harvesting against a Roth conversion in the same season — keep the harvested security well away from anything you are buying in a retirement account during the window.

How to Harvest Losses Without Triggering the Wash Sale Rule

The good news is that avoiding a wash sale is mostly a matter of a few habits. Here is what disciplined harvesters actually do:

Swap into a similar-but-not-identical fund. Sell the S&P 500 fund at a loss and immediately buy a total-market fund, or a fund tracking a different large-cap index. You stay invested with nearly identical market exposure while sidestepping the “substantially identical” trap, then you can switch back after 31 days if you want the original holding.

Turn off automatic dividend reinvestment on the security you plan to harvest, at least for the window. A reinvestment of even a few dollars of dividends counts as a purchase and can taint part of your loss.

Coordinate across every account you and your spouse control, including IRAs and Roths. The rule looks across accounts and across spouses; your brokerage’s automated tracking generally does not.

Mind the back half of the window too. Do not rebuy the original security until at least 31 days after the sale, even if you have already replaced it with a substitute.

Done this way, harvesting becomes a low-risk routine rather than a tax-season landmine — and it stacks with other timing moves like harvesting gains in the 0% capital-gains bracket for investors in lower-income years.

I started harvesting losses in my own taxable index-fund account a few years back, mostly because as a software engineer I have a low tolerance for leaving free money on the table and a high tolerance for reading IRS publications I probably should not enjoy. The behavioral-economics side of me finds the rule fascinating: it punishes the instinct to “get right back in,” which is exactly the instinct most of us have. The first time I harvested, I nearly tripped the wash sale rule because I still had automatic reinvestment switched on in the fund I was selling — caught it by luck. No advisor flagged it for me; I run my own finances, and that near-miss is why I now check the dividend setting before every harvest. It is the kind of thing automation handles beautifully once you know the rule it is enforcing.

Key Takeaways

  • The wash sale rule (IRC §1091) disallows a loss if you buy the same or a substantially identical security within 30 days before or after the sale — a 61-day window, not 30.
  • In a taxable account the disallowed loss is deferred, not lost: it is added to the replacement shares’ cost basis and the holding period carries over.
  • Buying the replacement inside an IRA (Rev. Rul. 2008-5) makes the loss vanish permanently, with no basis add-back.
  • Automatic dividend reinvestment and a spouse’s purchases can both trigger a wash sale that your broker may not flag.
  • Harvest cleanly by swapping into a similar-but-not-identical fund and waiting 31 days before rebuying the original.

This article is for general educational purposes and is not tax advice. Rules and limits can change; consult IRS Publication 550 or a tax professional for your situation.

Photo by Kelly Sikkema on
Unsplash

Chris Steve

Written by Chris Steve

Chris Steve is a software engineer with a deep interest in personal finance, behavioral economics, and AI. He started Money & Planet to share clear, research-backed money guides — the kind that explain the math instead of pushing products. His writing focuses on long-term wealth building, the psychology behind spending and investing decisions, and the practical tools regular people can use to make smarter financial choices.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *