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.

Abstract editorial illustration for a finance article about the 3.8% Net Investment Income Tax and tax-loss harvesting as a NIIT reduction strategy. Two horizontal computational layers are stacked: a wide electric blue lower band represents the standard capital gains rate, and a narrower coral-accented upper band represents the 3.8% surtax surcharge layer. A bold gold downward-curving arrow crosses both layers, symbolizing harvested losses reducing the combined tax burden. Abstract blue portfolio tokens arranged in a column on the left represent capital gain positions. On the right a reduced smaller column suggests net investment income after the offset. Off-white background, flat-vector fintech editorial style, minimal and premium.
The 3.8% NIIT surcharge under IRC §1411 may run alongside the regular preferential capital gains rate for investors whose MAGI exceeds the applicable threshold — and because the NIIT applies to net investment income, harvested losses that offset capital gains can reduce this second computation directly.

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.

SINGLE FILER approx. $200,000 MAGI threshold — not inflation-adjusted since enactment in 2013 MFS filer threshold approx. $125,000 MARRIED FILING JOINTLY approx. $250,000 MAGI threshold — not inflation-adjusted since enactment in 2013 both spouses' combined income counted
The NIIT may apply to single filers with MAGI above approximately $200,000 and married-filing-jointly filers with MAGI above approximately $250,000 — thresholds that have not been adjusted for inflation since 2013. Because investment gains and rising account values have outpaced the fixed thresholds, the number of investors potentially subject to the surcharge has grown since enactment.

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.

INCLUDED IN NII capital gains (long-term and short-term) dividends interest income passive rental income annuity income royalties capital losses reduce NII directly via Regulation §1.1411-4(f) NOT IN NII wages and salaries active business income IRA and 401(k) distributions Roth conversions Social Security benefits self-employment income these income types are outside the NIIT base entirely
Under IRC §1411 and Regulation §1.1411-4, net investment income may include capital gains, dividends, interest, passive rents, and royalties — but not wages, active business income, qualified retirement plan distributions, Roth conversions, or Social Security benefits. Tax-loss harvesting directly reduces the capital gain component of NII and therefore the potential NIIT base.

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.

Abstract illustration showing tax-loss harvesting reducing the Net Investment Income Tax base. On the left, a tall column of stacked electric blue rectangular tokens represents gross capital gains subject to NIIT. A gold filter or sieve element in the center catches and neutralizes coral-tinted loss markers from the token column, representing harvested losses being applied against gains. On the right, a shorter reduced column of blue tokens represents the smaller net investment income base remaining after the offset. A subtle gold downward arrow connects the tall left stack to the shorter right stack. Flat vector pipeline metaphor, electric blue and gold dominant, coral accents for loss markers only, off-white background.
Harvested capital losses directly reduce the net investment income base under Regulation §1.1411-4(f) — potentially producing a combined benefit of up to approximately 23.8% per dollar of long-term gain offset (approximately 20% regular rate plus the approximately 3.8% NIIT) for investors subject to both computations at the top rate.

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.

MAGI EXCEEDS THRESHOLD surcharge may apply two computations required TOTAL NII net investment income capital gains minus harvested losses plus dividends, interest, rents MAGI EXCESS MAGI minus threshold approx. $200K / $250K threshold depending on filing status NIIT BASE lesser of the two 3.8% rate applies here floor at zero — not negative
The NIIT applies to the lesser of total net investment income or the excess of MAGI over the applicable threshold. For investors substantially above the threshold, the MAGI excess floor may consistently exceed NII — meaning harvested losses that reduce NII can reduce the NIIT base dollar-for-dollar. Investors near the threshold may find that even modest NII reductions eliminate the surcharge entirely for the year.

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.

A hypothetical 5-year scenario. Drag the slider to adjust the annual harvest rate. The solid blue bar shows net investment income potentially subject to NIIT after applying harvested losses. The coral overlay shows losses applied each year. The gold dashed line tracks any carryforward balance — prior-year excess losses that may reduce NII in the year they are used. Year 5 represents a large capital gain event; prior harvesting may reduce the NIIT base in that event year.

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