Converting a Rental to a Primary Residence: Why §121 Only Excludes Part of the Gain.
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.
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.
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.
- 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.
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.
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.
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.