Selling a home · 26 U.S.C. §121Home sale capital gains exclusion: the 2-out-of-5-year rule
If you owned the home and lived in it as your principal residence for at least two years in total during the five years before the sale, up to $250,000 of the gain is not taxed (26 U.S.C. §121(a)–(b)(1)). Married couples filing jointly can exclude up to $500,000 if either spouse meets the ownership test, both meet the use test, and neither used the exclusion in the past two years (§121(b)(2)). A surviving spouse keeps the $500,000 limit for a sale within two years of the spouse's death (§121(b)(4)). The exclusion can be used once every two years (§121(b)(3)). If you move early because of a change in place of employment, health or other unforeseen circumstances, a partial exclusion applies, prorated over two years (§121(c)). Gain allocated to periods of nonqualified use is not excluded (§121(b)(5)).
The rules in §121
2 of 5 years
Owned and used as principal residence for periods totaling 2 years in the 5 years before the sale (§121(a)).
$250,000 limit
Per taxpayer (§121(b)(1)).
$500,000 joint
Either spouse owns, both use, neither used the exclusion in the last 2 years (§121(b)(2)(A)).
Once every 2 years
Not available if another sale in the prior 2 years used it (§121(b)(3)).
Surviving spouse
$500,000 for a sale within 2 years after the spouse's death, if the joint tests were met (§121(b)(4)).
Partial exclusion
Moving for employment, health or unforeseen circumstances: limit × months qualified ÷ 24 (§121(c)).
Examples
- Single seller, lived there 3 years, gain $180,000 → fully excluded.
- Married, joint return, both lived there 4 years, gain $620,000 → $500,000 excluded, $120,000 taxable.
- Single seller moved for a new job after 12 months, gain $100,000 → limit $250,000 × 12/24 = $125,000, so the gain is fully excluded.
What sellers should gather before closing
- Purchase closing statement and records of improvements – they set the basis.
- Dates of ownership and occupancy for each spouse.
- The certification the closing agent may ask for to skip Form 1099-S reporting.
Questions sellers ask
Do I pay capital gains tax when I sell my house?
Not on up to $250,000 of gain ($500,000 for most joint filers) if you owned and lived in it for 2 of the last 5 years (26 U.S.C. §121).
What if I sell before living there 2 years?
A partial exclusion applies if the main reason was a change of job location, health or unforeseen circumstances – the limit is prorated over 24 months (§121(c)).
Can I use the home sale exclusion more than once?
Yes, but not more than once in any two-year period (§121(b)(3)).
Related guides
Collect the seller's certifications and closing statements as documents on the deal in ClosingCode, with a task to request them early.
Start free trialSource: 26 U.S.C. §121 (govinfo.gov, read October 25, 2026).
General information, not legal, tax or financial advice. ClosingCode is software; it is not a law firm, tax adviser, lender or brokerage. This guide is not a substitute for the advice or services of an attorney.