Morkel Financial & Tax Services
The Journal / Real Estate Tax

Converting a Rental to a Primary Residence: Why §121 Only Excludes Part of the Gain.

By Ewan Morkel, EA7 min read

Two years of living in a former rental does not turn the whole gain tax-free. Since 2009, §121(b)(5) splits the gain between the years you rented and the years you lived there, and the depreciation you claimed never qualifies at all. Here is the three-step math to run before you move in.

Every landlord with a low-basis rental hears the same advice eventually: move in for two years, sell, and the $500,000 exclusion wipes out the gain. That advice expired at the end of 2008. Converting a rental to a primary residence still earns a real exclusion under IRC §121, but for rental years after 2008 the gain gets split between the period you rented and the period you lived there, and only the residence-period share can be excluded. I regularly meet owners who learn this on the tax return for the year of sale, after the move was already made for the wrong reason.

The two-years-and-done strategy was real once. The Taxpayer Relief Act of 1997 built the modern §121 exclusion around a simple test: own the home and use it as your principal residence for two of the five years before the sale, and exclude up to $250,000 of gain, or $500,000 on a joint return. Congress closed the conversion play in the Housing and Economic Recovery Act of 2008, whose Division C, the Housing Assistance Tax Act of 2008, added the rule now codified at §121(b)(5). It applies to sales after December 31, 2008.

The 2009 rule change

Why converting a rental to a primary residence only gets a partial exclusion.

Section 121(b)(5) denies the exclusion for gain allocated to periods of nonqualified use. A period of nonqualified use is any period after December 31, 2008 during which neither you nor your spouse used the property as a principal residence. Rental years, vacation-home years, and vacant investment years all count. The allocation is strictly pro rata by time: total gain multiplied by the aggregate nonqualified use over the entire period you owned the property. Years before 2009 get grandfathered treatment with a twist, since they never count as nonqualified use in the numerator, but they still sit in the denominator as ownership time, which dilutes the taxable fraction for long-held property.

Three exceptions in §121(b)(5)(C)(ii) keep the rule from sweeping in ordinary life. Any portion of the five-year testing period that falls after the last date you used the home as your principal residence does not count as nonqualified use. Up to ten years of qualified official extended duty for military, Foreign Service, and intelligence personnel is ignored. And temporary absences up to an aggregate of two years for a change of employment, health conditions, or unforeseen circumstances are ignored as well. The first exception does the most work in practice, and I come back to it below because it creates a sharp asymmetry.

Three-step math

Depreciation comes out first, then the gain splits, then the cap applies.

The computation runs in a fixed order under §121(b)(5)(D). First, gain attributable to depreciation claimed after May 6, 1997 is carved out under §121(d)(6). That slice can never be excluded, no matter how long you live in the house afterward, and it is taxed as unrecaptured §1250 gain at a rate of up to 25%. Second, the remaining gain is split by the nonqualified use fraction, and the nonqualified slice is taxable long-term capital gain. Third, the qualified-use slice is excludable up to the $250,000 or $500,000 cap, figures that have not moved or been indexed since 1997 and that the One Big Beautiful Bill Act of 2025 left untouched.

Worked example: a rental bought in June 2018, occupied in June 2023, sold in June 2026.
Purchase price, June 2018
$450,000
Depreciation claimed over five rental years
$65,000
Amount realized at the June 2026 sale, net of selling costs
$850,000
Total gain
$465,000
Step 1: unrecaptured §1250 gain, never excludable
$65,000
Step 2: gain subject to the §121 allocation
$400,000
Nonqualified use fraction (5 rental years ÷ 8 years owned)
62.5%
Gain taxed as long-term capital gain
$250,000
Gain excluded under §121 (within the $500,000 MFJ cap)
$150,000
Federal tax owed (15% LTCG + 25% recapture + 3.8% NIIT)
≈ $65,700
Federal tax if the full exclusion applied, as the owners assumed
≈ $18,700
Cost of the nonqualified use allocation
≈ $47,000

Tax year 2026 sale, married filing jointly. Assumes taxable income that keeps long-term gains in the 15% bracket, an ordinary marginal rate at or above 25% so the unrecaptured §1250 rate caps out, and MAGI above the $250,000 NIIT threshold of §1411, which is not indexed for inflation. A Utah seller adds the flat 4.5% individual income tax (the rate H.B. 106 set beginning in tax year 2025) on the taxable portion, since Utah gives capital gain no preferential rate.

