The wash-sale rule is the single most important piece of tax law in tax-loss harvesting. Get it wrong and the IRS quietly disallows your loss — meaning you sold the position, paid the implicit cost of the trade, and got nothing in tax savings. The position is worse than not harvesting at all.
Get it right and the rule becomes a manageable scheduling problem. Software handles it for you. But you should still understand what's actually happening.
What the rule says, in one paragraph
From IRC §1091(a):
"In the case of any loss claimed to have been sustained from any sale or other disposition of stock or securities, no deduction shall be allowed... where it appears that, within a period beginning 30 days before the date of such sale or disposition and ending 30 days after such date, the taxpayer has acquired... substantially identical stock or securities."
Three parts to break down:
- The window is 61 days. 30 days before, the day of the sale, 30 days after. If you bought "substantially identical" shares anywhere in that window, your loss is disallowed.
- "Substantially identical" is a phrase, not a definition. The IRS has never published a bright-line list. SPY and VOO almost certainly are. SPY and IVV almost certainly are. SPY and VTI? Most practitioners say no — different indexes, slightly different exposure. AAPL the stock and AAPL stock are obviously identical. A specific AAPL call option? Probably. Default to caution when in doubt.
- The disallowed loss isn't lost forever. It gets added to the basis of the replacement shares. You "carry" the loss forward and recognize it when you eventually sell the replacement. But until then, the cash-flow benefit you were counting on for this year is delayed, sometimes by years.
Visualize the 61-day window
This is the calendar that matters. Hover any day to see what an action on that day would mean for a same-symbol buy made on the loss sale date (highlighted).
The three traps
Trap 1: DRIP reinvestments
You sold MSFT at a loss on March 15 to harvest. On April 2, MSFT paid a dividend. Your "Dividend Reinvestment Plan" (DRIP) automatically bought $43 of MSFT. The IRS doesn't care that you didn't push the button — that's a wash sale. Your loss is partially or fully disallowed depending on how many shares the dividend bought.
Fix: turn off DRIP on any holding you might harvest. Use the cash dividend instead. Or set the DRIP to roll into a different fund.
Trap 2: Spousal accounts
The wash-sale rule applies to the taxpayer, not the account. If you and your spouse file jointly, your accounts are combined for the purpose of the rule. Spouse buying VOO in their IRA the same week you sold VOO at a loss in your taxable? Wash sale. Disallowed loss. Worse: a wash inside an IRA is permanently lost basis (you can't carry the loss forward against future IRA gains the way you can in a taxable account).
Fix: coordinate. Software that watches both spouses' accounts catches it; manual TLH on one account at a time absolutely does not.
Trap 3: Partial fills + limit-order chains
You sold 200 shares of XOM at a loss. Two weeks later you bought 50 shares of XOM thinking the bottom was in. The IRS doesn't pro-rate gracefully — it disallows the loss attributable to the 50 shares you re-acquired and adds that disallowed loss to the basis of those 50 shares. The other 150 shares' loss is fine.
Fix: if you're going to harvest, commit to staying out for 31 days. If you can't, harvest into a different ticker.
The legitimate way to harvest around the rule
The standard, IRS-tested workflow:
- Sell the loser. Realize the loss for tax purposes.
- Same day, buy a "similar but not substantially identical" replacement. For an index ETF, this means a different index or a different sponsor's index that tracks slightly differently. For a single stock, this means a peer in the same sector with similar fundamentals.
- Hold the replacement at least 31 days.
- If you want the original back, sell the replacement and buy the original. The 31-day clock on the original was running while you held the replacement, so you're free to repurchase.
For direct indexers, "similar but not substantially identical" typically means a same-sector peer: XOM → CVX, AAPL → MSFT, JPM → BAC. Maintains exposure, satisfies the rule, holds 31 days, swap back if desired.
What the rule does NOT block
Three exceptions worth knowing about:
- Gains are not affected. §1091 only applies to losses. You can sell at a gain and rebuy the same security an hour later. The gain is recognized; no rule applies.
- Bonds are mostly not affected. Identical bond issuances (same CUSIP) trigger the rule, but most muni / corp bonds aren't fungible enough across issuers to count as "substantially identical."
- Mutual funds at the same firm are usually fine. Vanguard's Total Stock Market mutual fund (VTSAX) and the ETF (VTI) hold the same portfolio — and the IRS has not formally ruled them substantially identical despite the obvious case for it. Software treats them as identical out of caution.
The bottom line
The wash-sale rule turns a careless TLH workflow into an expensive nothing. It also rewards careful workflows generously: as long as you understand the 61-day window, the spousal aggregation, and have a replacement that's similar-but-not-identical, you can harvest as aggressively as the market gives you opportunities.
Software is the right tool here. Tracking 60 positions × every DRIP × every spouse account × every replacement candidate is not something even a careful human does well by hand.