The household

A working married couple, both under 65, file jointly in a state with no income tax. They earn $300,000 of wages and contribute $8,750 to a health savings account. Their investments pay $5,000 of interest and $20,000 of qualified dividends, and they sell shares at a $40,000 long-term gain. One spouse also receives Social Security benefits (disability benefits, for instance), of which $30,000 is taxable and $5,294 is not. The same arithmetic applies to a retired couple with a large pension or required distributions in place of the wages.

These inputs are one of the hand-computed cases in the simulator’s test suite. The page runs them through the same tax function the simulator uses each time it is built, and the test suite checks the results against the hand calculation, so the figures here and the simulator’s cannot drift apart.

The return, line by line

The net investment income tax is 3.8% of the smaller of two amounts: net investment income (interest, dividends, gains) and modified AGI over a fixed threshold, $250,000 on a joint return[1]. The threshold is written in the statute and is not indexed, so more households reach it every year.

Federal tax, 2026, married filing jointly
LineRule appliedAmount
Wages$300,000
Taxable part of Social Security$30,000
Interest$5,000
Qualified dividends$20,000
Long-term capital gains$40,000
Less HSA contribution deduction−$8,750
Adjusted gross income (AGI)$386,250
Less standard deduction (married filing jointly)Standard deduction, 2026−$32,200
Taxable ordinary income$294,050
Taxable qualified dividends and gains$60,000
10% on $24,800 of ordinary income2026 brackets (married filing jointly)$2,480
12% on $76,000 of ordinary income2026 brackets (married filing jointly)$9,120
22% on $110,600 of ordinary income2026 brackets (married filing jointly)$24,332
24% on $82,650 of ordinary income2026 brackets (married filing jointly)$19,836
Tax on ordinary income$55,768
15% on $60,000 of dividends and gainsCapital-gains bands, stacked on top of ordinary income$9,000
Tax on dividends and gains$9,000
Net investment income tax: 3.8% of the smaller of $65,000 investment income and $136,250 of AGI over $250,000NIIT threshold (not indexed) and rate$2,470
Federal income tax$67,238

What to notice

  • AGI is $386,250, $136,250 over the line, which is more than the $65,000 of investment income, so the tax applies to all of the investment income: $2,470.
  • Wages are not investment income, but they still count toward AGI and so decide how much of the investment income is exposed.
  • The gains and dividends are taxed at 15% on top of ordinary income in the 24% bracket[2], so with NIIT each dollar of gain costs 18.8%.
  • The HSA contribution lowers AGI by $8,750, and so lowers the excess, but here the excess is still larger than the investment income.

What would change this

  • $20,000 more in gains raises NIIT to $3,230 and total federal tax to $70,998, $3,760 more.
  • Wages of $196,250 would leave only $32,500 over the line, less than the investment income, so NIIT would fall to $1,235.
  • Wages of $163,749 put AGI at $249,999, under the line: no NIIT at all, with the same investment income.
  • Distributions from traditional IRAs and 401(k)s are not investment income, but they raise AGI the same way wages do[1].

See it over a full plan

Load a demo plan with large taxable gains and conversions and see the years the 3.8% tax applies. Open it in the simulator →

If you already have a saved plan, the link only takes you to the right panel; your plan is not changed.

These examples show how the rules work. They are not financial, tax or investment advice. Real returns have details these examples leave out, so check the IRS instructions or ask a tax professional before you act. See the disclaimer.

Sources

Every threshold, rate and amount above is a figure the simulator uses. The sources page lists each one with its official source and the date we checked it, and the rule links in the tables go to the matching entry there.