section 121 exclusion

The Section 121 Exclusion: How to Sell a House-Hack or Former Rental Tax-Free

If you ever lived in a property you now rent out — or plan to move back into one before selling — the Section 121 exclusion can shelter up to $500,000 of gain from capital gains tax. Here's how the timing rules actually work, and where they trip investors up.

Property Profit Tracker · Aug 27, 2026 · 5 min read

The Section 121 Exclusion: How to Sell a House-Hack or Former Rental Tax-Free

Most of what you've read about avoiding capital gains tax on real estate probably centers on the 1031 exchange — sell one investment property, roll the proceeds into another, defer the tax. But if a property was ever your primary residence, there's a second tool that doesn't require you to buy anything else: the Section 121 exclusion. It can shelter up to $250,000 of gain if you're single, or $500,000 if you're married filing jointly, and unlike a 1031 exchange, the money is yours to keep or reinvest however you want.

This comes up constantly for house hackers who buy a duplex or fourplex, live in one unit, then move out and rent the whole thing a few years later. It also matters for anyone who bought a property to flip or rent, ended up living in it for a stretch, or is weighing whether to move back into a rental before selling it.


Why It Matters

A 1031 exchange defers tax by trapping your equity in another property. Section 121 eliminates tax on the qualifying portion of the gain outright, with no requirement to reinvest anything. For an investor sitting on a property with six figures of appreciation, that difference is the gap between a tax-free exit and a forced next purchase.

The catch is that the exclusion is built entirely around a timing test, and the math changes depending on which came first: the primary residence use or the rental use.


The Two-Out-of-Five-Year Rule

To qualify at all, you need to have owned the home and used it as your primary residence for at least 24 months (they don't need to be consecutive) out of the five years ending on the sale date. Meet that bar and you can exclude up to $250,000 single / $500,000 married of the gain — full stop, if there was no rental use involved.

The exclusion can generally only be used once every two years, so selling a second qualifying home shortly after using it on a previous sale can disqualify the second one.


Lived In It First, Then Rented It Out

This is the more forgiving order, and it's the one most house hackers land in. If you lived in the property as your primary residence and then converted it to a rental before selling, the rental period after your last day of primary use is treated as a "trailing" period and doesn't count against you — the IRS's own guidance on sales and trades of rental property confirms this trailing-use treatment. As long as you still hit the 24-of-60-month ownership-and-use test by the closing date, you can rent the property for a few years afterward and still exclude the full gain.

The one thing that doesn't disappear: depreciation recapture. Any depreciation you claimed while it was a rental is taxed separately at up to 25% under IRC §1250, regardless of how much of the gain the exclusion shelters.


Rented It First, Then Moved In

This order is less forgiving. If you bought a property, rented it out, and then moved in for two years before selling, the rental years before your primary-residence use count as "nonqualified use." That portion of the gain — roughly proportional to the years rented versus years owned — doesn't qualify for the exclusion, even though you eventually met the 24-month residency test. A property rented for eight years and then lived in for two before selling only gets exclusion treatment on roughly a fifth of the gain, not all of it.

This distinction is exactly why the order of primary-residence use versus rental use matters more than the total time spent doing each.


How ProfitTrackr Helps

The hardest part of using this exclusion correctly isn't the tax law — it's reconstructing, years later, the exact dates a property was your primary residence versus a rental. Logging a property's status changes (prospect → owned → rental → sold) and the dates they happened in ProfitTrackr means that when it's time to sell, you're pulling an accurate timeline instead of guessing from memory or old mail.


Common Mistakes

Frequently Asked Questions

Can I use both a 1031 exchange and the Section 121 exclusion on the same sale?

In some cases, yes — a property with mixed primary-residence and rental use can potentially use the exclusion on the primary-residence portion and a 1031 exchange on the rental portion. This is a scenario worth reviewing with a tax professional before you list, since the rules for combining them are specific.

Does nonqualified use apply to time before 2009?

No. Nonqualified use only counts periods after January 1, 2009, so a property rented decades ago before you moved in isn't penalized the same way a more recent rental period would be.

What if I only lived there for 18 months instead of 24?

You may still qualify for a partial exclusion if the sale was due to a job change, health issue, or another qualifying unforeseen circumstance recognized by the IRS. Outside of those exceptions, falling short of 24 months generally means no exclusion.

Section 121 rewards investors who track their own timeline carefully. Know which order your primary-residence and rental periods happened in, keep the dates documented, and loop in a tax professional before closing — the difference between getting the order right and getting it wrong can be tens of thousands of dollars.

Run the numbers with the Calculators →

Analyze your properties free with Property Profit Tracker →