Notice what the three years of occupancy did and did not do. The couple cleared the two-year use test easily, so they qualified for an exclusion. But the rental years are frozen in the numerator at five, so the only way occupancy helps is by growing the denominator. Stay two more years and the fraction falls from 62.5% to 50%, which moves about $50,000 of gain from taxable to excluded, worth roughly $9,400 of federal tax per the assumptions above. That can still be worth doing if you would live there anyway. It is rarely worth it as a pure tax play, and the $65,000 of depreciation stays taxable on any timeline.

The asymmetry

Live first, rent later, and the allocation never applies.

The order of use is everything. The trailing-period exception in §121(b)(5)(C)(ii)(I) says that time after the last date the home was your principal residence does not count as nonqualified use, as long as the sale lands within the five-year testing window. So the owner who lives in a home for years, moves out, rents it for up to three years, and then sells gets the full exclusion against the appreciation, reduced only by the §1250 recapture on the depreciation claimed during the rental stretch. The owner who rents first and moves in later faces the allocation on every rental year after 2008. Two taxpayers with identical gains, identical total ownership, and identical years of occupancy can owe wildly different tax purely because of sequence.

Depreciation planning matters here too. The deductions that make rental real estate efficient during the hold, including the cost segregation strategies I covered in how high-W-2 earners use real estate, come back through §1250 and §1245 at sale, and a residence conversion does nothing to soften that. The same goes for a building you rent to your own company, where the self-rental rule already complicates the passive-loss picture long before any conversion question comes up.

1031 buyers

A home acquired in an exchange waits five years.

One more gate applies to investors who acquired the future residence as replacement property in a like-kind exchange. Under §121(d)(10), if you took the property in a §1031 exchange, the exclusion is unavailable for any sale during the five-year period beginning on the acquisition date. The two-year use test still applies on top, and the rental years before you moved in still count as nonqualified use. An exchange into a property you intend to retire into can work well, but the calendar runs longer than most owners expect: five years of ownership minimum, two of them as your principal residence, and an allocation haircut for the rental stretch regardless.

Reporting

Where the numbers land on the return.

The closing agent will usually issue a Form 1099-S, which means the sale must show up on the return even if part of the gain is excluded. The sale goes on Form 8949 with adjustment code H in column (f) and the excluded amount as a negative number in column (g). The worksheets in Publication 523 compute the nonqualified-use percentage and the taxable gain. The depreciation slice flows through the Unrecaptured Section 1250 Gain Worksheet to Schedule D line 19, and the taxable portion is net investment income on Form 8960 if your MAGI clears the §1411 threshold. Get the percentage wrong and the IRS has the 1099-S and years of Schedule E depreciation on file to check it against.

Frequently asked

Quick answers on this topic.

How long do I have to live in a rental before selling to get the capital gains exclusion?

You need at least two years of ownership and use as your principal residence within the five years before the sale to qualify for any exclusion under IRC §121(a). But living there longer does not erase the rental years. Under §121(b)(5), every post-2008 rental year stays in the numerator of the nonqualified use fraction, so additional occupancy only shrinks the taxable share gradually by growing the total ownership period.

Does depreciation recapture go away if I move into my rental property?

No. Section 121(d)(6) makes gain attributable to depreciation claimed after May 6, 1997 ineligible for the exclusion no matter how long the home is your principal residence afterward. That slice is taxed as unrecaptured §1250 gain at a maximum federal rate of 25%, plus the 3.8% net investment income tax if your MAGI exceeds the §1411 threshold.

Is renting out my house after I move out considered nonqualified use?

Generally no. Section 121(b)(5)(C)(ii)(I) excludes from nonqualified use any portion of the five-year testing period that falls after the last date the home was your principal residence. So you can move out, rent the home for up to three years, and still claim the full $250,000 or $500,000 exclusion if you sell within five years of moving out, reduced only by depreciation recapture on the rental-period deductions.

Can I use the section 121 exclusion on a house I acquired in a 1031 exchange?

Yes, but §121(d)(10) blocks the exclusion for any sale within five years of the date you acquired the property in the exchange. You also still need two years of use as your principal residence, and the years the property was a rental after 2008 count as nonqualified use, so only part of the gain will be excludable even after the five-year wait.

Do rental years before 2009 count against the home sale exclusion?

Rental periods before January 1, 2009 are not treated as nonqualified use, because §121(b)(5) only applies to periods after December 31, 2008. Those early years still count in the total ownership period in the denominator of the allocation fraction, which actually helps by diluting the taxable percentage. Depreciation claimed after May 6, 1997 remains taxable under §121(d)(6) regardless of the year it was claimed.

Real estate tax planning

Modeling the after-tax outcome before you buy.

If either of these strategies is on your radar, the most valuable conversation is the one before the closing. We model the numbers, coordinate the cost seg, and file the elections, so the strategy survives the IRS, not just the spreadsheet.

More from the journal