Wash sale rule if I sell all lots with overall gain then rebuy — does it even apply?

Trying to figure out if the wash sale rule applies to my situation. I hold three lots of the same ETF. Two lots have unrealized losses, one has a bigger unrealized gain. If I sell all three at once, the net result across all lots is a gain overall. Then within a few days I rebuy the same ETF. I've read that wash sales are about disallowing losses, so if the whole transaction shows a net gain, does the rule just not kick in? Or does the IRS look at each lot separately and disallow the loss lots even if the combined result is a gain? I already checked my 1099-B from last year and the broker did flag individual lot losses as wash sales even when I sold everything. So now I'm second-guessing whether selling "everything" actually helps when you rebuy so fast. My broker uses FIFO so I can't easily cherry-pick.

33 comments

Are you sure your broker is tracking this lot by lot and not netting it before flagging the wash sale? Because the rule operates at the individual lot level, not the net position level. A gain on lot three doesn't shield a loss on lot one from wash sale treatment if you rebuy within the 30-day window.

Tony G.

Author

Yeah the broker statement last year showed each lot on a separate row in box 1g with separate wash sale adjustments. So it really does seem like they look at each lot individually even when I sold the whole position at once.

This is something I ran into with a bunch of ETF lots last fall. The overall position was up but two older lots were underwater and I reloaded the same fund six days later. My broker flagged those two lots as wash sales even though the account showed a net gain on the full sale. I uploaded my 1099-B and trade confirmations to taxr.ai and Taxr pulled out each lot, matched the disallowed amounts in box 1g to the specific purchase dates, and showed me which lots' losses were being added into the cost basis of the shares I reloaded. That was the part I hadn't tracked manually.

Tony G.

Author

That's exactly the clarification I needed — so the net gain doesn't protect the individual losing lots at all. The wash sale rule still fires on each loss lot separately.

Does the type of fund matter here? I know some people say ETFs tracking the same index aren't "substantially identical" to each other, but if you're literally selling and rebuying the exact same ETF ticker, that question doesn't even come up — it's the same security.

Right, substantially identical only becomes a real question when you swap to a different fund. Same ticker reloaded within 30 days is about as clear a wash sale trigger as you can get on the loss lots.

What's your holding period on those losing lots? If any of them flip from short-term to long-term because the wash sale tacks on the holding period of the old shares, that could actually matter when you eventually sell the reloaded shares.

Tony G.

Author

Both loss lots are already long-term so that piece shouldn't change. But I hadn't thought about how the disallowed loss gets added to the cost basis of the new shares — that at least means the loss isn't gone, just deferred.

Exactly — the disallowed loss is added to the cost of the new shares, so the tax hit shifts to whenever you sell those. Unless you trigger the rule again on that sale too.

Is there any way the wash sale rule doesn't apply because you sold every share you held in that fund before rebuying? I've heard people say if you close the entire position you're in the clear.

That's the part that trips people up. Closing the whole position helps only if you wait more than 30 days before rebuying. The 30-day window runs both before and after the sale date. Rebuy on day six and the rule still applies to the loss lots even if you held zero shares in between.

Ah, so the "close it completely" approach only works with the waiting period attached. Good to know — I had the same misconception.

To confirm what others are saying: Publication 550 is explicit that the wash sale applies when you sell at a loss and buy substantially identical shares within 30 days before or after. The net result of selling multiple lots together doesn't change the analysis. Each lot that closes at a loss is evaluated on its own.

Had a similar situation with a broad market fund — four lots, two wins two losses, sold everything, then bought back the same fund about a week later. When I gave Taxr my broker's year-end statement it flagged the two loss rows, showed me the adjusted basis that would carry into the new lots, and drafted the column (g) adjustments I'd need on Form 8949 for those rows. Saved me from just copying the 1099-B numbers straight onto the form.

Tony G.

Author

Did it also handle the box checking — like whether the broker reported basis to the IRS so you'd know to use box A versus box B in Part I of 8949? That part always confuses me.

The Form 8949 piece is worth spelling out. For each wash sale lot, you check the appropriate box (A or D if basis was reported to the IRS, B or E if not), put code W in column (f), and enter the disallowed loss as a positive number in column (g). The adjusted proceeds still go in column (d) as shown on the 1099-B.

Column (d) is proceeds, column (e) is cost basis from the 1099-B, column (f) gets the W code, column (g) gets the disallowed amount as a positive. That's the full row for each flagged lot.

Does any of this change if the rebuy happens in a different account — like you sell in a taxable brokerage account then rebuy the same ETF inside a Roth IRA within 30 days?

Yes and it's worse. If you or your spouse buys substantially identical securities in an IRA or Roth IRA within the window, the loss is still disallowed — but unlike the regular wash sale, the disallowed amount does NOT get added to the basis of the IRA shares. The loss is just gone permanently.

That's a nasty trap. So the IRA rebuy is actually worse than a taxable account rebuy because you lose the basis step-up benefit entirely.

What if the broker doesn't catch all of this and doesn't report anything in box 1g? Does that mean you're off the hook?

No. Box 1g only gets populated when the sold securities were covered and the replacement shares had the same CUSIP in the same account. Cross-account wash sales, IRA rebuys, and some other situations don't show up in box 1g at all. But the rule still applies and you still have to report it correctly on Form 8949. The 1099-B not showing it doesn't make the loss deductible.

So in the original situation — all lots sold, net gain, rebuy in days — the practical answer is: the gain lot is fine, report it normally. Each loss lot gets wash sale treatment, code W on Form 8949, disallowed amount goes to the basis of the new shares. The net-gain framing doesn't help at all.

Tony G.

Author

That's the clearest summary of my situation. So my plan to avoid wash sale issues by making sure the overall trade is a net gain is basically useless unless I also wait out the 30 days.

Is there a scenario where you could sell the loss lots on a different day than the gain lot and that changes anything? Or does same-day versus different-day not matter once they all fall inside the 30-day window?

Different sale dates can matter for counting the 30-day window precisely — the window runs from each individual sale date. But if the rebuy is within 30 days of every sale date, the analysis is the same regardless of whether you staggered the sales by a day or two.

Worth mentioning: the deferred loss isn't lost forever when it goes into basis of the new shares — provided you eventually sell those new shares outside any wash sale window. At that point the higher basis reduces your gain or increases your loss on that future sale. So the rule is a deferral, not a permanent denial, in the typical taxable account scenario.

What reporting obligation is there if you just let the broker's 1099-B numbers flow through software and you don't manually adjust for wash sales the broker missed? Like cross-account ones?

You're responsible for the correct numbers regardless of what the 1099-B shows. If the broker missed a cross-account wash sale, you still check the box that matches how the 1099-B was issued (A or D if basis was reported to IRS, B or E if not), put code W in column (f), and enter the disallowed loss as a positive number in column (g). Software that just imports the 1099-B won't catch those; you have to find and enter them manually.

That's the part automated import misses entirely. The instructions for Form 8949 at irs.gov/instructions/i8949 have the full column-by-column breakdown for exactly this scenario.

For anyone still unsure about the 30-day count: the window is 30 days before the sale AND 30 days after, so it's a 61-day period centered on the sale date. Selling everything and rebuying a week later lands squarely in the after-sale half of that window on every lot.

Does the wash sale rule affect how long-term versus short-term is determined on the new shares? Since the holding period of the old shares carries over to the new ones?

Correct — the holding period of the replaced shares tacks onto the new shares. So if the old loss lot was long-term, the new shares start with that long-term holding period already attached, which matters when you sell them down the road.