Home-Sale Capital-Gains Exclusion (§121)
Realized gain, $250k / $500k IRC §121 exclusion, and taxable gain.
Example
You enter
- Filing status mfj
- Sale price ($) 850000
- Selling costs (commission, title, prep; $) 45000
- Original purchase price ($) 300000
- Capital improvements (basis additions; $) 75000
- Two-of-five-year test met? true
- Any non-qualified-use period (rental after 2008)? false
You get
- Realized gain $430000
- Exclusion applied $430000
- Taxable gain $0
Details, formula, and sources
Two-of-five-year and non-qualified-use flags.
amount_realized = sale_price - selling_costs. adjusted_basis = purchase_price + capital_improvements. realized_gain = amount_realized - adjusted_basis. exclusion = min(realized_gain, cap) when the two-of-five test is met. cap = $250,000 single / $500,000 MFJ. taxable_gain = max(0, realized_gain - exclusion).
26 USC 121 (Internal Revenue Code §121). Cap last amended by TRA-1997; non-qualified-use reduction added by HERA-2008 (effective 2009).
26 USC free at uscode.house.gov. IRS Pub 523 (Selling Your Home) free at irs.gov.
Estimate. Lender governs final underwriting and rate / fee disclosure. Appraiser governs the appraised value. State law and the agency's program guidelines may impose stricter limits than the published thresholds.
Field names used by the API: filing_status, sale_price, selling_costs, purchase_price, improvements, meets_two_of_five, has_nonqualified_use, realized_gain, exclusion_applied, taxable_gain
- Filing-status caps single / MFS / HoH = $250,000; MFJ = $500,00026 USC 121(b)
- Selling costs treated as a reduction to amount realized (vs. an addition to basis)IRS Pub 523 convention
- Capital improvements user enters the total of basis-eligible improvementsuser attests; IRS Pub 530 covers what qualifies