For many homeowners, the sale of a primary residence qualifies for one of the most valuable tax breaks in the Internal Revenue Code: the Section 121 Home Sale Exclusion. Understanding how the rules work can help you minimize capital gains tax and avoid costly surprises. According to the IRS, eligible taxpayers may exclude up to $250,000 of gain ($500,000 for married couples filing jointly) from the sale of their principal residence
The Basic Section 121 Exclusion
To qualify for the exclusion, you generally must meet both:
Ownership Test
You owned the home for at least 2 years during the 5-year period ending on the sale date. [irs.gov], [irs.gov]
Use Test
You lived in the home as your primary residence for at least 2 years during the same 5-year period. The 24 months do not need to be continuous. [irs.gov], [irs.gov]
Maximum Exclusion
Facts
- Purchase Price: $400,000
- Sale Price: $550,000
- Capital Gain: $150,000
- Lived in home for only 18 months
- No special circumstances
Result
The taxpayer fails the 2-year use test.
Taxable Gain = $150,000
The gain is generally subject to long-term capital gains tax because the homeowner does not qualify for the Section 121 exclusion. [irs.gov]
Possible Exception
A partial exclusion may be available if the sale occurred because of:
- Job relocation
- Health reasons
- Certain unforeseen circumstances
The IRS provides special rules for prorated exclusions in these cases. [irs.gov]
Example 2: House Sold After Living There More Than 2 YearsFacts
- Purchase Price: $400,000
- Sale Price: $700,000
- Gain: $300,000
- Single taxpayer
- Lived in home for 3 years
Result
Maximum exclusion available: $250,000
Calculation:
Only $50,000 is subject to capital gains tax. [irs.gov], [irs.gov]
Converting a Primary Residence to a Rental PropertyA common misconception is that renting a home after living in it eliminates the home sale exclusion. In many cases, the exclusion is still available.
Key Rule
You must satisfy the ownership and use tests during the 5 years preceding the sale. [irs.gov], [irs.gov]
Example 3: Live There 2 Years, Rent for 3 Years, Then Sell
Facts
- Purchased in 2020 for $500,000
- Lived in home from 2020-2022
- Rented from 2022-2025
- Sold in 2025 for $900,000
- Gain: $400,000
- Married Filing Jointly
Analysis
The taxpayer:
✅ Owned the property for at least 2 years
✅ Used the property as a principal residence for at least 2 years during the 5-year lookback period
Therefore, they still qualify for the exclusion. [irs.gov], [irs.gov]
Tax Calculation
However, there is an important exception:
Depreciation Recapture
Any depreciation claimed during the rental years cannot be excluded. It must be recognized as taxable gain, generally taxed up to 25%. [irs.gov]
When Proportionate Exemption AppliesThe proportional allocation rule applies primarily when a property is originally a rental or investment property and later converted into a principal residence.
Congress changed the law in 2008 to prevent taxpayers from moving into long-term rental properties for just two years and excluding all appreciation. The gain attributable to periods of "nonqualified use" after 2008 may not qualify for exclusion.
Example 4: Rental for 6 Years, Then Primary Residence for 2 YearsFacts
- Purchased for $300,000
- Rented for 6 years
- Lived in property for 2 years
- Sold for $700,000
- Total Gain = $400,000
Ownership Period
Nonqualified Use Percentage
Gain Allocation
Since only $100,000 relates to qualified residence use, only that portion may be excluded under Section 121.
Any depreciation claimed during rental years must also be recaptured and remains taxable.
Important Planning OpportunityIf you:
- Buy a home as your primary residence.
- Live there for at least 2 years.
- Convert it into a rental.
- Sell it within 3 years after moving out.
You may still qualify for the full Section 121 exclusion (subject to depreciation recapture) because you meet the "2 out of 5 years" test. [irs.gov], [irs.gov]
This strategy is frequently used by homeowners who relocate for work and decide to rent their former home before selling.
Key Takeaways✅ Up to $250,000 (Single) or $500,000 (MFJ) gain may be excluded on the sale of a primary residence. [irs.gov], [irs.gov]
✅ You must generally own and live in the home for at least 2 of the last 5 years. [irs.gov], [irs.gov]
✅ Selling before meeting the 2-year requirement usually results in taxable gain unless a special exception applies. [irs.gov]
✅ Converting a primary residence into a rental does not automatically eliminate the exclusion if the property is sold within the applicable 5-year window. [irs.gov], [irs.gov]
✅ Depreciation claimed during rental years is always taxable and cannot be excluded. [irs.gov]
✅ A property that starts as a rental and is later converted to a residence may receive only a proportionate exclusion because gain attributable to post-2008 nonqualified use remains taxable.
Disclaimer: This article is for informational purposes only and should not be construed as tax advice. Tax outcomes vary based on individual circumstances, state tax rules, depreciation history, and filing status.
