Do You Pay Medicare Tax on Capital Gains? The 3.8% NIIT Explained

You do not pay the regular Medicare payroll tax on capital gains. Wages and self-employment earnings carry the 1.45% Medicare tax (and a 0.9% surtax above certain income levels), but selling stocks, bonds, mutual funds, or investment real estate does not trigger either one.1Internal Revenue Service. Topic No. 751, Social Security and Medicare Withholding Rates What higher-income investors do owe is a separate 3.8% Net Investment Income Tax, which reaches capital gains once your modified adjusted gross income crosses $200,000 for a single filer or $250,000 for a married couple filing jointly.2Internal Revenue Service. Topic No. 559, Net Investment Income Tax

Why Capital Gains Skip the Medicare Payroll Tax

The Federal Insurance Contributions Act funds Medicare and Social Security by taxing compensation for work. Employees pay 1.45% of wages toward Medicare’s Hospital Insurance trust fund, employers match it, and self-employed workers pay the full combined 2.9% themselves under SECA.3Office of the Law Revision Counsel. 26 USC 3101 – Rate of Tax

Investment profits are not compensation for work, so they sit outside this system entirely. A $500 stock sale and a $5 million stock sale generate the same Medicare payroll tax: zero.

The 0.9% Additional Medicare Tax that applies to wages and self-employment income above $200,000 single or $250,000 joint follows the same logic. It also does not reach capital gains or other investment income.4Internal Revenue Service. Questions and Answers for the Additional Medicare Tax The tax that actually reaches investment income is a different one.

The 3.8% Net Investment Income Tax

The Net Investment Income Tax, or NIIT, is a 3.8% surcharge on certain investment income, enacted in 2010 as part of the Affordable Care Act. It applies to individuals, estates, and trusts whose income exceeds specific thresholds.2Internal Revenue Service. Topic No. 559, Net Investment Income Tax Structurally it sits outside FICA. FICA taxes land on your paycheck; the NIIT lands on your tax return. No dollar of income is subject to both.

The 3.8% stacks on top of whatever capital gains rate you already owe. Long-term capital gains rates run 0%, 15%, or 20% depending on taxable income, so a high-income investor in the 20% bracket faces a combined federal rate of 23.8% on those gains. Short-term gains, taxed as ordinary income, can be layered with the 3.8% as well.

The thresholds are not indexed for inflation and have stayed at the same dollar amounts since 2013.5Internal Revenue Service. Questions and Answers on the Net Investment Income Tax More households cross them each year as incomes rise.

How the NIIT Is Calculated

The NIIT only applies when your Modified Adjusted Gross Income exceeds the threshold for your filing status. MAGI is generally your Adjusted Gross Income plus any foreign earned income you excluded. The thresholds are:

  • Single or head of household: $200,000
  • Married filing jointly or qualifying surviving spouse: $250,000
  • Married filing separately: $125,000
2Internal Revenue Service. Topic No. 559, Net Investment Income Tax

The tax is 3.8% of the lesser of two numbers: your total net investment income, or the amount by which your MAGI exceeds your threshold. That “lesser of” rule is the whole calculation.

Take a single filer with $210,000 MAGI and $30,000 in net investment income. MAGI exceeds the threshold by $10,000; net investment income is $30,000. The tax runs on the smaller figure: $10,000 times 3.8% equals $380.

Now a married couple filing jointly with $300,000 MAGI and $15,000 in net investment income. Their MAGI exceeds $250,000 by $50,000, but investment income is only $15,000. The tax applies to $15,000, producing $570.6Office of the Law Revision Counsel. 26 USC 1411 – Imposition of Tax

If MAGI stays below the threshold, you owe no NIIT no matter how large the investment income. And if MAGI is very high but you have no investment income, the NIIT is still zero. Both pieces have to be present.

What Investment Income Is Covered

