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!

4 Answers 4


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?
    – user115619
    Commented Feb 19, 2022 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.
    – littleadv
    Commented Feb 19, 2022 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. Commented Feb 20, 2022 at 2:01

The shares that receive the additional cost-basis (which was transferred from the wash sale) have to be unsold at the time of the Wash Sale. So in your example with just two trades, the second is not actually a Wash Sale, because the only other lot you could transfer the losses to have already been sold. Sometimes the language around wash sales does make this rather ambiguous/confusing, unfortunately.

For a more intuitive explanation, consider that the spirit of the Wash Sale rule is to disallow taking losses earlier than they are effectively realized, so it would not make sense to allow the transfer of the losses to an even earlier lot that is already sold. Cost-basis transfers to unsold shares is allowed because those losses can only realized after the Wash Sale, when those shares are eventually sold.


More or less stock bought than sold. If the number of shares of substantially identical stock or securities you buy within 30 days before or after the sale is either more or less than the number of shares you sold, you must determine the particular shares to which the wash sale rules apply. You do this by matching the shares bought with an equal number of the shares sold. Match the shares bought in the same order that you bought them, beginning with the first shares bought. The shares or securities so matched are subject to the wash sale rules.


You match the ten shares you bought on Day 0 with the 10 shares that you sold on Day 0. There is no loss, so the Wash Sale Rule doesn't apply to them. The 10 shares you sold on Day 15 don't have any matching shares within 30 days, so the Wash Sale Rule doesn't apply to them either.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .