How to sell appreciated stock and pay zero federal tax on the gain
A late-2026 stock sale plus a January 2027 Opportunity Zone investment moves the tax bill to 2032. Pair it with harvested losses and the federal tax can be zero.
First posted on X on September 4, 2026. The timing in this post rests on IRS Notice 2026-40, which is guidance, not final regulations. Check where the rules stand before you act on it.
There is a weird tax-planning window opening right now.
Say you bought Nvidia three years ago and you’re sitting on a $500K gain. Sell it and, at the top bracket, 23.8% goes to the IRS before your state takes its cut.
Normally you have two choices: pay the tax, or find losses to offset the gain before year-end.
Opportunity Zones create a third option.
The 2026 wrinkle
Under current IRS guidance, you can realize a gain in late 2026 and, if you’re still inside the 180-day window, invest it into a Qualified Opportunity Fund after January 1, 2027.
Money invested in 2026 is under the old rules, and the deferred gain comes back at the end of this year. Invest in January 2027 and the new rules apply: the gain stays deferred for five years, and 10% of it is forgiven at the end.
Sell Nvidia in October 2026, invest the gain in January 2027, and the tax bill moves to 2032.
The insight
The standard advice is to sell a winner, sell a loser, net them, and pay tax on what’s left. That advice wastes your losses.
Gains and losses don’t have to net in the same year. Defer the winner into an Opportunity Zone fund and it comes out of this year’s calculation. Losses you harvest elsewhere carry forward, and a deferred gain comes back on a date you already know.
The math
$500K gain in Nvidia. Somewhere else in the portfolio, a position that’s down $500K.
Sell Nvidia in October 2026. Invest the $500K gain in a QOF in January 2027 (you only invest the gain, not your basis). The gain is now deferred until 2032.
The loser is a separate decision. Harvest it this year, next year, or any year before the gain comes back. Say you sell it in 2027 and have no other capital gains. Individuals use up to $3,000 of net capital losses each year against ordinary income, so by 2032 you have roughly $485K of carryforward left.
Then the Nvidia gain returns. After five years in the fund, the 10% basis step-up reduces it to $450K.
$450K gain. $485K loss carryforward.
Federal tax on the original Nvidia sale: $0. And roughly $35K of losses still left.
You may already have the losses, or they may show up somewhere in the portfolio over the next five years. Ask a CPA or wealth manager whether they’d rather have three months to plan around a $500K gain or five years. I know which one I’d take.
The money wasn’t sitting still
It was invested, in this case in a real estate project inside the fund. Hold that investment ten years and the appreciation on it can be tax free too.
The trade-offs
You’re swapping liquid stock for an illiquid real estate investment. You can’t sell a quarter of an apartment building when you need cash.
Your loss carryforward can get consumed by other capital gains you realize before 2032. Watch the wash sale rules when you harvest.
And the tax benefit doesn’t save a bad deal and suddenly make it good. Pick the building first.
Bottom line
Most investors see a big gain and ask what losses they can find before December 31. For anyone sitting on a large stock gain in late 2026, the better question is: what changes if the gain doesn’t come back until 2032?
It took me years to see how these pieces fit together. Once you do, you stop managing taxes one December at a time.
Talk to your CPA. This is a tax post from a guy who builds apartments.