The 3.8% surtax that finds your gains after the IRS already has
The net investment income tax hits retirees who sell a house, a rental or a big stock position in one year. Here's how it works and how to stay under it.

Quick answer: The net investment income tax (NIIT) is 3.8% on the smaller of your investment income or the amount your modified adjusted gross income (MAGI) runs over a threshold. As of this writing the thresholds are $250,000 for married couples filing jointly and $200,000 for single filers. Keep your income under the line in the years you sell, and the tax never shows up.
It isn't double taxation, but it feels like it
You sell a stock you've held for fifteen years. You pay capital gains tax. Then Form 8960 arrives and you owe another 3.8% on the same gain.
Technically that's a second tax, not the same tax twice. The NIIT is a separate surtax that sits on top of regular capital gains tax. It was created in 2013 to fund Medicare, and it hits investment income. It doesn't care that you're retired.
One detail makes it sneakier every year. The thresholds were never indexed for inflation. A line drawn in 2013 catches more households each year as incomes drift up. Check IRS.gov for the current numbers, because Congress can change them.
What counts as investment income
Plenty of retirees assume the tax only touches stock sales. It reaches further.
Counts as net investment income:
- Interest and dividends
- Capital gains from stocks, funds and other investments
- Rental and royalty income, in most cases
- Gains on a second home or investment property
- The taxable part of non-qualified annuity payouts
- Gain on your main home above the $250,000 or $500,000 exclusion
Doesn't count:
- Social Security benefits
- Pension payments
- Withdrawals from a traditional IRA or 401(k)
- Wages and self-employment income
- Tax-exempt municipal bond interest
That second list has a catch, and it's the one that trips up careful savers.
Your IRA withdrawals aren't taxed, but they raise the bar
IRA and 401(k) distributions aren't investment income. They do count toward MAGI. So a big withdrawal can push you over the threshold, and then your ordinary dividends and gains become exposed to the 3.8%.
The IRA money isn't taxed by the NIIT. It just pulls the rest of your portfolio into range.
Roth conversions work the same way. The converted amount isn't NII, but it raises MAGI in the year you do it. We covered the sequencing question in Which Retirement Account To Spend From First. The NIIT is one more reason that order matters.
The "lesser of" math, with a worked example
People overpay worrying about this tax because they think it applies to every dollar of gain. It doesn't. You pay 3.8% on the lesser of two numbers:
- Your net investment income, or
- Your MAGI minus the threshold.
Example, for illustration only. A married couple filing jointly has $200,000 of MAGI before any sale. That includes $20,000 of interest and dividends. They sell a rental property and book an $80,000 gain in one year.
- MAGI becomes $280,000.
- Over the $250,000 threshold by $30,000.
- Net investment income is $100,000 ($20,000 plus $80,000).
- The lesser number is $30,000.
- NIIT: 3.8% of $30,000, or $1,140.
Now suppose they structure the sale as an installment sale, taking $40,000 of gain this year and $40,000 next year. MAGI is about $240,000 each year. That's under the line, and the NIIT is $0. They saved $1,140 with nothing more than timing. Their regular capital gains tax is a separate calculation and still applies.
That's a simplified example. Real returns have deductions, other adjustments and state tax. A CPA can run your actual numbers in an hour.
Five ways to stay under the line
Planning to pay less tax within the law is sensible. You earned the money, so keep what the rules allow.
Spread the gain. If you control when a big sale happens, break it across two or three tax years. Installment sales on real estate do this by design. With stocks, sell in pieces over several Januaries and Decembers.
Harvest losses. Losses on other positions offset gains and shrink your net investment income. Mind the wash-sale rule, which disallows a loss if you buy the same security back within thirty days.
Do Roth conversions in the low years. The gap between retiring and starting Social Security and required distributions is often your lowest-income stretch. Convert there, not in the year you also sell the lake cabin. Converting early also shrinks the future required distributions that raise MAGI later.
Use qualified charitable distributions. If you're 70½ or older and give to charity anyway, sending money straight from your IRA to the charity keeps that amount out of your income. It can also count toward your required minimum distribution. Annual limits apply, so check IRS.gov.
Put the right assets in the right accounts. Bonds and other high-interest holdings fit best inside tax-deferred accounts, where their interest doesn't land on your return each year. Growth-oriented funds that you plan to hold work well in taxable accounts. Municipal bond interest stays out of NII too, though whether munis make sense depends on your bracket. Ask your adviser.
Selling the house is the big one
The home sale exclusion lets most couples shield up to $500,000 of gain on a main home, and singles up to $250,000. Gain above that is net investment income.
A couple who bought in 1995 for $180,000 and sell for $950,000 has a $770,000 gain. Take the $500,000 exclusion and $270,000 remains. That's taxable and exposed to the NIIT, which at that size will likely be significant.
If that sounds like you, plan the sale years ahead. Keep records of improvements that raise your cost basis, such as a new roof, an addition or a finished basement. And if you're weighing a move, read What to Check Before You Retire to a Small Town before the listing goes up, not after.
Don't forget the Medicare cousin
The NIIT isn't the only threshold watching your income. Medicare Part B and D premiums rise in steps through the income-related monthly adjustment amount, known as IRMAA. It's based on your MAGI from two years earlier, and the steps are cliffs. One extra dollar can cost you hundreds in annual premiums.
A big gain this year can raise your Medicare bill two years from now. Check Medicare.gov and SSA.gov for the current brackets, and look at both tax and premiums before you sell.
Annuity income is a related trap. Non-qualified annuity gains count as investment income when paid out. If someone is pitching you one, What to Ask Before You Sign an Annuity Contract covers the questions to put on the table first.
Before you act
This is general education, not individual tax or financial advice. Thresholds, rates and rules change, and your situation has details this piece can't see. The IRS explains the tax at IRS.gov (look for Topic No. 559 and Form 8960).
Before any large sale, conversion or withdrawal plan, sit down with a CPA or a fee-only fiduciary adviser. Bring last year's return and a list of what you might sell in the next three years. An hour of that conversation costs a few hundred dollars. It can easily save you more than that on a single sale.
Ray Okonkwo
Money & Business
Former commercial banker turned small-business owner. Covers salary, credit, margins and the arithmetic nobody does before signing.
Watch
Worth an hour of your evening
More from Retirement.
From channels we rate. Plays on YouTube.
Read next
