roofy
Selling

Do I owe capital gains tax when I sell my home?

Apply the $250,000/$500,000 home sale exclusion, partial exclusions, depreciation and nonqualified use, then estimate 2026 federal tax.

Updated October 12, 2026 · fact-checked against official sources

The sale
Ownership and use
Your taxes
Estimated federal tax on the sale (2026)
$25,540

$150,000 of your $400,000 gain is taxable.

You meet the 2-out-of-5-year ownership and use tests.

Excluded (tax-free)$250,000
Taxable capital gain$150,000
Depreciation (25% max rate)$0
Worksheet
Amount realized (price − selling expenses)$893,000
Adjusted basis (purchase + costs + improvements − depreciation)$493,000
Gain (or loss)$400,000
Depreciation portion (can't be excluded)$0
Gain from nonqualified use (can't be excluded)$0
Gain eligible for exclusion$400,000
Your exclusion limit$250,000
Excluded$250,000
Taxable gain$150,000
Tax on depreciation (ordinary rates, max 25%)$0
Gain taxed at 0% / 15% / 20%$0 / $150,000 / $0
Long-term capital gains tax$22,500
Net investment income tax (3.8%)$3,040
Estimated federal tax$25,540

Estimate only. It assumes both spouses meet the same tests on a joint return and uses 2026 federal brackets. Confirm with IRS Publication 523 or a tax professional.

2026 federal numbers this tool uses

Home sale exclusion
$250,000 / $500,000
Single / married filing jointly (IRS Pub 523)
Ownership and use tests
24 of the last 60 months
Each test, in the 5 years before the sale
0% rate up to (taxable income)
$49,450 / $98,900
Single / joint, Rev. Proc. 2025-32
15% rate up to
$545,500 / $613,700
Single / joint; 20% above
Depreciation recapture
25% max rate
Unrecaptured section 1250 gain (Topic 409)
Net investment income tax
3.8%
MAGI over $200,000 single / $250,000 joint (Topic 559)

How the calculation works

The tool follows the order of IRS Publication 523:

  1. Amount realized = sale price minus selling expenses such as commissions, advertising and legal fees.
  2. Adjusted basis = purchase price plus certain closing costs (legal, recording and survey fees, transfer taxes, owner's title insurance) plus capital improvements, minus any depreciation you claimed. Loan points, mortgage fees and routine repairs do not count.
  3. Gain = amount realized minus adjusted basis. A loss on your main home is not deductible.
  4. Set aside what can't be excluded. Depreciation claimed after May 6, 1997 is taxed as unrecaptured section 1250 gain at up to 25%. Gain tied to nonqualified use (periods after 2008 when the home was not your main home) is also taxable. The tool allocates it by months: remaining gain × nonqualified months ÷ months owned.
  5. Apply the exclusion. Up to $250,000, or $500,000 on a joint return, if you owned and lived in the home at least 24 months of the 5 years before the sale and did not exclude gain on another home in the prior 2 years.
  6. Tax the rest. The taxable gain is stacked on top of your other taxable income. Depreciation gain uses ordinary rates capped at 25%. The rest uses the 0%, 15% and 20% long-term rates. The 3.8% net investment income tax applies to the lesser of your taxable gain or the amount your MAGI exceeds the threshold. Excluded gain is not subject to it.

Worked example

A single filer bought a house for $420,000, paid $8,000 in qualifying closing costs and spent $65,000 on a new kitchen and roof. Eight years later she sells for $950,000 and pays $57,000 in selling expenses. Her other taxable income is $120,000 and her MAGI is $130,000.

Example: single filer, full exclusion
StepAmount
Amount realized ($950,000 − $57,000)$893,000
Adjusted basis ($420,000 + $8,000 + $65,000)$493,000
Gain$400,000
Exclusion (meets both tests)−$250,000
Taxable long-term gain$150,000
15% capital gains tax (income is above $49,450)$22,500
NIIT: 3.8% × ($280,000 MAGI − $200,000)$3,040
Estimated federal tax$25,540

If she were married and filing jointly, and both spouses met the use test, the $500,000 limit would cover the whole $400,000 gain and she would owe no federal tax on the sale. That is the single biggest lever: check whether both spouses meet the use test.

Partial exclusion

If you fail the tests, you may still get a reduced exclusion when the main reason for the sale was a change in workplace location, a health issue or an unforeseeable event. Pub 523 takes the shortest of your time living there, your time owning it, and the time since your last excluded sale, then divides by 24 months. Selling for a new job after 12 months of living there gives 12 ÷ 24 = 50% of the limit, or $125,000 for a single filer.

Edge cases this tool simplifies

  • On a joint return the $500,000 limit needs both spouses to meet the use test. If only one does, the limits differ; see Pub 523.
  • Homes acquired in a 1031 exchange within the past 5 years do not qualify for the exclusion.
  • Uniformed Services, Foreign Service, intelligence community and Peace Corps personnel on qualified official extended duty can suspend the 5-year test for up to 10 years.
  • State tax is a flat rate on the taxable gain. Your state may treat the sale differently.

What to do next

See how much cash you keep with the home sale proceeds calculator. Renting it out before selling? Compare options with the rent out or sell calculator and the depreciation recapture calculator. For the rules in plain English, read capital gains tax when you sell your home. Selling in New York City? The NYC home sale tax calculator adds state and city tax.

Common questions

How much profit on a home sale is tax-free?

Up to $250,000, or $500,000 for married couples filing jointly, if you owned the home and lived in it as your main home for at least 24 months of the 5 years before the sale and did not exclude gain on another home in the prior 2 years.

Do the two years have to be in a row?

No. IRS Publication 523 says the 24 months of residence can fall anywhere within the 5-year period before the sale.

What if I have to sell before two years?

You may qualify for a partial exclusion if the main reason was a change in workplace location, a health issue or an unforeseeable event. The limit is reduced in proportion to the shortest of your use, ownership or time since your last excluded sale, divided by 24 months.

Can I exclude gain from depreciation I took for a home office or rental?

No. Depreciation claimed after May 6, 1997 cannot be excluded. It is taxed as unrecaptured section 1250 gain at a maximum 25% rate.

What are the 2026 capital gains rates?

Long-term gains are taxed at 0%, 15% or 20% depending on taxable income. For 2026 the 0% rate applies up to $49,450 (single) or $98,900 (joint), and the 15% rate up to $545,500 (single) or $613,700 (joint), per Rev. Proc. 2025-32. A 3.8% net investment income tax can apply above $200,000 or $250,000 of MAGI.

Can I deduct a loss on selling my home?

No. IRS Publication 523 says a loss on the sale of your main home is not deductible.

Fact-checked October 12, 2026

Fact-checked 2026-10-12. Rev. Proc. 2025-32 PDF text extracted: sec. 4.01 2026 bracket boundaries for MFJ, HOH, single and MFS match the tool exactly; sec. 4.03 zero/15% amounts (MFJ $98,900/$613,700; MFS $49,450/$306,850; HOH $66,200/$579,600; single $49,450/$545,500). Pub 523 reopened: $250k/$500k exclusion, 24-month tests (need not be continuous), 2-year look-back, both spouses must meet use test on joint return, partial exclusion = shortest period / 24 months, basis settlement costs and excluded loan costs, selling expenses, depreciation after May 6 1997, nonqualified use after 2008 with the after-last-use exception, Finley example ($400k, $20k depreciation, $700k sale, $320k gain, $120k nonqualified, $180k excluded), 1031 5-year rule, 10-year suspension for qualified extended duty, loss not deductible, Form 1099-S reporting. Topic 409: 25% max on unrecaptured 1250 gain, long-term = held more than one year (page still shows 2025 thresholds, so 2026 figures come from the Rev. Proc.). Topic 559: 3.8%, $250k/$125k/$200k thresholds, lesser-of rule, excluded home gain not subject. Math hand-checked: default example $25,540 (15% x $150,000 + 3.8% x $80,000); Finley inputs with $120k income single give $20k at 24% ($4,800) + $120k at 15% ($18,000) + NIIT $2,660 = $25,460. Fixed: worked-example wording ("same couple" for a single filer); partial-exclusion months now rounded. Simplifications: both spouses assumed to meet the same tests; state tax flat rate.

Sources

  1. Publication 523, Selling Your Home · IRS (accessed October 12, 2026)
  2. Topic no. 701, Sale of your home · IRS (accessed October 12, 2026)
  3. Topic no. 409, Capital gains and losses · IRS (accessed October 12, 2026)
  4. Rev. Proc. 2025-32 (2026 tax rate tables and capital gains thresholds) · IRS (accessed October 12, 2026)
  5. Topic no. 559, Net investment income tax · IRS (accessed October 12, 2026)

General information, not legal, tax or financial advice. Rules change; confirm with the agency or a professional before you act.