Wash sale if selling older shares at loss after buying within 30 days — does lot order matter?

Trying to figure out if I have a wash sale situation. I bought 50 shares of a stock in early March, then bought another 50 shares of the same stock in late March (so about 20 days later). Now I want to sell the original 50 shares from early March at a loss — I'm still holding the late-March shares. My broker's platform defaults to FIFO so it would sell the older lot first. The question is whether selling those older shares at a loss triggers a wash sale because I bought substantially identical shares within the 30-day window before the sale. I've read conflicting things online. Some say the direction (buy before vs. buy after the sale) doesn't matter, others say it only applies if you rebuy after selling. Which is it?

37 comments

The direction absolutely matters for the 30-day window, and it goes both ways. The wash sale rule covers purchases within 30 days before OR after the sale at a loss. So yes, buying in late March and then selling the earlier lot at a loss in, say, mid-April — the late-March purchase lands inside that 30-day before window and the loss is disallowed.

Sam P.

Author

That's what I was afraid of honestly. So the fact that I bought first and am selling second doesn't get me out of it.

Ran into this same trap last year. I thought I was being clever selling my original position while keeping newer shares, but my 1099-B came back with the loss flagged in box 1g. The broker caught it because both lots were in the same account with the same CUSIP. The disallowed amount showed up right there.

Sam P.

Author

Did your broker automatically add the disallowed loss to the cost basis of the newer shares, or did you have to track that yourself?

They showed the adjusted basis on the 1099-B but honestly I double-checked it manually because I didn't fully trust their calculation. Worth doing.

I dealt with this last tax season and uploaded my 1099-B and trade confirmations to taxr.ai — it flagged which lots were inside the 30-day window on both sides, identified the disallowed loss amount, and laid out exactly how the adjusted basis flowed into my remaining shares. Helped me see the full picture before I even started filling out Form 8949. The wash sale rule as written hits purchases 30 days before OR after the sale, so your scenario is squarely in it.

Sam P.

Author

Really useful to know it checks both directions in the window. I'll give that a look before I finalize anything.

Worth being clear on what happens to that disallowed loss — it doesn't disappear. The IRS adds it to the cost basis of the shares that triggered the wash sale (the late-March lot in your case). So if you eventually sell those at a gain, your adjusted basis is higher and you pay less tax. It defers the loss, it doesn't kill it. See Publication 550 for the mechanics.

This part trips a lot of people up. They see 'disallowed' and think the loss is gone forever. It's really just parked in the new shares.

Exactly. And the holding period of the disallowed shares carries over too, which can flip a short-term situation into long-term when you eventually sell.

One thing I'd flag: your broker will only report box 1g on the 1099-B if both the sold shares and the replacement shares are covered securities with the same CUSIP in the same account. If you had bought the later shares in a different account — or an IRA — the broker might not catch it at all, but the wash sale still applies. You'd have to track it yourself and still can't take the loss.

Sam P.

Author

Both lots are in the same taxable account so my broker should catch it. Good to know about the IRA angle though — I have a Roth and I didn't realize purchases there could trigger it too.

Yeah the IRA version is brutal because when the IRA buys the substantially identical stock, the disallowed loss doesn't even get added to any basis — it's just gone. The Publication 550 wash sale section covers this explicitly.

I'd double-check whether your broker's FIFO default actually sold the right lot. Some platforms let you switch to specific identification before the trade settles. If you haven't executed yet, it might be worth seeing whether a different lot selection changes the math — though if all your shares are the same ticker with purchases inside the 30-day window, lot selection won't save you from the rule itself.

To report it on Form 8949 when you do file: since the 1099-B will show the loss disallowed in box 1g, you check whichever Part I box matches your situation (box A if basis was reported to the IRS, box B if not), enter code W in column (f), and enter the disallowed loss as a positive number in column (g). The holding period for short-term vs. long-term is determined by the trade date you bought, not the settlement date.

Sam P.

Author

So the positive number in column (g) offsets the loss I'd otherwise show — meaning the net reportable loss on that row becomes zero or less negative. Got it.

