wash sale date calculator — how do I figure out the 30-day window?

Got hit with a wash sale flag on my 1099-B and I'm trying to build a wash sale date calculator in a spreadsheet so I can check my trades before I file. The situation: I sold shares of a tech ETF at a loss on March 14, then bought back into what I think is a substantially identical fund on April 8. My broker flagged it as a wash sale in box 1g, but I'm not confident I know how to count the days correctly — do I count from the sale date, or the settlement date? And does the 30-day window go in both directions from the sale? I already tried counting calendar days from March 14 and I keep second-guessing myself. What's the actual rule, and how do I build a reliable date window around any sale so I don't keep making this mistake?

37 comments

The window runs 30 days before the sale date AND 30 days after — 61 days total centered on the sale. So for March 14, any purchase of substantially identical securities from February 12 through April 13 would trigger a wash sale. Use trade date, not settlement date, for securities traded on established markets.

Priya J.

Author

So my April 8 buy falls inside that window. That confirms the wash sale. And just to be sure — the 'before' window counts purchases I made before I even sold?

Yes exactly. If you bought the same fund on March 1 at a higher price and then sold at a loss on March 14, that prior purchase is inside the 30-day before window and would disallow the loss too. The rule catches both directions.

Sold ARKK at a loss in January, then bought a different ARK fund 10 days later thinking they weren't substantially identical. My broker didn't flag it but I looked it up and the "substantially identical" test is the real trap, not just the date math. The IRS doesn't give a bright-line test for ETFs so that part is genuinely ambiguous.

Honestly, the substantially identical question keeps me up at night. Two S&P 500 index funds from different providers — are they substantially identical? Most tax professionals say probably not, but I've never seen the IRS actually rule on it clearly.

Right, the date window is the easy part to calculate. The "substantially identical" question is where you actually need to think or ask a CPA.

Uploaded my brokerage transaction history to taxr.ai and it mapped out the 30-day before/after window for every loss sale I had, then flagged which buys landed inside each window. Saved me from manually building the whole thing in a spreadsheet. Still had to decide the "substantially identical" question myself, but the date work was done. Worth doing before you file if you have a lot of trades.

Priya J.

Author

Next step for me is trying that before I go line by line on Form 8949. Did it handle trades across multiple accounts?

Mine were all in one account so I can't say for certain on the multi-account side. The wash sale rules apply even across accounts — including IRA purchases — so that's worth flagging manually if you have that situation.

The rule as written in Publication 550: the wash sale period is 30 days before and 30 days after the date of the sale. Count calendar days. The day of the sale itself is not day 1 — you start counting the day after the sale for the 'after' side. For the 'before' side, count back 30 calendar days from (but not including) the sale date.

Priya J.

Author

So for March 14: before-window starts February 12, after-window ends April 13? Let me recount — that would make April 8 clearly inside.

Correct. February 12 through April 13, with March 14 being the sale. 30 days each direction. April 8 is inside.

My situation was messier — I did a series of partial sells and partial buys over about two weeks. What tripped me up is that each sale creates its own window. So if you sell in three batches, you have three overlapping windows and you have to match each loss lot against the buys that fall in its window.

Worth noting: if the wash sale loss goes into an IRA or Roth IRA because you bought substantially identical shares in the IRA within the window, the disallowed loss is gone permanently — it does NOT get added to the IRA's cost basis. That's the worst version of this scenario.

Next question I always had: is the IRA wash sale only triggered if I personally control both accounts, or does it also apply to a spouse's IRA?

Publication 550 says the wash sale rules apply if your spouse buys substantially identical stock too. So yes, a spouse's IRA purchase inside the window disallows the loss just the same.

Practical thing for the spreadsheet: I added three columns — sale date, 30-day-before date (=sale date minus 30), and 30-day-after date (=sale date plus 30). Then for each buy I did a check against every loss sale window. VLOOKUP doesn't work great for date ranges; I ended up using COUNTIFS with date range conditions.

Priya J.

Author

This is what I was trying to do. The COUNTIFS approach is cleaner. Did you use trade dates or settlement dates in your sheet?

Trade dates throughout. Settlement dates would shift things by a day or two and you'd get the wrong window.

Had a bunch of crypto losses last year and was trying to apply wash sale logic to them. Uploaded everything to Taxr and it flagged right away that the wash sale rules don't apply to crypto under current law — crypto isn't stock or securities for this purpose. Got that clarified before I misreported anything.

This is actually really important. Crypto wash sales are a legislative proposal that keeps coming up but as of now the rule only covers stock and securities. Commodity futures and foreign currencies are also excluded from wash sale rules under Publication 550.

Next thing I checked was whether that changes on 2025 returns. As of now it still doesn't apply to crypto, but keep an eye on any new legislation before you file.

On Form 8949, a wash sale gets reported with code W in column (f) and the disallowed loss amount as a positive number in column (g). The loss isn't just left off — you have to show it and then add it back. That positive number in column (g) offsets the loss in column (d) minus column (e).

Priya J.

Author

So the wash sale loss still shows up on the form, it's just neutralized by the column (g) entry? That's what my tax software did but I didn't understand why.

Exactly. And that disallowed amount gets added to the cost basis of your replacement shares, so you eventually get the benefit when you sell those — assuming you don't trigger another wash sale on that position.

Something people miss: the holding period of the new shares includes the holding period of the shares you sold. So if your wash sale reset doesn't just affect basis — it can affect whether your eventual gain or loss is short-term or long-term.

I sold at a loss in late November and then bought back in early December — classic year-end wash sale. The loss was disallowed even though the two trades were in different tax years. The 30-day window doesn't reset at December 31.

Priya J.

Author

This is the one that gets everyone. I almost did the same thing in December. The calendar year boundary is completely irrelevant to the 30-day count.

If you have a lot of positions and your broker's 1099-B already has box 1g filled in, that number is only reliable if both the sold lot and the replacement shares had the same CUSIP and were in the same account. Cross-account wash sales won't appear in box 1g even though they're real wash sales you have to track yourself.

This is the gap that most people don't realize. Your 1099-B can say $0 in box 1g and you can still have wash sales the IRS would expect you to report.

The adjusted basis carries to the new shares — that's key for the date calculator too. You need to track not just whether a wash sale happened but what the new cost basis is for the replacement lot, because that affects the next sale's gain or loss calculation.

Ran into an issue where I bought options on the same stock I sold at a loss. The wash sale rules cover contracts or options to acquire substantially identical stock, so options count. Had to adjust my date window spreadsheet to include option purchase dates, not just stock purchase dates.

Worth adding: Publication 550 says the rules apply to losses on contracts and options to acquire or sell stock or securities. It specifically excludes commodity futures contracts and foreign currencies. Options on individual stocks and ETFs are inside the rule.

Next step for anyone building the calculator: add a separate row type for options with the same 30-day window logic, and flag when an option buy date falls inside a stock loss window on the same underlying.

The loss carryforward from a wash sale isn't lost forever — it's deferred into the new shares' basis. But if you buy those replacement shares in an IRA, that's the exception where it really is gone. Publication 550 is clear that the IRA situation is permanent disallowance with no basis adjustment in the account.

For anyone building the wash sale date calculator in a spreadsheet: the most useful thing I added was a column that shows the number of days between the sell date and the next buy of the same ticker. If that number is 31 or more, you're clear. If it's 30 or under, you need to check whether the security is substantially identical.

Priya J.

Author

That's the column I was missing. Days-between as a quick filter, then manual review only for the rows that flag under 31. Going to rebuild my sheet this way.