Assume I do the following transactions:

  1. Buy 1 share of XYZ for $100 and sell it for profit at $110 on January 1.

  2. Buy 3 shares of XYZ at $100 and sell them for a loss at $90 on January 2.

  3. Buy 1 share of XYZ for $100 and sell them for profit at $110 on January 3.

These are all my transactions for XYZ for the full year.

How many of the 3 shares I sold at a loss are a wash sale? Note that shares were bought both before and after the 3 shares were sold at a loss. However, would I be correct in assuming that the shares in #1 cannot be replacement shares since that position is already closed?

If the above reasoning is correct, then only 1 of the 3 shares sold at $90 is a wash sale. I would claim the loss on the other 2 and adjust the cost basis of the buy in #3.

But maybe my understanding of the wash sale rule is wrong and 2 of the shares sold at $90 constitute a wash sale? Then, I'd have to adjust the cost basis of the buys in #1 and #3? That's quite counter-intuitive since #1 buy was already sold.

Or maybe I'm completely wrong and all 3 of the shares sold at $90 are wash sales?

Help would be greatly appreciated.

Bonus questions: What if all the transactions happened within the same day? (IRS p550 loss and gain within the same day for context)

2 Answers 2


You would apply $10 of the loss from trade number 2 to the cost basis of trade number 3. So you didn't buy one share for $100, you bought 1 share for $110. Then when you sold it at $110, after the wash sale adjustment you have no loss, you do have a loss of $20 from trade number two which you can deduct against your gain of $10 from transaction number 1; leaving a net loss of $10 assuming you don't buy this security again within 30 days.

For wash sale purposes, transaction number 1 isn't terribly relevant because it results in a gain. The wash sale is transaction number 3 because you have to adjust the cost basis of transaction number 3 to account for the loss you realized in transaction number 2 because you initiated transaction number 3 within 30 days of the sale in transaction number 2. If you open another position (position 4) within 30 days of transaction number 2 you'll have to make a similar cost basis adjustment account for the remaining $20 loss.

Additionally, it's worth pointing out that wash sales are about loss realization. The government wants its cut of gains immediately, but in a wash sale you have to postpone your realization of losses. You don't get your loss immediately in the event of a loss, but the government wants its part of your gain immediately in the event of a gain.

Wash Sales

You cannot deduct losses from sales or trades of stock or securities in a wash sale

It looks like 2016 is the most current revision year for the "Investment Income and Expenses" IRS publication. Wash sale rules start on page 58.

This is the quote that matters to you:

If your loss was disallowed because of the wash sale rules, add the disallowed loss to the cost of the new stock or securities (except in (4) above [witch references IRAs]). The result is your basis in the new stock or securities. This adjustment postpones the loss deduction until the disposition of the new stock or securities. Your holding period for the new stock or securities includes the holding period of the stock or securities sold.

This is the example illustrating your basic situation:

Example 1. You buy 100 shares of X stock for $1,000. You sell these shares for $750 and within 30 days from the sale you buy 100 shares of the same stock for $800. Because you bought substantially identical stock, you cannot deduct your loss of $250 on the sale. However, you add the disallowed loss of $250 to the cost of the new stock, $800, to obtain your basis in the new stock, which is $1,050.

To address your comment, it looks like the number of shares does matter, the rule is here:

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.

  • 1
    I don't understand this answer. First, you sell 3 stocks in #2 and only buy back 1 stock in #3. Therefore, you should not be able to adjust the cost basis of the buy in #3 by the full $30 loss but rather only by $10 according to IRS instructions for partial buys / sells. Or am I misunderstanding that? Second, you completely ignore the buy in #1. I do understand that the net effect is the same in this case, but I'd like to figure out how to do this correctly because the net effect many not be the same in other scenarios. Commented Mar 12, 2018 at 20:14
  • @davej you're right, I've made some edits. The net effect is the same $10 loss, the purpose of wash sale rules is to prevent people from taking tax losses on securities they otherwise would have continued to hold; the "punishment" being that you top up your cost basis and deal with the result later. For the sort of trading frequency you're proposing wash sale rules really shouldn't impact your net outcomes.
    – quid
    Commented Mar 12, 2018 at 20:47

A wash sale occurs when the replacement shares are bought soon before or after the loss.

26 USC §1091:

(a) Disallowance of loss deduction

In the case of any loss claimed to have been sustained from any sale or other disposition of shares of stock or securities where it appears that, within a period beginning 30 days before the date of such sale or disposition and ending 30 days after such date, the taxpayer has acquired (by purchase or by an exchange on which the entire amount of gain or loss was recognized by law), or has entered into a contract or option so to acquire, substantially identical stock or securities, then no deduction shall be allowed under section 165 unless the taxpayer is a dealer in stock or securities and the loss is sustained in a transaction made in the ordinary course of such business. For purposes of this section, the term “stock or securities” shall, except as provided in regulations, include contracts or options to acquire or sell stock or securities.

The law says "has acquired", but doesn't mention still possessing the shares. (In other words, the closedness of the previous position doesn't seem to change things.) So of the three shares you sold at a loss, two appear to fall under wash sale rules.

This appears to be the case even if all these transactions were to happen on the same day.

  • This was my initial interpretation too. However, it's not clear to me how a closed position can constitute "replacement shares". I saw some posts claiming that you need to hold the shares after the sell at a loss for them to be considered "replacement shares", but I could not find any reference in the law about "and hold" part. Commented Mar 12, 2018 at 16:53
  • I'm not seeing anything in the law about still holding the shares at the time of the loss. SEC regulations might be clearer, but i doubt it. :P Considering you're claiming all the gains and losses within the same year, though, it's more bean-counting than anything. Either way, you end up with a net loss of $10.
    – cHao
    Commented Mar 12, 2018 at 17:05
  • Assuming, of course, that you no longer hold shares in the company. If you do, that would complicate things.
    – cHao
    Commented Mar 12, 2018 at 17:11
  • You also mentioned the answer would be the same if all the transactions would be on the same day. Why would the following not apply: "Loss from a wash sale of one block of stock or securities cannot be used to reduce any gains on identical blocks sold the same day."? So in that case it seems I would have a 2 share wash sale but not be able to adjust cost basis for the other #1 and #3 buys. Commented Mar 12, 2018 at 17:18
  • 1
    You have a reference? Cause that sounds quite odd; the loss would need to be accounted for somehow. Despite all appearances, the IRS and SEC are not out to screw people over. :)
    – cHao
    Commented Mar 12, 2018 at 17:29

You must log in to answer this question.

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