What the wash-sale rule is
A wash sale happens when you sell a security at a loss and buy the same or a substantially identical security within 30 days before or after the sale — a 61-day window in total. When that happens, the IRS disallows the loss for that year, so you cannot use it to offset gains or income right away.
The 30-day window (both directions)
A common misunderstanding is that the rule only looks forward. It looks both ways: 30 days before and 30 days after the loss sale. Buying replacement shares shortly before you sell the losing lot can trigger it just as easily as buying back afterward. The window counts calendar days, not trading days.
The loss is deferred, not destroyed
A disallowed loss is not gone. It is added to the cost basis of the replacement shares and the holding period carries over. So you get the benefit later — when you eventually sell the replacement shares without a wash sale, the higher basis produces a smaller gain or larger loss. The rule changes the timing, not the total.
What counts as substantially identical
The same stock is obviously identical. Options and contracts to buy the same stock count too. Two different companies do not. A common harvesting technique is to sell one fund at a loss and buy a different fund tracking a similar but not identical index — enough to stay invested without being substantially identical. This is a judgment area; when in doubt, wait out the 31 days.
Harvesting losses safely
To claim a loss cleanly: sell the losing position and either stay in cash for 31 days, or buy a genuinely different security to keep market exposure. Also avoid triggering it in a spouse's account or your IRA, which the rule also covers. Done carefully, tax-loss harvesting lets you bank losses to offset gains while keeping your overall allocation.
Does it apply to crypto?
As of 2026, the wash-sale rule as written applies to "stock or securities," and many argue it does not cover cryptocurrency, which is treated as property. Proposals to extend it to crypto have circulated for years. Because the rules can change, confirm current law before relying on crypto loss harvesting.