How to calculate adjusted cost basis for ESPP shares when you sell

Sold my ESPP shares this year and my 1099-B from the broker shows a cost basis that I know is wrong — it's way lower than what I actually paid after the discount and the ordinary income piece. My W-2 had an amount added for the ESPP discount when the shares vested/were purchased, but I can't figure out how that feeds into what I report on Form 8949. I've read that I need to adjust the basis upward by the compensation income already reported, otherwise I'm going to get double-taxed on the same amount. I tried matching the numbers on my supplemental broker statement but the figures don't line up with the 1099-B box 1e at all. Is there a step-by-step way to figure out the correct adjusted cost basis for ESPP before I fill out Form 8949? Does it matter whether this is a qualifying or disqualifying disposition?

37 comments

Yes, qualifying vs. disqualifying disposition absolutely changes the calculation, so that's the first thing to nail down. A disqualifying disposition happens when you sell before holding the shares two years from the offering date OR one year from the purchase date — failing either test is enough. In that case, your employer includes the spread at purchase (FMV on purchase date minus your actual purchase price) in your W-2 wages. Your adjusted cost basis is then: what you actually paid + that W-2 compensation amount. The 1099-B often only shows what you paid, missing the W-2 piece entirely.

Omar R.

Author

So for a disqualifying disposition the W-2 income is already taxed as ordinary income, and I add that to what I paid to get the full adjusted basis. That makes sense. Mine was definitely a disqualifying disposition — sold less than a year after the purchase date.

I dealt with this last year and uploaded my ESPP confirmation statements and my 1099-B to taxr.ai. It read through both documents and listed each purchase lot, what the broker reported in box 1e, what my W-2 added for each lot, and the adjusted basis figure for each one. I then used those numbers on Form 8949. Saved me from double-paying tax on the discount. The key fact it flagged: the broker's basis is often the purchase price only, not purchase price plus compensation income already recognized.

Omar R.

Author

That's the exact problem I have — the box 1e number is just my purchase price. Good to know the W-2 amount is what bridges the gap.

The broker is only required to report what you paid as basis for shares acquired through an ESPP in many cases. The compensation piece lives on the W-2, not the 1099-B. So the mismatch you're seeing is expected, not an error.

For a qualifying disposition the math is different. You hold long enough and the gain gets split: part is ordinary income (capped at the actual discount you got), and part is capital gain. The ordinary income piece for a qualifying disposition is the lesser of the actual gain on sale or the discount at the offering date. Your basis adjusts accordingly. Publication 525 covers this in detail.

Worth adding: for a qualifying disposition, the ordinary income piece shows up on your W-2 only in the year of sale, not the year of purchase. A disqualifying disposition is the same on timing — nothing is taxed at purchase, and the ordinary income hits in the year you sell.

Omar R.

Author

Mine was disqualifying so I think the simpler rule applies to me. But good to understand the qualifying side too in case I hold future batches longer.

Step by step for a disqualifying disposition: 1. Find the FMV on your purchase date and your actual purchase price per share. 2. The spread (FMV minus purchase price) times shares = compensation income your employer should have included in W-2 box 1. 3. Your adjusted basis per share = purchase price + compensation income per share. 4. On Form 8949, enter the proceeds in column (d). Check box A or D if the 1099-B says basis was reported to the IRS, or box B or E if it wasn't — the box doesn't change just because box 1e is too low. With box A or D, enter the 1099-B basis in column (e), use code B in column (f), and enter a negative adjustment in column (g). With box B or E, enter the corrected basis in column (e) and -0- in column (g).

Omar R.

Author

The box B vs. code B distinction is what was tripping me up. If the 1099-B says basis was reported to the IRS (covered security), I use code B in column (f) and put the correct basis in column (e) even though it's wrong per the instructions?

Not quite — per the Form 8949 instructions, if box A or D is checked (basis reported to IRS), you enter the basis shown on the 1099-B in column (e) and then adjust in column (g) with a negative number (in parentheses) if your correct basis is higher. Code B in column (f) flags the adjustment.

My supplemental statement from the broker showed the "adjusted" basis including the compensation element, but the actual 1099-B box 1e did not. Ended up with a big phantom capital gain on my first read-through before I caught it. The IRS matches what's on your 1099-B, so if you don't make the adjustment on 8949 yourself, you'll owe tax on income you already paid ordinary rates on.

The IRS CP2000 notices for exactly this reason are very common with ESPP sales. The computer sees proceeds higher than reported basis and auto-generates a notice. Making the adjustment on Form 8949 properly is what prevents it.

Had a similar tangle with multiple ESPP lots bought at different offering dates and different discount percentages. I showed Taxr my broker's supplemental gain/loss statement and it walked through each lot, matched the W-2 coding, and drafted a column-by-column breakdown I could transfer to Form 8949. It also flagged that one lot had a wash sale code W on the 1099-B that I had completely missed. Really useful when you've got several lots at once.

Omar R.

Author

