How do wash sales work when the acquisition of substantially similar stock is done *before* the sale?

I understand wash sale rules in the simple case: If I sell stock at a loss and then buy it back in 30 days or less, I can't take a deduction on the loss and must instead add the loss to the cost basis of the repurchased shares, deferring the deduction (if any) until those shares are eventually sold.

I also understand the situation where someone increases their long position just before selling shares at a loss. For example, if someone had 100 shares of something, wanted to keep 100 shares, but also wanted to take a loss when the stock dipped, if not for the wash sale rule they could buy 100 shares and then immediately or soon after sell the original for 100 shares at a loss while maintaining their 100 share position.

Here's where I get confused: how does it work when the previous purchase's position has already been closed out?

Let's say, for example, that :

• on day 0 I bought 10 shares of X for \$10 each (\$100 total), and sold them the same day at \$11 each (\$110), for a gain of \$10.
• 15 days later, again purchase 10 shares at \$10, and then sell them for \$8 each (\$80), for a loss of \$20.

Since there was a purchase within 30 days of the sale on day 15 (the purchase on day 0), my understanding is that that sale is a wash, and the \$20 loss is disallowed.

But then it gets weird: if we add that \$20 to the cost basis of the purchase on day 0, that \$10 gain becomes a \$10 loss. Furthermore, wouldn't that loss also be a wash, because shares were purchased just 15 days later?

If so, which cost basis does that \$10 loss get added to? The sale on day 15 that was already a wash? When does that washing and the basis changing stop?

For context, I get stock compensation that vests monthly and then is immediately sold the same day. This means that almost every transaction that is a loss is a wash (with the exception of vesting in August and January, where the lengths of the months mean that the transactions are 31 days away from the trades in July and September(for the August trade) and the trades in December and February (for the January trade). So I want to make sure I understand this!

2 Answers

Your understanding of the wash sale rule is incorrect.

Your first trade was closed for a profit. It's a done deal and in the books. You are now flat with no open position.

Your second trade is closed for a loss and again, you have no position in the stock. There were no replacement shares bought. The loss is yours to claim as long as you wait 30 days until the next purchase.

Had the losing position occurred first, then the repurchase within 30 days (replacement shares) would have triggered a wash sale and the loss would have had to have been deferred. When you closed the new position, the loss would have been realized for tax purposes.

In both cases, the net loss would be the same. The difference would be the bookkeeping on your return. The only snag would be if the violation resulted in a deferred loss having to be carried into the next tax ear.

If in the end you haven't made any transactions between day 15 and day 45 and you ended up with no position - then the only case where it matters if a year ended between day 0 and day 15.

If your year end was between day 0 and day 15, you'll have to report the transaction on day 0 as year X taxable event and transaction on day 15 as year X+1 taxable event.

Since you had a wash sale, the basis of the transaction for year X would be increased by the loss on day 15: instead of buying them for \$100, you'd be considered buying them for \$120, with taxable loss of \$10. The \$20 loss in year X+1 would be disallowed as wash sale. Your total loss would remain the same.

For context, I get stock compensation that vests monthly and then is immediately sold the same day.

I would ignore these for wash sale rules if they're done under an autosale/10b(5)-1 plan. The goal of wash sale rules is to prevent market timing for loss harvesting, which is not what you're doing. I doubt the IRS would want to even start calculating your wash, but if they do - you may save yourself some trouble and let them do the calculations and accept them if you want. The tax effect of that should be minimal, if at all.

• In my case, there may be an X+1 situation in that I think (I'd have to sit down and do the math) the December transaction is a wash and the extra basis will need to be added to a transaction in January. I'm curious to hear more about ignoring it if autosale/10b(5)-1 plan, as these are indeed autosold. I agree that I don't think the rules were made for this situation, but they likely still apply, no? Feb 19 at 22:14
• @user115619 technically they do, but I find it impractical and contrary to the intention of the law to deal with this. In my case the broker doesn't even report them as wash sale. Feb 19 at 22:55
• In this case, the sale whose basis is adjusted is the later sale, which was the sale at a loss anyway. So the net effect of applying the wash sale rule is nothing. Feb 20 at 2:01