The basic rules
IRC Section 121 allows you to exclude up to $250,000 of gain from the sale of a principal residence if you are single, or $500,000 if married filing jointly. To qualify, you must have owned the home and used it as your principal residence for at least 2 of the 5 years before the sale. The 2-year ownership and use periods do not need to be continuous — they just need to total 24 months in the 5-year lookback window. You can use the exclusion once every two years.
Depreciation recapture is not excluded
A common misconception: the Section 121 exclusion does not shelter depreciation recapture. If you ever rented the home and claimed depreciation (or converted it from a rental), the accumulated depreciation must be recaptured as unrecaptured Section 1250 gain at up to 25%, even if the rest of the gain is fully excluded. Only gain attributable to appreciation after any rental period — and within the Section 121 limits — can be excluded.
Partial exclusion for rental or business use
For a property with a history of both personal and rental use, the Section 121 exclusion applies only to the gain attributable to personal-use periods. Gain allocable to periods when the property was not used as a principal residence — including any rental period after May 6, 1997 — is not eligible for exclusion. This is called 'non-qualified use,' and the gain attributable to it remains taxable even if you meet the 2-year use test overall. Convert a rental to a primary residence, hold it two years, and you still owe tax on the gain built up during the rental period.
A worked example: the numbers behind the exclusion
Suppose a married couple bought their home for $400,000, added a $50,000 kitchen renovation (raising their adjusted basis to $450,000), and later sold for $900,000. Their gain is $450,000. Because they are married, meet the 2-of-5-year ownership and use tests, and never rented the home, the full $450,000 is under the $500,000 limit and is entirely excluded — they owe no federal capital gains tax on the sale, and it typically does not even have to be reported unless they receive a Form 1099-S.
Change one fact: the sale price is $1,050,000. Now the gain is $600,000. The first $500,000 is excluded, and the remaining $100,000 is taxable at long-term capital gains rates (0%, 15%, or 20% depending on total income), potentially plus the 3.8% Net Investment Income Tax. The exclusion caps out at $500,000; it does not scale with the gain. Keeping careful records of every capital improvement is what raises your basis and shrinks that taxable slice.
Allocating gain to non-qualified use
The non-qualified use rules (added for use periods after December 31, 2008) work by a fraction: gain × (non-qualified use period ÷ total ownership period) is not eligible for exclusion. Importantly, there is a key exception — any period after the last date the home was used as your principal residence is not counted as non-qualified use. So if you live in a home, then move out and rent it before selling, that final rental stretch does not reduce your exclusion (though depreciation recapture from it is still taxable).
Example: you buy a house and immediately rent it for 4 years, then move in and use it as your principal residence for 2 years before selling, for a $200,000 gain (ignoring depreciation). Total ownership is 6 years; non-qualified use is the 4-year rental period at the start. The non-qualified fraction is 4/6, so roughly $133,000 of the gain is taxable and only about $67,000 is eligible for exclusion — even though you technically met the 2-year use test. Order of use matters enormously.
The reduced (partial) exclusion
If you fail the 2-year ownership or use test, you may still qualify for a partial exclusion when the sale is due to a change in place of employment, health reasons, or unforeseen circumstances. The IRS provides safe harbors: a job-related move qualifies if the new workplace is at least 50 miles farther from the home than the old workplace was, and specific health and unforeseen-circumstance events (divorce, multiple births, job loss qualifying for unemployment, etc.) are listed in the regulations under Section 121(c).
The partial exclusion is a fraction of the $250,000/$500,000 limit — not a fraction of your gain. If a single filer lived in the home 12 of the required 24 months before a qualifying job move, they get 12/24 × $250,000 = $125,000 of exclusion. Because it is a fraction of the cap rather than the gain, the partial exclusion often shelters the entire gain of someone who sells relatively quickly.
Special rules: widows, military, and divorce
A surviving spouse can claim the full $500,000 exclusion if the home is sold within 2 years of the deceased spouse's death and the couple would have qualified for $500,000 immediately before the death. Members of the uniformed services, Foreign Service, and intelligence community can elect to suspend the 5-year test during qualified official extended duty — for up to 10 years — so a long deployment does not cost them the exclusion.
In divorce, a spouse who receives the home in the settlement can count the other spouse's use and ownership period. And if you continue to own a home your ex-spouse lives in under a divorce or separation instrument, you are treated as using it as your residence during that time. These rules prevent divorce from inadvertently disqualifying an otherwise-eligible seller.
Combining Section 121 with a 1031 exchange
A property acquired through a 1031 exchange and later converted to a principal residence has a special rule: under IRC § 121(d)(10), you must own it for at least 5 years (measured from the exchange) before any Section 121 exclusion is available. This closes a loophole where investors would 1031 into a property, quickly move in, and try to wash out deferred gain tax-free.
Even after 5 years, the exclusion still will not cover the depreciation recapture, and the non-qualified-use allocation applies to the periods the property was a rental. For a home that has been both a rental and a residence, the combined analysis — 1031 deferral, then Section 121 partial exclusion, minus recapture — is genuinely complex and warrants a CPA's projection before you sell.
Common mistakes and recordkeeping
The costliest Section 121 mistakes are avoidable. Investors forget that depreciation recapture is never excluded and are surprised by a tax bill on a home they thought was fully sheltered. Sellers fail to track capital improvements — additions, a new roof, renovations — that raise basis and reduce gain; routine repairs do not count, but a documented improvement does. Couples miss the rule that only one spouse needs to meet the ownership test but both must meet the use test to claim the full $500,000.
Keep the closing statements from both purchase and sale, receipts for every improvement, and records of any period the home was rented or depreciated. If any gain is taxable, or you received a Form 1099-S, report the sale on Form 8949 and Schedule D, showing the exclusion as an adjustment with code 'H.' Good records are what let you prove your basis and your qualifying periods if the IRS asks.
Business use inside the home vs. a separate dwelling unit
A frequently misunderstood rule concerns a home office or business use within the same dwelling unit. Under Reg. § 1.121-1(e), if the business or rental space was within your home — a home office, a spare bedroom you rented, a basement studio — you do not have to allocate the gain between business and personal use. The entire gain qualifies for the exclusion, and you only have to recapture the depreciation you claimed after May 6, 1997 (taxed as unrecaptured Section 1250 gain up to 25%). Contrast that with a separate dwelling unit — a detached ADU, a duplex half you rented, a separate structure — where gain is allocated between the residence and the business portion, and the business portion does not get the exclusion at all. The 'same roof, same dwelling unit' distinction can be worth tens of thousands of dollars, so identify which situation you are in before you sell.
The 3.8% NIIT and excluded gain
Higher-income sellers often worry the 3.8% Net Investment Income Tax will eat into a home sale. The good news: gain that is excluded under Section 121 is also excluded from net investment income, so the NIIT does not touch it. The NIIT can apply only to the taxable portion — gain above the $250,000/$500,000 limit, and gain attributable to non-qualified use — and only once your modified AGI exceeds $200,000 (single) or $250,000 (married filing jointly). So a couple with a $450,000 fully excluded gain owes no NIIT on it, while a couple with a $700,000 gain owes potential NIIT only on the $200,000 that exceeds the $500,000 exclusion. Depreciation recapture from any rental period is investment income too and can be exposed to the NIIT to the extent it is taxable.
Vacant land, state conformity, and a few edge cases
Two smaller rules round out the picture. Adjacent vacant land you owned and used as part of your residence can qualify for the exclusion if you sell it within two years before or after the sale of the home itself, treating both sales as one for the dollar limits. And most states with an income tax conform to Section 121, so the same exclusion generally shields your state capital gains — but a handful of states have their own quirks, and states that tax capital gains as ordinary income still follow the federal exclusion amount. Finally, remember the exclusion is per taxpayer in a sense: an unmarried co-owning couple can each claim up to $250,000 on their share, and a newly married couple can reach the full $500,000 only if both meet the two-year use test (though only one needs to meet the ownership test). Check your state's treatment and your co-ownership structure before assuming the federal result is the final answer.
Frequently asked questions
Does the Section 121 exclusion cover depreciation recapture?
No. Depreciation recapture from rental use is always taxable — the exclusion covers only the capital appreciation gain up to the dollar limits.
Can I get a partial exclusion if I move for a new job before living there 2 years?
Yes. A job-related move qualifies for a partial exclusion if the new workplace is at least 50 miles farther from the home than your old workplace was. The partial exclusion is a prorated fraction of the $250,000/$500,000 limit based on how much of the 2-year period you satisfied.
If I rent out my home after moving out and then sell, does that rental period reduce my exclusion?
Generally no. Periods after the last date you used the home as your principal residence are not treated as 'non-qualified use,' so a rental stretch at the end of ownership does not shrink the exclusion — but the depreciation you claimed during it is still recaptured and taxable.
How long must I own a property I acquired in a 1031 exchange before using Section 121?
At least 5 years from the date of the exchange. This rule (IRC § 121(d)(10)) prevents investors from quickly converting exchanged investment property into a tax-free residence sale.
Do I have to report the sale if all of my gain is excluded?
Often no. If your entire gain is excluded under Section 121 and you did not receive a Form 1099-S from the closing, you generally do not need to report the sale. If any gain is taxable, or you received a 1099-S, report the sale on Form 8949 and Schedule D and show the exclusion as an adjustment using code 'H'.
Can I convert a rental to a primary home and use Section 121?
Yes, if you then live there for 2+ of the 5 years before sale. But the gain attributable to the rental period (non-qualified use) remains taxable even after meeting the use test.
How often can I use the Section 121 exclusion?
Once every two years. You cannot exclude gain from a home sale if you excluded gain from another home sale within the prior two years.
If I had a home office, do I lose part of the exclusion?
Generally no. If the office was within your home (the same dwelling unit), you do not allocate gain between business and personal use — the whole gain qualifies for the exclusion, and you only recapture the depreciation you claimed after May 6, 1997. Allocation applies only when the business portion is a separate dwelling unit, such as a detached ADU or a rented duplex half.
Do I owe the 3.8% Net Investment Income Tax on my home-sale gain?
Not on the excluded portion. Gain excluded under Section 121 is also excluded from net investment income. The NIIT can apply only to the taxable portion — gain above the $250,000/$500,000 limit or attributable to non-qualified use, plus any depreciation recapture — and only once your modified AGI exceeds $200,000 single / $250,000 joint.
Can I exclude gain on vacant land next to my home?
Sometimes. Adjacent vacant land you owned and used as part of your residence can qualify if you sell it within two years before or after selling the home, with both sales treated as one for the dollar limits.
Sources
- IRS Publication 527 — Residential Rental Property
- IRS Topic No. 701 — Sale of Your Home
- IRS Publication 523 — Selling Your Home
Educational information and estimates only. Not tax advice. Tax rules change and vary by situation; consult a qualified tax professional before acting.
