US Tax Tools

Capital Gains Tax on Home Sale Calculator

Model the Section 121 primary-residence exclusion ($250,000 single / $500,000 married filing jointly), a prorated partial exclusion if you sold early for a qualifying reason, depreciation recapture if the home was ever a rental, and the resulting long-term capital gains tax and 3.8% Net Investment Income Tax for 2025 and 2026.

01INPUTS
Sale Details
$
$
$
$
$
Ownership & Use Test
Your entire $308,000 gain is excluded under Section 121 — $0 capital gains tax on this sale.

Gross Gain

$308,000

§121 Excluded

$308,000

Total Tax

$0

Net Proceeds After Tax

$658,000
Considering a 1031 exchange instead?Section 121 vs 1031 comparison
Share
03BREAKDOWN
Gain & Exclusion Breakdown
Amount realized (selling price − selling expenses)$658,000
Adjusted basis (purchase + improvements − depreciation)$350,000
Gross gain$308,000
Depreciation recapture (not eligible for §121)$0
Gain eligible for §121 exclusion$308,000
Section 121 exclusion limit$500,000
Excluded gain-$308,000
Taxable gain after exclusion (LTCG)$0
Tax Breakdown
Long-term capital gains tax (0%)$0
Depreciation recapture tax (25% max, §1250)$0
Net Investment Income Tax (NIIT, 3.8%)$0
Total tax on the sale$0
Edit inputs ↑

The $250,000 / $500,000 exclusion and the 2-of-5-year test

Single, MFS, and Head of Household: $250,000

Excludes up to $250,000 of gain from tax entirely — it never appears on your return as taxable income.

Married Filing Jointly: $500,000

Requires both spouses to meet the use test and at least one to meet the ownership test, with neither spouse having claimed the exclusion on another sale in the last 2 years.

Owned AND used, 2 of the last 5 years

Both tests must be met, but the two 2-year periods don't need to overlap or be continuous. Once every 2 years, at most.

Partial exclusion if you sell early

Job change, health, or unforeseen circumstances can qualify you for a prorated exclusion: full limit × (qualifying months owned and used) / 24.

Worked example: $300,000 purchase + $50,000 improvements, $700,000 sale, MFJ

A married couple bought a home for $300,000, spent $50,000 on a kitchen remodel and a new roof (both capital improvements), and sold it for $700,000 with $42,000 in selling expenses (agent commission and closing costs). They owned and lived in the home for 6 years, easily meeting the 2-of-5-year test.

Step Amount
Amount realized ($700,000 − $42,000 selling expenses)$658,000
Adjusted basis ($300,000 + $50,000 improvements)$350,000
Gross gain$308,000
Section 121 exclusion available (MFJ)$500,000
Taxable gain$0

Because the $308,000 gain is under the $500,000 MFJ exclusion, this couple owes $0 in capital gains tax, $0 in NIIT, and keeps the full $658,000 in sale proceeds. Most primary-residence sales fall entirely under the exclusion — the calculator only shows tax owed once gain exceeds your filing status's limit.

Depreciation recapture on a former rental

If the home was ever rented out or used for business, any depreciation you claimed reduces your basis and is carved out of the gain before the Section 121 exclusion applies. That carved-out portion is unrecaptured Section 1250 gain, taxed separately at a rate capped at 25% — it cannot be excluded even if your total gain is well under the $250,000/$500,000 limit.

  • Depreciation taken while rented is added back into the total realized gain (it lowered your basis).
  • That same amount is then carved out as unrecaptured Section 1250 gain — never eligible for Section 121.
  • The remaining gain (the appreciation portion) is still eligible for the full exclusion and standard 0/15/20% long-term rates — UNLESS some of it is also "non-qualified use" gain (see below), in which case that share is carved out too.
  • Unrecaptured Section 1250 gain is taxed at a maximum of 25% (lower if your ordinary bracket is below 25%), reported on the Schedule D Unrecaptured Section 1250 Gain Worksheet.

If you rented the home out BEFORE ever living in it as your main home — not just at some point during ownership — a second, separate rule applies: Section 121(b)(5) "non-qualified use." That rental-before-move-in period allocates a pro-rata share of the appreciation gain (by months) out of the exclusion entirely, on top of any depreciation recapture. Toggle "I rented this home out ... before I ever used it as my main home" in the calculator above to model it.

Frequently asked questions

How much of my home sale gain is tax-free?

