Strategy

Turned Your Home Into a Rental? Here's the Tax When You Sell (Section 121 + 1031 Together)

The 'accidental landlord' is the most common client I meet: someone who moved for a job, kept the old house, rented it out, and now wants to sell. This group gets the best tax treatment in the whole code if they sell inside a specific window, and one of the worst if they miss it by a year.

8 min read·Updated September 2026·By Leah Badach, CES
Key takeaways

The 3-year window

Section 121 requires two years of ownership and use as your principal residence within the five years ending on the sale date. If you lived there for at least two years and then moved out, the clock gives you three years of renting before the exclusion expires. Sell at month 35 after move-out: full exclusion. Sell at month 37: none.

This is the single most valuable date on an accidental landlord's calendar, and most don't know it exists until they've passed it.

Why rental-after-residence isn't prorated

The post-2008 'non-qualified use' proration in §121(b)(5) has an exception for any period after the last date you used the property as your principal residence, as long as it falls within the 5-year window. So a home you lived in from 2018 to 2023 and rented from 2023 to 2026 has no non-qualified use at all. The whole gain, up to the $250,000/$500,000 cap, is excludable. Compare this with the reverse pattern (rental first, then move in), which is prorated hard: moving into a rental to avoid capital gains.

The one thing Section 121 can't touch: depreciation

Depreciation you claimed (or could have claimed) while renting is excluded from the exclusion under §121(d)(6). Three years of depreciation on a $500,000 house is roughly $44,000, taxed at up to 25% federal plus state. Not ruinous, but not zero.

Stacking a 1031 on top: Rev. Proc. 2005-14

Because the property is now held for rental, it also qualifies for §1031. Rev. Proc. 2005-14 spells out how the two sections interact on a single sale:

  1. Apply §121 first to exclude gain up to the cap (not the depreciation portion).
  2. Apply §1031 to any remaining gain and to the depreciation recapture, by exchanging into replacement investment property through a qualified intermediary.
  3. Cash equal to the excluded gain can be received at closing without being treated as boot.

That last point is what makes the combination powerful: you can walk away from closing with up to $500,000 tax-free in your pocket and defer everything else into a new rental. The QI structure has to be in place before closing, as always.

A worked example

Married couple bought a home for $400,000 in 2017, lived there until mid-2023, rented it since, and sell in early 2026 for $900,000 net. Depreciation claimed while renting ≈ $30,000. Total gain: $900,000 − ($400,000 − $30,000) = $530,000.

Without the exchange the bill is small anyway (about $7,500 federal on the recapture plus state). Where the stack really pays is on bigger gains: a $1.2 million gain leaves $700,000 above the cap, and only the 1031 keeps that deferred.

If you've already passed the 3-year mark

Section 121 is gone. The property is a pure rental for tax purposes, taxed in the usual four layers. Your two options are a taxable sale or a 1031 exchange into other investment property. One planning wrinkle: moving back in for two years restarts a 121 window, but the intervening rental years now count as non-qualified use, so the exclusion is prorated. For most people at that point, the exchange is the cleaner answer.

Frequently asked questions

How long can I rent out my house before I lose the capital gains exclusion?

Up to three years after you move out, provided you lived in it for at least two of the five years before the sale. The exclusion is lost entirely once you've been out more than three years.

Do I pay depreciation recapture when I sell a former home I rented out?

Yes. Depreciation claimed after May 6, 1997 is never covered by the Section 121 exclusion. It is taxed at up to 25% federal unless you defer it with a 1031 exchange.

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

Yes. Rev. Proc. 2005-14 allows you to exclude gain under Section 121 first, then defer the balance, including depreciation, through a 1031 exchange. The excluded amount can be taken as cash at closing without being boot.

Does the 2 years of residence have to be right before I sell?

No. It only needs to fall within the five years ending on the sale date, which is what creates the three-year rental window.


Former home, now a rental?

Tell me your move-out date. If you're inside the window, we can structure the 121 + 1031 stack before you list.

See If I Qualify