For most taxable investors, capital gains sit under one federal rate: the preferential long-term rate that has historically been 0%, 15%, or 20% depending on income. For investors whose modified adjusted gross income crosses a second threshold, a surcharge runs alongside it: the 3.8% Net Investment Income Tax under IRC §1411.

The interaction with tax-loss harvesting is direct. Because the NIIT applies to net investment income, harvested capital losses that offset gains reduce the NIIT base dollar-for-dollar. That means a harvest may produce a second layer of tax benefit — on top of the reduction in regular capital gains tax — that is often overlooked when the two computations are evaluated separately.

What is the 3.8% Net Investment Income Tax?

What is the 3.8% Net Investment Income Tax, and which investors may owe it under current law?

The NIIT is a surtax under IRC §1411, enacted as part of the Affordable Care Act, that may apply to taxpayers whose modified adjusted gross income exceeds approximately $200,000 for single filers or approximately $250,000 for married filing jointly — thresholds that have not been indexed for inflation since the tax took effect in 2013.

The NIIT was enacted to fund Medicare expansion and applies to tax years beginning after December 31, 2012. It applies at a rate of 3.8% on the lesser of two amounts: the taxpayer's net investment income for the year, or the excess of their modified adjusted gross income over the applicable threshold. The threshold for married-filing-separately filers may be approximately $125,000, also not inflation-adjusted.

Because the thresholds have remained fixed since enactment, the population of investors potentially subject to the NIIT has grown as incomes and portfolio values have increased. Investors with significant equity compensation, large investment portfolios, or rental income may encounter the surcharge more frequently than the original enactment intended. For these taxpayers, understanding how harvested losses interact with the NIIT computation may change the economics of a harvest in ways a simpler rate-times-gain calculation would miss.

What counts as net investment income under IRC §1411?

What types of income and gains are included in the net investment income base for the 3.8% surcharge?

Under IRC §1411 and Regulation §1.1411-4, net investment income may include interest, dividends, annuity income, rents from passive activities, royalties, and capital gains — both long-term and short-term — from the disposition of property held for investment, but specifically excludes wages, salaries, active business income, and distributions from qualified retirement plans including IRAs and 401(k)s.

The NII computation starts with gross investment income across those categories and subtracts allowable deductions — including capital losses from the disposition of investment property. This deduction of capital losses is the mechanism through which tax-loss harvesting directly reduces the NIIT base.

Several exclusions are worth noting. Retirement plan distributions, whether from a traditional IRA or a 401(k), are not net investment income — they are ordinary income. A Roth conversion is similarly excluded from NII while remaining subject to regular income tax. Social Security benefits are excluded. Wages and active self-employment income are excluded. The NIIT is fundamentally a tax on passive investment returns, which is why capital loss harvesting — which directly reduces passive capital gain income — is a particularly effective tool against it.

For a foundation on how the broader tax picture layers together, see tax alpha explained and TLH 101.

How harvested losses reduce NIIT exposure

Can tax-loss harvesting reduce the 3.8% NIIT surcharge, not just regular capital gains taxes?

Yes — harvested capital losses that offset capital gains reduce net investment income directly under Regulation §1.1411-4(f), which can lower the NIIT base and may reduce the 3.8% surcharge on the offset portion, effectively adding the NIIT rate on top of the regular capital gains rate benefit for each harvested dollar.

If harvested losses fully offset all capital gains, the net gain component of NII may fall to zero — eliminating the NIIT on capital gain income for that year entirely. Losses cannot produce a negative NII figure; the floor is zero.

The combined marginal benefit per dollar of harvested loss for a taxpayer subject to both the top long-term capital gains rate and the NIIT may be up to approximately 23.8%: the approximately 20% top preferential long-term rate plus the approximately 3.8% surcharge. For short-term capital gains taxed as ordinary income, the combined rate under the top regular rate and NIIT may be up to approximately 40.8%. Many investors who are subject to the NIIT find the combined rate material enough to shift harvest-or-hold decisions compared to a pre-NIIT calculation.

An important distinction: harvested losses offset investment income for NIIT purposes in the year they are realized and applied. They do not reduce the ordinary income from wages, the conversion amount in a Roth conversion, or other non-NII income — those remain outside the NIIT base entirely. For how TLH interacts with Roth conversions in the same year, see Roth conversions and TLH.

How the MAGI threshold and NIIT calculation work

Does the 3.8% NIIT apply to all net investment income once the MAGI threshold is crossed, or only to income above the threshold?

The NIIT applies to the lesser of (1) total net investment income or (2) the excess of MAGI over the applicable threshold — so investors whose MAGI just clears the threshold may owe NIIT only on a small slice of their investment income, while investors substantially above the threshold may owe NIIT on their entire NII figure.

This two-part minimum calculation produces a meaningful planning range. For investors near the threshold, harvesting losses may push NII below the MAGI excess — potentially reducing the NIIT base to zero even while MAGI remains above the threshold, because the NII component is smaller. For investors whose MAGI runs well above the threshold every year, the MAGI-excess floor is consistently higher than NII, and the NIIT may apply to total NII. In those cases, every dollar of NII reduction from harvesting can produce approximately $0.038 of direct NIIT savings.

Capital gains events from concentrated stock liquidation, property sales, or large rebalancing trades can significantly affect MAGI in the year they occur — sometimes pushing an investor whose regular income sits just below the threshold well above it. Harvesting losses to offset those gains may reduce NII and potentially reduce NIIT exposure in those event years. The zero-tax exit strategy article discusses how a multi-year loss bank can be deployed strategically around large capital gain events.

Capital loss carryforwards and multi-year NIIT planning

How do capital loss carryforwards interact with the NIIT across multiple tax years?

Capital losses that exceed capital gains in the current year may be carried forward indefinitely under IRC §1212 and can reduce net capital gains — and therefore net investment income — in future years when applied, potentially reducing NIIT in those future years as well.

A carryforward loss does not reduce NIIT in the year it is generated — it reduces the net gain component of NII in the year it is used. But investors who build a carryforward loss bank through active harvesting in years with few realized gains may be positioning themselves to offset a large future gain event without a corresponding NIIT bill in that event year.

This pattern can be particularly relevant for investors holding concentrated appreciated stock positions. Harvesting losses in other parts of the portfolio across multiple years may accumulate a carryforward that partially or fully offsets NII from a concentrated position liquidation — reducing the NIIT on that event in addition to regular capital gains taxes. The harvest decisions in earlier years, which may seem modest individually, can compound into meaningful NIIT protection in the event year.

HarvestEngine's loss tracking maintains per-lot realized-loss records and surfaces the current carryforward balance, which feeds into the harvest opportunity analysis. For a broader look at the relevant code sections, see the IRS code cheat sheet on IRC §1212 carryforward rules.

Read this next with capital loss carryforwards, Roth conversions and TLH, the AMT and TLH, IRMAA and Medicare surcharges, tax alpha explained, the zero-tax exit strategy, and the IRS code cheat sheet.

See the harvest engine in action