Up to $250,000 of gain is excluded from tax if you file single, married filing separately, or head of household, and up to $500,000 if you file married filing jointly — provided you owned AND used the home as your main home for at least 2 of the last 5 years before the sale (IRS Publication 523). Gain above the exclusion is taxed as a long-term capital gain at 0%, 15%, or 20%, plus the 3.8% Net Investment Income Tax if your income is high enough.

What is the 2-of-5-year ownership and use test?

You must have owned the home for at least 2 of the 5 years immediately before the sale, AND used it as your main home for at least 2 of those 5 years. The two 2-year periods do not have to be the same 2 years and do not have to be continuous. You generally can't claim the exclusion more than once every 2 years.

Can I get a partial exclusion if I sold before meeting the 2-year test?

Yes, if the sale is due to a change in employment, health, or certain unforeseen circumstances (IRS Publication 523, "Reduced Maximum Exclusion"). The exclusion is prorated: multiply the full $250,000/$500,000 limit by the number of qualifying months you owned and used the home, divided by 24. For example, meeting the test for 12 of the required 24 months on a single filer gives a $125,000 exclusion instead of $250,000.

How is the gain on a home sale calculated?

Gain equals the amount realized (selling price minus selling expenses like agent commission, title fees, and closing costs) minus your adjusted basis. Adjusted basis is your original purchase price plus capital improvements (a new roof, an addition, a kitchen remodel — not routine repairs or maintenance), minus any depreciation you claimed if the home was ever rented out or used for business.

What happens if I rented the home out at some point?

Depreciation you claimed while the home was a rental is never eligible for the Section 121 exclusion (IRC Section 121(d)(6)). That portion of your gain is taxed separately as unrecaptured Section 1250 gain, at a rate capped at 25% (it can be lower if your ordinary tax bracket is below 25%, but never higher). Only the remaining appreciation-based gain gets the $250,000/$500,000 exclusion and the standard 0/15/20% long-term capital gains rates. Separately, if the rental period came BEFORE you ever used the home as your main home, the "non-qualified use" rule (IRC Section 121(b)(5)) also carves out a pro-rata share of the appreciation gain from the exclusion — see the next question.

What is 'non-qualified use' and how does it reduce my exclusion?

IRC Section 121(b)(5) denies the exclusion for gain allocated to any period after December 31, 2008 during which the home was NOT your main home — most commonly, renting the property out as an investment BEFORE ever moving in and using it as your primary residence. The allocation is by months: non-qualified-use gain = total gain (after carving out any depreciation recapture) × (non-qualified-use months ÷ total months owned). That share is taxed as an ordinary long-term capital gain and can never be excluded, even if your total gain is well under the $250,000/$500,000 limit. Two things do NOT count as non-qualified use: any vacancy AFTER the last day you used the home as your main home (moving out shortly before selling doesn't taint your exclusion), and qualifying temporary absences (up to 2 years for job/health/unforeseen circumstances, or up to 10 years of qualified official extended duty). This is a separate rule from depreciation recapture — both can apply to the same former-rental sale.

Do I owe the Net Investment Income Tax (NIIT) on a home sale?

The 3.8% NIIT can apply to the taxable portion of your gain (after the Section 121 exclusion) plus any depreciation recapture, but only if your modified adjusted gross income exceeds $200,000 (single/head of household) or $250,000 (married filing jointly). Excluded gain under Section 121 is never subject to NIIT — it's not counted as net investment income at all.

Do married couples get $500,000 even if only one spouse owned the home?

Yes, with conditions. To claim the full $500,000 MFJ exclusion: either spouse can meet the ownership test, but BOTH spouses must meet the use test, and neither spouse can have used the Section 121 exclusion on a different home sale within the last 2 years. If only one spouse meets the use test, the exclusion is limited to that spouse's $250,000.

What if my spouse died and I'm selling the home alone?

A surviving spouse selling within 2 years of the other spouse's death — and who hasn't remarried — can still claim the full $500,000 exclusion (as if still filing jointly), as long as the ownership and use tests were met (by either spouse) before the date of death and neither spouse excluded gain on another home sale within the 2 years before death (IRC Section 121(b)(4); IRS Publication 523, "Rules for Widows and Widowers").

Sources

Related Calculators

Last updated July 19, 2026 Tax year 2025 & 2026

Data sources: IRS Publication 523 / Topic 701 / Topic 409; IRC §121, §1250, §1411

This tool is general information only, not financial advice.

Reviewed by USTax Tools Editorial Desk

Read our methodology →