How to calculate cost basis for company stock reported as W-2 income and 1099-B

Sold my ESPP shares this year and my broker's 1099-B shows a cost basis that is way lower than what I actually paid effectively. I know the discount portion showed up as ordinary income on my W-2, but I have no idea how to calculate cost basis for company stock reported as W-2 income 1099-B style when both forms seem to be telling a different story. I've compared the numbers manually but can't reconcile them. My broker shows the purchase price only as basis, with no adjustment for the income already taxed. If I just enter what's on the 1099-B into Form 8949 without fixing anything I'll be paying tax on that same income twice. How do I figure out the correct adjusted basis and where exactly do I enter the adjustment on the return?

31 comments

Did your broker check box 12 on the 1099-B indicating basis was reported to the IRS, or did they leave it unchecked? That changes which box you check on Form 8949 and how you enter the correction.

Maya B.

Author

It says basis was reported to the IRS. So I assume that puts me in box A territory for Part I on Form 8949 since these were held less than a year.

ESPP double-taxation is one of the most common traps I see here. When the discount (or in a qualifying vs disqualifying disposition, the compensation element) hits your W-2, that amount gets added on top of your actual purchase price to form your true adjusted basis. I had Taxr read my 1099-B and my W-2 side by side at taxr.ai and it flagged exactly which dollar amount from the W-2 needed to go into column (g) of Form 8949 as a negative adjustment with code B, while column (e) kept the broker's figure. Saved me from leaving the broker's understated basis uncorrected and getting taxed twice. It listed each adjustment with the line reference so I could check it myself before filing.

Maya B.

Author

That's what I was worried about - the broker's column (e) number being too low. So the fix is leaving the broker's number in column (e) and putting the W-2 income piece in column (g) as a negative adjustment on Form 8949?

Roughly yes, but the mechanics depend on whether this is a qualifying or disqualifying disposition and how long you held the shares after purchase. Do you know which one you have?

Maya B.

Author

Disqualifying I believe - I sold within the holding period. The discount showed up on my W-2 as ordinary income from my employer.

In a disqualifying disposition the spread at purchase (fair market value minus your purchase price) is ordinary income on your W-2. That same amount is added to your basis. So correct basis = what you paid + the W-2 compensation amount. The gain or loss on Form 8949 is then just proceeds minus that corrected basis.

Is the W-2 compensation amount broken out somewhere or do you have to get it from your employer's stock plan records? My company never shows the ESPP piece separately on the W-2 itself.

Usually it's buried in box 1 along with everything else. Your broker or the plan administrator should have a supplement or cost basis statement that shows the compensation element per lot. That's the number you're reconciling against.

Stepping back - since the basis was reported to the IRS (box A, Form 8949 Part I), you check box A, then in column (e) you enter the basis the broker gave, NOT your corrected number. The correction goes in column (g) as a negative adjustment (in parentheses) because your true basis is higher than what the broker reported, so your gain is actually smaller. Code B in column (f) flags the correction.

Maya B.

Author

Wait so I don't just override column (e) with the right number? I have to enter what the broker put and then adjust in column (g)?

That's exactly the procedure. With box A checked on Form 8949, the instructions require entering the broker's reported basis in column (e) even when it is wrong, then using code B in column (f) and correcting the difference in column (g). A negative number in column (g) means your gain is reduced. See the Form 8949 instructions on irs.gov for the code B example.

Maya B.

Author

This makes sense now. So column (e) = broker's number, column (f) = B, column (g) = the W-2 compensation amount as a negative in parentheses.

Exactly right. The net across columns (d) minus (e) plus or minus (g) gives you the correct gain or loss that flows to Schedule D.

The tricky part is knowing whether your employer actually included the right compensation amount in W-2 box 1. I've seen cases where the company under-reports or the supplement uses a slightly different FMV calculation. I gave Taxr my W-2, my broker's cost basis supplement, and my Form 3922 from my employer and it compared all three figures, spotted a small discrepancy in the FMV used, and drafted a column (g) worksheet I could hand to my preparer. Really useful when multiple documents have to tie together.

Maya B.

Author

Form 3922 - I actually have one of those. I didn't know it was relevant here. It shows the FMV on the offering date and purchase date right?

Form 3922 is issued by your employer for ESPP shares. It records the grant date, the purchase date, the exercise price, and the FMV on those dates. That's exactly the data you need to verify whether the right compensation amount landed on your W-2 and to confirm your adjusted basis calculation.

Worth noting: if you had multiple purchase periods you likely have multiple lots, each with its own basis calculation and potentially its own holding period. Each lot is a separate line on Form 8949.

Maya B.

Author

I do have two purchase periods. So two separate rows on Form 8949, each with its own proceeds, broker basis, and column (g) adjustment?

Correct - each lot is separate. And the holding period clock for short-term vs long-term starts the day after the purchase date, with the sale date counting as part of the period. With two lots bought at different times your holding periods could differ, potentially splitting between Part I and Part II of Form 8949.

Are you sure the W-2 compensation element was included correctly? Have you compared the spread per share on Form 3922 times the number of shares to what shows up as the difference between box 1 and your base salary?

Maya B.

Author

Honestly no, I haven't done that cross-check yet. That's a good way to verify the W-2 included the right amount.

If after the correction on Form 8949 you still end up with a capital loss on the shares, the loss is deductible but keep the wash sale rules in mind if you bought more company shares in the ESPP within 30 days before or after the sale. A repurchase through the same ESPP could trigger a wash sale.

The wash sale window is 30 days on either side of the sale date. If the ESPP has a purchase date that falls inside that window the loss could be disallowed and the disallowed amount added to the new lot's basis instead.

Does the same logic apply for RSUs? I always assumed RSUs were cleaner but I've seen the same basis reporting gap there too.

RSUs work similarly - the FMV at vest is ordinary income on your W-2 and becomes your cost basis. If your broker only reports what they withheld or sold for taxes as basis, the rest of the vested value may be missing from column (e). Same fix: code B, column (g) negative adjustment when box D or A is checked.

One thing that gets missed: in a disqualifying disposition the full spread at purchase is ordinary income on your W-2 even if you sell the stock at a loss, and that spread still goes into your basis, so you can end up with ordinary income plus a capital loss. This is a nuance in the ESPP rules so worth confirming with a CPA if the numbers are large.

For anyone worried about getting this wrong on a large sale, an enrolled agent who handles equity compensation is worth the fee. The 1099-B basis issue on ESPP is well-known but the interaction with the W-2 and Form 3922 catches people off guard every year.

Maya B.

Author

Agreed. My sale wasn't enormous but I want to get the Form 8949 right before I file. The step-by-step in this thread has been exactly what I needed to reconcile the forms.

To confirm the final workflow: check box A on Form 8949 Part I, column (d) = proceeds from 1099-B, column (e) = broker's reported basis, column (f) = B, column (g) = the W-2 compensation element as a negative number in parentheses, column (h) = the corrected gain or loss. That flows to Schedule D line 1b.

The IRS instructions for Form 8949 at irs.gov walk through the code B column (g) example precisely this way. Publication 550 and Publication 525 also cover the basis and income treatment. Worth reading both before you finalize the numbers.