Right. The column (g) adjustment brings the reported loss to zero (or the allowed portion if it's a partial wash). What flows to Schedule D is only what's actually allowed.

I had a whole string of these across multiple tickers last year — partial wash sales, different lot sizes, some cross-account. I fed all my trade history and both 1099-Bs into Taxr and it built out the adjusted basis table for every affected lot and drafted the Form 8949 entries with the W codes already placed. Saved me from a lot of manual reconciliation. The rule itself is straightforward once you see it laid out lot by lot.

Partial wash sales are where it gets really messy. If you sell 50 shares at a loss but only bought 30 replacement shares in the window, only 30/50 of the loss is disallowed. The other 20 shares' worth of loss is deductible.

Exactly what happened to me on two of them. The proportional math is tedious to do by hand across a full year of trading.

Since you haven't sold yet — if you wait until the late-March shares are more than 30 days old before you sell the early-March lot, you exit the window entirely and there's no wash sale issue. That's the cleanest fix if you're not in a rush.

Sam P.

Author

I hadn't thought about just waiting it out. That might actually be the move if the loss isn't going anywhere significant in the next week or two.

The holding period carryover point matters if you're close to the one-year line. The wash sale rules transfer the holding period of the disallowed shares to the replacement lot. So if your older shares had been held almost a year, that time carries over to the late-March shares — which could make a future gain on those shares long-term even if you sold them relatively soon after buying.

This is underappreciated. You can end up with a long-term gain on shares you held for only a few months because the holding period tacked on from the wash sale lot.

I'd also note that if your total capital losses for the year exceed your capital gains, the net loss you can claim against other income has a cap — the Schedule D instructions and Topic 409 on irs.gov cover the limit and the carryover worksheet. Worth knowing before you decide how hard to chase a particular loss this year.

Sam P.

Author

Good point. I'm already sitting on some gains this year so I was hoping to use this loss to offset them. The cap doesn't hurt me if I have gains to offset first, right?

Correct — the cap only bites if your net position after all gains and losses is still a loss. If you have enough gains to absorb it, the full deductible loss offsets them and the cap never comes into play.

A purchase in your spouse's account can trigger a wash sale too, which surprised me when I first ran into it. The rule covers purchases by your spouse or a corporation you control, not just your own accounts. If you and a spouse share investing decisions it's worth checking both account histories.

Sam P.

Author

We do have separate brokerage accounts. Didn't realize that could create a problem. We'll need to coordinate before year-end on any harvesting moves.

The actual rule is worth reading at the source: Publication 550 on irs.gov has the full wash sale section, including the IRA scenario and the basis adjustment mechanics. The Form 8949 instructions cover how to enter code W and the column (g) adjustment. Both are worth reading once end to end if you're doing any tax-loss harvesting.

The 8949 instructions also walk through what to do when the basis on the 1099-B is wrong — separate issue but comes up sometimes when brokers don't have your full cost basis history.

My situation last year had me selling at a loss and then my automatic dividend reinvestment plan bought the same stock four days later. DRIP purchases count the same as any other purchase — I didn't realize that until the 1099-B came in with the disallowed amount. Worth checking if you have DRIP turned on.

Sam P.

Author

Oh I do have DRIP on for a few positions. That's a real gotcha I would not have caught on my own.

Turned mine off in October and back on after the 30-day window. Annoying but it avoided the wash sale on the harvesting I was doing.

If the numbers involved are significant — say you have a large loss and a complicated series of trades across multiple accounts — it might be worth sitting down with a CPA or enrolled agent before you file. Getting the basis adjustments wrong in a chain of wash sales can compound across years if the replacement shares trigger another wash sale later.

Sam P.

Author

Mine isn't huge this year but I'll keep that in mind for future years when the positions get bigger. Good to know the threshold where professional help makes sense.

On lot order specifically, the IRS rule doesn't distinguish between 'bought first, sold second' and 'sold first, bought second.' What it looks at is whether a substantially identical purchase landed in the 30-day window on either side of the loss sale. Your late-March buy is inside the 30-day before-the-sale window for any sale you make through roughly mid-to-late April, depending on exact dates. Count carefully.