Does selling rental property with NIIT change order of investing pre-tax 401k NQDC?

Closing on a rental property next month, expecting a large long-term capital gain. I've been maxing my traditional 401k first, then putting whatever's left into my company's NQDC plan. My financial guy mentioned that the NIIT (net investment income tax) could interact weirdly with that strategy in the year of the sale — something about how the gain pushes modified AGI over the threshold and suddenly more income is exposed. I did some reading on the IRS digital assets page but that wasn't relevant. I couldn't find anything that addressed whether the NIIT exposure from a one-time property sale should flip the priority between pre-tax 401k contributions and NQDC deferrals for that year. Is there actual logic to changing the order, or does it not matter once the gain is already baked in?

32 comments

Schedule D and Form 8960 are where this plays out mechanically. The capital gain from the rental flows through Schedule D onto Form 1040 line 7a, which feeds into your MAGI for NIIT purposes on Form 8960. Pre-tax 401k contributions reduce your W-2 wages and therefore reduce MAGI, which can pull the number under or further under the NIIT threshold. NQDC deferrals also reduce current-year W-2 income but the interaction with NIIT depends entirely on whether you're already above the threshold after accounting for the gain.

Naomi J.

Author

So the 401k and NQDC both reduce the same thing — MAGI — just through the same channel? I was thinking they worked differently for NIIT.

Form 8960 line 13 is your modified adjusted gross income, and your net investment income from the rental gain sits on line 8 or thereabouts. The tax applies to the lesser of your net investment income or the amount by which your MAGI exceeds the threshold. So once the gain already pushes you far above the threshold, additional MAGI reductions (from either 401k or NQDC) only help if they can actually close the gap to the threshold.

That lesser-of calculation is the key thing people miss. If the gain is $400k and your wage income alone already clears the threshold, shifting $20k between 401k and NQDC isn't going to move Form 8960 at all.

Naomi J.

Author

This is making more sense. My gain is large enough that I think I'm going to be well above the threshold regardless. So the ordering question might be moot for NIIT specifically.

Worth separating what you're optimizing for. NIIT aside, pre-tax 401k contributions reduce current-year ordinary income dollar for dollar and have no deferral-of-distribution risk. NQDC deferrals also reduce current-year ordinary income but the deferred amount is an unsecured obligation of the company — it stays on their balance sheet. Those are very different risk profiles even if the MAGI effect is similar.

The company credit risk on NQDC is real and gets underappreciated. If the company hits trouble, that deferred compensation is a general creditor claim.

Form 8960 is the form I'd actually read line by line before making any deferral decisions. I uploaded mine along with my Schedule D to taxr.ai and had it walk through each line showing where the rental gain was feeding in and what my actual net investment income base was. It flagged that my MAGI was already so far above the threshold that only a very large 401k shift would change the NIIT calculation — which matched what I'd suspected but couldn't confirm on my own. The Form 8960 instructions on irs.gov lay out the MAGI definition clearly if you want to read it yourself first.

Naomi J.

Author

Did it work through the interplay with NQDC deferrals too, or just the 401k side? That two-variable piece is where I keep getting confused.

Both. I gave it my NQDC plan summary and it walked through how each hypothetical deferral amount shifted line 13 of Form 8960, separately from the Schedule D number. Made it concrete instead of theoretical.

One thing the NIIT calculation doesn't do: it doesn't care whether the income above the threshold is capital gain or wages. The tax is on the lesser of net investment income or excess MAGI. So your 401k contribution reduces MAGI but it doesn't reduce net investment income on Form 8960 lines 1 through 7. The rental gain stays in the net investment income bucket regardless.

Exactly right. The two inputs to Form 8960 are computed separately. Reducing wages via deferrals chips away at the MAGI excess side, not at the net investment income itself.

Publication 550 covers the investment income rules but doesn't go deep on NIIT — that's really Form 8960 and its instructions. The IRS topic page at irs.gov/taxtopics/tc409 handles capital gains but similarly doesn't map the NIIT interaction. For this specific combined question I'd pull the Form 8960 instructions and work through lines 13 and 14 with your actual projected numbers.