Net investment income includes interest, dividends, annuities, royalties, rents, income from passive business activities, and gains from selling property not held in an active business.6Office of the Law Revision Counsel. 26 USC 1411 – Imposition of Tax Both short-term and long-term capital gains sit inside this definition.

For capital gains, the tax reaches profits from selling stocks, mutual funds, bonds, and investment real estate. It also covers gains from selling a partnership interest or S-corporation shares if you were a passive investor rather than an active participant.

You can reduce gross investment income by deductions properly tied to producing that income, such as investment interest expense and state and local taxes allocable to investment income.7Internal Revenue Service. 2025 Instructions for Form 8960 Investment advisory fees and other miscellaneous itemized deductions cannot reduce the base; that disallowance was made permanent by 2025 legislation.

Income Carved Out of the NIIT

Several categories of income are excluded even when you are well above the thresholds.

Distributions from qualified retirement plans do not count as net investment income. That covers 401(k) plans, traditional and Roth IRAs, 403(b) plans, and 457(b) plans, even when the distribution consists mostly of decades of accumulated gains.6Office of the Law Revision Counsel. 26 USC 1411 – Imposition of Tax Holding investments inside retirement accounts is a meaningful advantage for high earners on this specific tax.

Tax-exempt interest from municipal bonds is also excluded from net investment income.5Internal Revenue Service. Questions and Answers on the Net Investment Income Tax Note, though, that muni interest can still push your MAGI above the threshold, exposing other investment income to the tax.

Income from an active trade or business is excluded because it is already subject to FICA or self-employment tax. The NIIT targets passive investment income that would otherwise escape payroll-style taxation.

Gain from selling your primary residence is excluded up to the standard home sale limits: $250,000 for a single filer or $500,000 for a married couple filing jointly.5Internal Revenue Service. Questions and Answers on the Net Investment Income Tax Only gain above those limits enters the NIIT calculation, so for most homeowners a home sale produces no NIIT at all.8Internal Revenue Service. Topic No. 701, Sale of Your Home

Ways to Reduce What You Owe

Because the tax hinges on two variables, net investment income and MAGI, shrinking either one shrinks the tax.

Harvesting capital losses is the most direct move. Selling losing positions offsets gains dollar for dollar, cutting net investment income. If losses exceed gains for the year, you can deduct up to $3,000 of the excess against ordinary income and carry the rest forward.9Internal Revenue Service. Topic No. 409, Capital Gains and Losses Spreading large gain realizations across multiple tax years, rather than bunching them, can also keep MAGI below the threshold.

Maximizing contributions to tax-deferred retirement accounts lowers AGI, which lowers MAGI. Gains inside those accounts also stay outside net investment income when eventually distributed.

Charitable giving works on both sides of the equation. Donating appreciated stock directly to a charity or donor-advised fund avoids recognizing the gain at all, while the deduction can reduce MAGI.

Real estate investors who materially participate in managing properties may fall outside the passive rental category for NIIT purposes, though the qualifying rules are strict.

Reporting the NIIT and Paying It

You report the NIIT on IRS Form 8960, which walks through the net investment income calculation, applies the threshold comparison, and produces the tax figure that flows onto Form 1040.10Internal Revenue Service. Net Investment Income Tax Any individual, estate, or trust that owes the 3.8% must file it.11Internal Revenue Service. Form 8960 – Net Investment Income Tax

Nothing gets withheld from investment income the way Medicare tax comes out of wages. If you expect to owe the NIIT, plan on quarterly estimated tax payments. The IRS generally requires them once you expect to owe $1,000 or more in total tax after withholding and credits.12Internal Revenue Service. Estimated Tax – Individuals

If a large gain hits early in the year, adjust that quarter’s payment rather than waiting. Underpayment penalties are calculated quarter by quarter, so a January stock sale left alone until the April estimated payment can still draw a first-quarter penalty.13Internal Revenue Service. Topic No. 306, Penalty for Underpayment of Estimated Tax