Cofiled
← All guides

W-2

Net investment income tax: the 3.8% nobody warned you about

Sell stock in a good year and a 3.8% tax can appear on top of capital gains. Who owes it, what counts, and a worked example in real dollars.

Updated October 2026 · 5 min read

Newspaper stock tables with a pen pointing at a price
The 3.8% hides in the fine print of a good year. · Pixabay

You sold some stock, you knew about capital gains tax, and then your return showed another 3.8% on top. That's the Net Investment Income Tax. It only reaches people above a certain income, which is why nobody mentions it until the year you cross the line.

Who owes it

You owe it if your modified adjusted gross income is over the threshold for your filing status, and you have investment income:

  • Single or head of household: $200,000.
  • Married filing jointly: $250,000.
  • Married filing separately: $125,000.

Like the Additional Medicare Tax, these lines are fixed in law and don't rise with inflation.

How much: the smaller of two numbers

The tax is 3.8% of whichever is smaller: your net investment income, or how far your income is over the threshold. Here's a single filer for 2025:

  • $230,000 of wages plus a $20,000 gain on stock. Income is $250,000, which is $50,000 over the $200,000 line.
  • Investment income is $20,000. That's the smaller number.
  • Tax: 3.8% of $20,000 = $760, on top of the capital gains tax.

If the same person had $195,000 of wages and the same $20,000 gain, they'd be only $15,000 over, so the tax is 3.8% of $15,000 = $570.

What counts, and what doesn't

  • Counts: interest, dividends, capital gains from stocks, funds, and crypto, rental income, and income from businesses you don't actively work in.
  • Doesn't count: wages, RSU and ESPP income already on your W-2, 401(k) and IRA withdrawals, tax-exempt municipal bond interest, and the part of a home-sale gain you get to exclude.
  • Wages still matter, though. They don't get taxed by the 3.8%, but they push your income over the line so your investment income does.

Ways to keep it smaller

  • Spread big sales across tax years so fewer dollars land in a year you're over the line.
  • Harvest losses. Capital losses offset gains before the 3.8% is figured.
  • Put more in pre-tax 401(k). It lowers the income side of the comparison.
  • Give appreciated stock to charity instead of selling it first.

No withholding

Nothing is withheld for this tax. If a big sale is coming, plan for the 3.8% in your withholding or an estimated payment, the same way you'd plan for the capital gains tax.

Upload the 1099s. We do Form 8960.

Send your W-2s and brokerage 1099s and we compute the whole return, the 3.8% included, and show you exactly which dollars it hit. $99 flat for the print-ready forms, and you sign and mail it.

Start my return, free →