My situation last year had a rental sale plus I was already contributing max to a pre-tax 401k. The NIIT hit me anyway because the gain was just enormous relative to any deferral I could make. The 401k max did nothing for NIIT since I was already contributing it and was still hundreds of thousands over the threshold after.

Naomi J.

Author

That tracks with what others are saying here. If the gain is big enough, the ordering between 401k and NQDC is NIIT-neutral and you're really optimizing for other reasons.

Form 8960 line 14 shows the threshold amount for your filing status. The excess of line 13 over line 14 is one of the two numbers you're taking the lesser of. If you are married filing jointly, the threshold is a specific dollar figure listed right on that line of the form — check the current year Form 8960 for the exact number rather than relying on anything stated here, since it's set by statute and confirmed in the form instructions.

409A timing is real. The election window for a given year's compensation generally has to be in place before the year starts for existing participants. Missing it means you're looking at next year at the earliest for new deferrals.

Naomi J.

Author

I already have a deferral in place for this year — it was elected last year. I'm just deciding whether to increase it, but I see the point about the election timing.

Form 8960 line 13 shows the threshold amount for your filing status. The excess of line 14 over line 13 is one of the two numbers you're taking the lesser of. If you are married filing jointly, the threshold is a specific dollar figure listed right on that line of the form — check the current year Form 8960 for the exact number rather than relying on anything stated here, since it's set by statute and confirmed in the form instructions.

Form 8960 and my Schedule D from the rental sale were the two documents I dropped into Taxr last spring. It read them together and built a table showing what MAGI would be at different 401k and NQDC deferral combinations, and then mapped each scenario to the Form 8960 line 15 output. Really clarified that above a certain gain level the deferral order stops mattering for NIIT and you're just picking between accounts on other grounds. Worth doing if your gain is in that range.

Naomi J.

Author

A scenario table is exactly what I need. I've been trying to build one in a spreadsheet but I keep second-guessing which lines feed which.

Assuming you're asking about federal NIIT only — some states have their own investment income surtaxes that may interact differently with NQDC deferrals depending on how your state treats deferred compensation. That's a separate question from the federal Form 8960 calculation but could matter depending on where you live.

State treatment of NQDC at distribution is also worth checking. Some states tax it when paid out even if you've moved, though there are federal protections around that for certain plan types.

The practical order I'd follow: first figure out whether you're in the range where additional deferrals can actually move your Form 8960 line 15 at all. If the rental gain swamps the threshold by more than your maximum possible deferral, the NIIT question answers itself — it's neutral — and you're back to comparing 401k and NQDC on company credit risk, liquidity, state tax treatment, and expected tax rates at distribution.

Naomi J.

Author

That framing is helpful. NIIT optimization is probably irrelevant in my case and I should be focused on the other factors.

Right. For gains large enough that you can't deferral-plan your way under the threshold, the ordering question is really a retirement income question, not a NIIT question.

Publication 550 at irs.gov/publications/p550 covers the investment income and expense rules broadly including capital gains treatment. It doesn't map the NIIT calculation itself but it's worth having for understanding which income items count as investment income, which is the numerator side of the Form 8960 lesser-of calculation.

For the rental property sale specifically: make sure you've also addressed depreciation recapture on the property. That portion is taxed as ordinary income at a different rate and also feeds into net investment income on Form 8960. It's a separate line from the long-term gain. Worth checking how that splits on your projected Schedule D and Form 4797.

Form 4797 is the right place — the section 1250 unrecaptured depreciation flows through there before hitting Schedule D. Easy to underestimate if the property's been held a long time.

Naomi J.

Author

I hadn't thought carefully about how the recapture piece sits in the Form 8960 calculation separately. That changes some of my estimates — I'll need to run the 4797 numbers first.

For the rental property sale specifically: make sure you've also addressed depreciation recapture on the property. That portion is unrecaptured section 1250 gain taxed at up to a 25% rate and also feeds into net investment income on Form 8960. It's a separate line from the long-term gain. Worth checking how that splits on your projected Schedule D and Form 4797.

Naomi J.

Author

Agreed — I've been treating this as a DIY problem but you're right that the 4797 plus 8960 plus 409A combination is probably CPA territory.