How the wash-sale rule works
If you sell a security at a loss and buy the same or a “substantially identical” one within 30 days before or after the sale, the loss is disallowed for now. Here is the rule in the government’s own words, and what it means for ETF tax-loss harvesting.
The statute: IRC §1091(a)
“In the case of any loss claimed to have been sustained from any sale or other disposition of shares of stock or securities 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 (by purchase or by an exchange on which the entire amount of gain or loss was recognized by law), or has entered into a contract or option so to acquire, substantially identical stock or securities, then no deduction shall be allowed under section 165 …”
Source: 26 U.S. Code §1091 (Cornell LII). §1091(d) then provides that the basis of the replacement shares is the basis of the shares sold, adjusted by the price difference — which is how the disallowed loss is carried forward.
The IRS explanation: Publication 550
IRS Publication 550 (Investment Income and Expenses), section “Wash Sales”, says a wash sale occurs when you sell or trade stock or securities at a loss and within 30 days before or after the sale you:
“If you sell stock and your spouse or a corporation you control buys substantially identical stock, you also have a wash sale.”
- Buy substantially identical stock or securities,
- Acquire substantially identical stock or securities in a fully taxable trade,
- Acquire a contract or option to buy substantially identical stock or securities, or
- Acquire substantially identical stock for your individual retirement arrangement (IRA) or Roth IRA.
Pub. 550 continues: “If your loss was disallowed because of the wash sale rules, add the disallowed loss to the cost of the new stock or securities (except in (4) above). … Your holding period for the new stock or securities includes the holding period of the stock or securities sold.” (IRS Pub. 550)
The dates, concretely
- The window is 61 calendar days: 30 days before the sale, the sale day, and 30 days after.
- The earliest repurchase date for the original fund is day 31 after the sale. Calendar days count — weekends and holidays included.
- For exchange-traded securities the trade date, not the settlement date, determines when the sale happened. Pub. 550: “Do not confuse the trade date with the settlement date.”
- Purchases in the 30 days before the sale count too — including a dividend that was automatically reinvested.
What happens to a disallowed loss
It is not lost forever (except in the IRA case). Pub. 550’s example: you buy 100 shares for $1,000, sell them for $750, and within 30 days buy 100 shares for $800. The $250 loss is disallowed and added to the new shares’ cost, giving a basis of $1,050. If you buy fewer shares than you sold, only part of the loss is disallowed (IRC §1091(b); Pub. 550 “More or less stock bought than sold”).
“Substantially identical” — the gray area
Pub. 550: “In determining whether stock or securities are substantially identical, you must consider all the facts and circumstances in your particular case. Ordinarily, stocks or securities of one corporation are not considered substantially identical to stocks or securities of another corporation.” The IRS has not published a bright-line test for ETFs or index funds. Common practitioner views (not IRS rules):
- Highest risk: two funds tracking the same index (e.g. VOO, IVV, SPY all track the S&P 500).
- Gray: leveraged funds on the same index; float-adjusted or capped variants of the same benchmark; funds with very high holdings overlap.
- Generally treated as lower risk: funds tracking a genuinely different index (e.g. S&P 500 vs. a total-market index), even if returns are highly correlated.
That is why SwapFinder sorts alternatives by correlation but labels index identity and overlap separately: high correlation is the goal for staying invested; a different index is what reduces wash-sale risk. See the FAQ for IRA, spouse and DRIP details.
30-day wash-sale calendar
The window is 30 calendar days before and after the sale (61 days total, IRC §1091(a)). Buying the replacement fund right away is the point of a swap; the dates above are about buying back the fund you sold, or anything substantially identical to it.
Primary sources: IRC §1091 · Treas. Reg. §1.1091-1 · IRS Publication 550 · Rev. Rul. 2008-5.