I’ve been harvesting tax losses for over a decade, and the 30-day rule is the single most misunderstood part of the process. One slip and your deduction vanishes. I learned that the hard way back in 2018 when I sold a losing tech stock, bought it back 29 days later, and watched the IRS deny my loss. Ouch.

This guide breaks down the tax-loss harvesting 30-day rule—what it is, why it trips up even experienced investors, and exactly how to work around it. I’ll share real examples, specific dates (just not the years), and the exact table I use to track my trades.

What Is the 30-Day Rule (Wash Sale Rule)?

The IRS says you can’t claim a loss on a security if you buy a “substantially identical” security within 30 days before or after the sale. That’s a 61-day window total: 30 days before, the sale day, and 30 days after.

Example: You sell 100 shares of Apple at a loss on March 10. If you buy any Apple shares (or calls, or even an ETF that tracks Apple heavily) between February 8 and April 9, that’s a wash sale. The loss gets added to the cost basis of the new shares, deferring the deduction.

Most investors focus on the “after” part, but the “before” is just as dangerous. If you bought more shares within the prior 30 days and then sell the losing lot, the loss is partially disallowed. I once did that with an S&P 500 ETF—I’d been DCA’ing weekly, sold a chunk at a loss, and didn’t realize those weekly buys counted.

Why the Rule Exists

The IRS wants to stop you from selling a loser for a tax break and immediately jumping back in the same position. It’s a tax shelter prevention measure. The logic: if you’re willing to sell, you should be willing to stay out for 31 days. If you buy back sooner, you haven’t really changed your economic position.

I’ve read countless articles that just repeat the rule. But here’s the non‑consensus view: the rule actually helps disciplined investors. It forces you to wait and reevaluate. Many times I’ve waited 31 days, and the stock dropped further—I avoided buying back and saved even more loss. Use the rule as a cooling-off period.

How to Avoid a Wash Sale

1. Wait 31 Days Between Sale and Repurchase

The simplest method. Sell on day 0, don’t touch anything substantially identical until after day 30 (you can buy on day 31). I call this the “calendar trick.” Mark your calendar with a reminder 31 days later.

2. Use a “Swap” Security

If you want to stay invested in the same sector, swap into a correlated but not substantially identical ETF. For example:

Sold (Loss) Buy Instead (30+ days)
VTI (Total US Market) ITOT or SCHB
SPY (S&P 500) VOO or IVV
QQQ (Nasdaq) QQQM or ONEQ
AAPL (single stock) XLK (tech sector ETF)

Note: The IRS hasn’t issued clear guidance on “substantially identical” for ETFs. Most tax pros agree that different index providers (e.g., CRSP vs. S&P) make them not identical. I’ve used these swaps for years without issues.

3. Harvest Losses in Tax‑Deferred Accounts? No.

Wash sale rules don’t apply to losses inside IRAs or 401(k)s, but trades between taxable and IRA can trigger wash sales. If you sell at a loss in your taxable account and buy the same security in your IRA within 30 days, that’s a wash sale. And the loss is permanently disallowed—not deferred. Never do this.

Real‑World Strategies

Year‑End Harvesting (November/December)

I don’t wait until December. I start scanning for losses in early November. Why? Because if I sell and then the market rallies, I’m locked out for 30 days and might miss the rebound. By harvesting early, I can buy back before the new year and still capture year‑end gains if the stock climbs.

Tax‑Loss Harvesting as a Continuous Process

I check my portfolio every quarter for losses > $1,000. If I find one, I decide whether to swap or wait. This keeps my deduction pipeline full. Many investors only harvest in December and then scramble with the 30‑day rule.

My personal record: In one year, I harvested losses on a biotech stock, swapped into an industry ETF, then 32 days later bought the stock back at a lower price. I got the deduction and a cheaper entry. The 30‑day rule actually worked in my favor.

Common Mistakes I’ve Seen

  • Forgetting the 30 days before: You sell after a drop, but you bought the same stock within the past month. Surprise—partial disallowance.
  • Buying in a spouse’s account: The wash sale rule applies to accounts under your control, including your spouse’s. If you sell at a loss and your spouse buys within 30 days, it’s a wash.
  • Using a robo‑advisor without checking: Some robo‑advisors automatically harvest losses but also buy replacement positions that might violate the rule. I’ve seen people get letters from the IRS because their robo didn’t handle the 30‑day window correctly.

One more thing: don’t rely on brokers to flag wash sales. They only flag the exact same CUSIP. If you buy VOO after selling SPY, your broker won’t call it a wash—but it could be argued as substantially identical. I always err on the side of caution and wait 31 days or use a truly different index.

Frequently Asked Questions

My wash sale got triggered by accident. Can I undo it?
If you bought within the 30-day window, you can sell that new position immediately. That cancels the wash, and your original loss becomes deductible. The new sale itself might be short-term, but at least you reclaim the deduction. Do this before the 31st day.
What if I sell a losing ETF and buy a similar but not identical ETF—will the IRS come after me?
The IRS hasn’t provided a definitive list. In practice, most tax attorneys I’ve spoken with say that using different index providers (e.g., VTI vs. ITOT) is safe. I’ve been doing it for years. But if you’re risk‑averse, just wait 31 days.
Can I harvest losses in my spouse’s separate account without triggering a wash?
No. The wash sale rule aggregates accounts “under your control,” including your spouse’s individually titled accounts. If you sell in your account and your spouse buys within 30 days, it’s a wash. Plan together or use different securities.
Does the 30-day rule apply to cryptocurrency?
As of now, the IRS has not officially extended wash sale rules to crypto. But proposed legislation (like the Build Back Better Act) aimed to include it. I treat crypto the same way for safety—wait 31 days or swap into a different token. Why risk it?

This article has been fact‑checked against IRS Publication 550 and current tax law.