Multiple lots is where I'll be next year. Right now I only have one, but knowing there's a way to organize them systematically is reassuring.

The wash sale flag is easy to miss with ESPP especially if you bought new shares through the plan within 30 days before or after selling at a loss. The disallowed loss gets coded W in box 1g of the 1099-B and you have to report it on Form 8949 with code W in column (f) and the disallowed amount as a positive number in column (g).

Does the holding period change based on the offering date or the purchase date for ESPP? I always get confused on this.

For determining whether it's a qualifying or disqualifying disposition, the two clocks run from the offering date (2-year test) and the purchase date (1-year test). But for short-term vs. long-term capital gain on Schedule D, your holding period for the shares begins the day after the purchase date — the date you actually got the shares.

And per Publication 550, for securities traded on an established market, the holding period begins the day after the trade date you bought and ends on the trade date you sold, not the settlement date.

My company's HR portal had a "tax document" section with a per-lot breakdown showing compensation income recognized at each purchase. Cross-referencing that with my W-2 is what finally let me reconcile everything. Worth checking if your company provides that before you start building the numbers from scratch.

Omar R.

Author

I'll check the HR portal. I didn't even know that was a thing. My broker's supplemental PDF has some of this but it's hard to read.

One thing that matters: some employers use the FMV on the purchase date as the compensation amount, others use the lower of FMV at offering vs. purchase (the "look-back" feature). The look-back can make the discount and therefore the compensation income larger. Check your plan document or the Form 3922 your employer should have issued — it shows both dates and both FMV figures.

Form 3922 is the key document here. The IRS requires companies to issue it for each ESPP purchase. It has the grant date FMV, the exercise date FMV, and the actual purchase price, which is exactly what you need for the basis calculation.

Omar R.

Author

I do have a Form 3922 — I didn't realize it had all three figures on it. That's what I've been missing to do the math.

Worth being clear on the Schedule D side too. After you do Form 8949 correctly with the adjusted basis, the net gain or loss flows to Schedule D. If this is a disqualifying disposition and short-term, it goes to Part I of Schedule D. The ordinary income piece you already recognized (via W-2) is not on Schedule D — only the remaining capital gain or loss after basis adjustment is.

Correct. People sometimes try to report the W-2 piece again on Schedule D which creates a double-count. The W-2 income is already in your gross wages on Form 1040 line 1a. The Schedule D piece is just whatever the sale proceeds differ from the adjusted basis.

I had three years of ESPP sales stacked up and uploaded all my 1099-Bs, W-2s, and Form 3922s to Taxr. It compared the basis reported on each 1099-B to the compensation amounts on the W-2s by lot, then prepared a worksheet showing the adjusted basis for each lot and the exact column (g) adjustment amounts I needed on Form 8949. I checked the numbers against my own records and they matched. Took me five minutes instead of an afternoon.

Three years of lots sounds like a nightmare to reconcile manually. Especially if any were sold at a loss and triggered wash sale questions.

If your plan has a 15% discount and a look-back provision, your compensation income at purchase can be meaningful even if the stock price didn't move much. Don't skip the Form 3922 reconciliation step thinking the discount was small.

For anyone who ended up with a loss on ESPP shares: even if the broker reports a wash sale disallowance in box 1g, you still have to report it. Per Publication 550 you can't deduct a wash sale loss even if it's not shown on the 1099-B. Use code W in column (f) of Form 8949 and enter the disallowed amount as a positive number in column (g).

The wash sale rule also applies if you enrolled in the next ESPP offering period and new shares were purchased within 30 days of the sale at a loss — those newly acquired shares in the same account could trigger the wash sale. Worth checking the purchase dates carefully.

State taxes can also be a factor — some states don't conform to federal ESPP treatment and may recognize income at a different point or use a different amount. The federal Form 8949 calculation we're discussing is strictly federal; check your state's instructions separately.

Omar R.

Author

I'm in a state with its own income tax so I should double-check. Good reminder.

Publication 525 and Publication 550 together cover basically all of this — the compensation income recognition rules are in Pub 525 and the capital gain holding period and wash sale rules are in Pub 550. The irs.gov pages for both are publicly available and free. Worth reading the ESPP-specific section in Pub 525 at least once so you understand why each number is what it is.

To summarize what the thread landed on: get your Form 3922, find the compensation income your employer already included in your W-2 for each lot, add it to your actual purchase price to get adjusted basis, then enter everything on Form 8949 with the right box checked and code B in column (f) if it's a covered security with wrong basis. The 1099-B proceeds always go in column (d) exactly as shown.

One correction: if the security is covered (box A or D on Form 8949), you enter the 1099-B's basis in column (e) as-is, then put the adjustment in column (g) as a negative number. You don't replace column (e) with the correct basis when box A or D is checked — that's only for uncovered securities (box B or E).

Omar R.

Author

That's the clearest the column (e) vs. column (g) distinction has been stated in this whole thread. That's exactly where I was going to go wrong. Thank you.