Strategy

Can You Move Into Your Rental Property to Avoid Capital Gains Tax?

Investors ask me this every month: 'What if I just move into the rental for two years and then sell it tax-free?' The strategy is real and it's legal. It's also much smaller than most people expect once you apply three rules Congress added specifically to stop it from being a loophole.

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

The rule that makes it work: Section 121

IRC §121 lets you exclude gain on the sale of your principal residence if you owned it and used it as your main home for periods totaling at least two years during the five years ending on the sale date. The two years don't have to be consecutive. The cap is $250,000 of gain for a single filer and $500,000 for a married couple filing jointly, and you can use it once every two years.

Nothing in the statute says the property can't have been a rental first. So the plan of moving into a rental to convert it is legitimate. The next three rules are where the plan gets smaller.

Catch 1: Non-qualified use proration (the 2009 rule)

The Housing Assistance Tax Act of 2008 added §121(b)(5). For periods after December 31, 2008 when the home was not your principal residence, the gain allocated to those periods is not excludable. The allocation is simple time-based: non-qualified years divided by total years of ownership.

Example: you bought a rental in 2016, rented it through 2023, moved in January 2024, and sell in January 2026 after two years of residence. Ten years of ownership, eight of them rental. Eight tenths of your gain is non-qualified and fully taxable. Only two tenths is eligible for the exclusion.

Important nuance: rental periods after you last lived there (within the 5-year window) do not count as non-qualified use. That's what protects people who move out of a home and rent it for a couple of years before selling, covered in the home-to-rental conversion article. The proration hits the rental-first-then-move-in pattern, which is exactly the plan most investors have in mind.

Catch 2: Depreciation recapture is never excluded

§121(d)(6) says the exclusion does not apply to gain attributable to depreciation taken after May 6, 1997. Every year you rented the property, you deducted about 3.6% of the building value. All of it comes back as unrecaptured §1250 gain at a maximum 25% federal rate, plus state tax and possibly the 3.8% NIIT. On an eight-year rental that can easily be a five-figure bill that living there does nothing to reduce. Estimate yours with the recapture calculator.

Catch 3: The 5-year rule if you got the property through a 1031

If the rental came to you as replacement property in a 1031 exchange, §121(d)(10) bars the exclusion entirely unless you've owned it for at least five years from the exchange date. Two years of residence still required inside that window. This rule exists precisely to stop the 'exchange into a beach house, move in, sell tax-free' sequence. It doesn't stop it; it just makes it a five-year plan.

A worked example

Married couple, rental bought in 2016 for $350,000 (land 20%), rented eight years, occupied two, sold in 2026 for $650,000 net. Depreciation claimed ≈ $81,500. Total gain = $650,000 − ($350,000 − $81,500) = $381,500.

Federal tax still owed: roughly $56,000–$68,000 plus state and NIIT. The move-in strategy saved about $9,000–$12,000 of federal tax. Real, but not 'tax-free,' and it cost two years of living in the property.

Contrast: a 1031 exchange on the same sale defers the entire $381,500 gain, including recapture, with no move required. Which is better depends on whether you want to keep investing or cash out. Run both numbers.

When moving in genuinely makes sense

The strategy works best when the property was your home first (no non-qualified use before you moved in), when the rental period was short, when the gain is modest enough that the prorated exclusion covers most of it, or when you'd actually like to live there. It also stacks with a 1031: Rev. Proc. 2005-14 lets you exclude the residence portion under §121 and exchange the rest under §1031, deferring the recapture that §121 can't touch. If you're weighing this, the honest first step is running the proration on your actual dates.

Frequently asked questions

How long do I have to live in my rental before selling to avoid capital gains?

At least two years out of the five before the sale to qualify for Section 121. But rental years after 2008 before you moved in reduce the exclusion proportionally, and depreciation is always recaptured.

Does moving into a rental eliminate depreciation recapture?

No. Gain attributable to depreciation taken after May 6, 1997 is excluded from Section 121 and is taxed at up to 25% regardless of how long you live there.

Can I move into a property I bought with a 1031 exchange?

Yes, after holding it as investment property long enough to establish investment intent (most advisors suggest at least a year or two). But the Section 121 exclusion won't apply on sale until you have owned it for five years.

Do the two years of residence have to be consecutive?

No. The test is periods totaling 24 months within the five-year window ending on the sale date.


Want the proration run on your actual dates?

Send me the purchase year, rental years, and rough numbers. I'll show you the move-in math next to the exchange math.

See If I Qualify