Net Investment Income Tax (NIIT): Tracking the 3.8% Surtax in Beancount

If you’re a high earner with investment income, you’re probably paying the 3.8% Net Investment Income Tax (NIIT) - and it can add up fast. Here’s how to track and plan for it.

2026 NIIT Thresholds

Filing Status MAGI Threshold
Single $200,000
MFJ $250,000
MFS $125,000
HOH $200,000

Important: These thresholds are NOT inflation-adjusted. They’ve been the same since 2013, meaning more people hit them every year.

How NIIT is Calculated

NIIT = 3.8% × min(Net Investment Income, MAGI - Threshold)

My Beancount NIIT Tracking Structure

; Investment income accounts (subject to NIIT)
2020-01-01 open Income:Investment:Dividends USD
2020-01-01 open Income:Investment:Interest USD
2020-01-01 open Income:Investment:CapGains:LongTerm USD
2020-01-01 open Income:Investment:CapGains:ShortTerm USD
2020-01-01 open Income:Investment:Rental USD

; Track NIIT separately
2020-01-01 open Expenses:Taxes:NIIT USD

Tagging Investment Income

2026-06-15 * "Vanguard" "VTSAX qualified dividend"
  Assets:Brokerage:Cash    500.00 USD
  Income:Investment:Dividends    -500.00 USD
    niit-applicable: TRUE
    dividend-type: "qualified"

NIIT Liability Estimate Query

SELECT 
  sum(position) as net_investment_income
WHERE account ~ 'Income:Investment'
  AND meta('niit-applicable') = TRUE
  AND year = 2026

Then calculate: if (NII > 0 AND MAGI > threshold): NIIT = 3.8% × min(NII, MAGI - threshold)

Questions:

  1. How do you estimate NIIT for quarterly estimated payments?
  2. Anyone tracking rental real estate NIIT exceptions?

The NIIT really stings when you have a big capital gains year. For quarterly estimates, I use this approach:

Quarterly NIIT Estimation

; Track estimated payments including NIIT component
2026-04-15 * "IRS" "Q1 estimated tax payment"
  Expenses:Taxes:Federal:Estimated    15000.00 USD
  Expenses:Taxes:NIIT:Estimated    1900.00 USD  ; 3.8% of projected NII
  Assets:Checking    -16900.00 USD
    quarter: "Q1-2026"
    projected-magi: 300000.00
    projected-nii: 50000.00

Year-End True-Up Query

SELECT 
  'Projected' as type,
  sum(position) as amount
WHERE account = 'Expenses:Taxes:NIIT:Estimated'
  AND year = 2026

UNION

SELECT 
  'Actual NII' as type,
  sum(position) * 0.038 as amount
WHERE account ~ 'Income:Investment'
  AND year = 2026

NIIT Planning Strategies

Ways to reduce NIIT exposure:

  1. Muni bonds: Interest is exempt from NIIT
  2. Tax-loss harvesting: Reduces net investment income
  3. Defer gains: Hold appreciated assets longer
  4. Maximize retirement contributions: Reduces MAGI
; Muni bond interest - NOT subject to NIIT
2026-07-01 * "Vanguard" "VTEAX tax-exempt interest"
  Assets:Brokerage:Cash    200.00 USD
  Income:Investment:Interest:TaxExempt    -200.00 USD
    niit-applicable: FALSE
    reason: "Municipal bond interest exempt"

For the rental real estate question - there IS an exception, but it’s harder to qualify for than most people think.

Real Estate Professional Exception

Rental income is exempt from NIIT IF you qualify as a “real estate professional”:

  1. More than 750 hours/year in real estate activities
  2. More than 50% of your working time in real estate
  3. Material participation in each rental property

Tracking for the Exception

; Real estate activity hours log
2026-01-15 custom "re-professional-hours" "Weekly log"
  property: "123 Main St"
  hours: 8.5
  activities: "Tenant screening, maintenance coordination"
  
; Running total query needed for Form 8960 Part II

Form 8960 Data Requirements

Form 8960 reports your NIIT. Your Beancount data should support:

-- Line 5a: Taxable interest
SELECT sum(position)
WHERE account ~ 'Income:Investment:Interest'
  AND meta('niit-applicable') = TRUE
  AND year = 2026

-- Line 5b: Ordinary dividends  
SELECT sum(position)
WHERE account ~ 'Income:Investment:Dividends'
  AND year = 2026

-- Line 5d: Net capital gains
SELECT sum(position)
WHERE account ~ 'Income:Investment:CapGains'
  AND year = 2026

Estate/Trust Planning Alert

Trusts hit the NIIT threshold at just $16,000 of AGI! If you’re using trusts for estate planning, this matters significantly. Consider distributing income to beneficiaries (in lower brackets) rather than accumulating.

I hit NIIT for the first time after a large stock sale. Here’s what I learned the hard way:

The “Bunching” Problem

If you have a big one-time gain (selling a business, concentrated stock position, etc.), you’ll pay NIIT on ALL of it - there’s no averaging.

My mistake: Sold $200k of ESPP stock in one year. Could have spread it over 2-3 years to minimize NIIT exposure.

Planning Dashboard

I now track my proximity to the NIIT threshold throughout the year:

; Monthly MAGI checkpoint
2026-06-30 custom "niit-checkpoint" "Mid-year review"
  ytd-salary: 150000.00
  ytd-investment-income: 35000.00
  projected-annual-magi: 340000.00
  niit-exposure: 90000.00  ; MAGI - 250k threshold
  estimated-niit: 1330.00  ; 3.8% of min(35k, 90k)

The “Just Under” Strategy

If you’re close to the threshold, it’s worth doing the math on staying under. Example:

  • MAGI projected: $260,000 (MFJ)
  • Investment income: $30,000
  • NIIT if over threshold: 3.8% × $10,000 = $380

That $380 might be worth deferring a $10k capital gain to next year, especially if you expect lower income then.

Query: NIIT Breakeven

SELECT 
  250000 - sum(position) as room_to_threshold
WHERE account ~ 'Income'
  AND year = 2026

If this number is positive and your investment income is controllable (you can choose when to realize gains), you have planning opportunities!