Skip to main content
TaxMath

Home sale capital gains tax calculator

The gain on selling your main home, how much of it the $250,000 or $500,000 exclusion takes off, and the federal and state tax on the rest for your household.

Income
W-2 box 1, before tax.
1099-DIV box 1a.
1099-DIV box 1b; part of ordinary dividends.
1099-DIV box 2a.
Household
Joint returns only.
The sale
Commissions, the seller’s closing costs, legal fees.
The purchase price plus the closing costs that are added to basis.
Additions and improvements with a useful life of more than a year; not repairs.
For a home office or rental use after May 6, 1997.
Exclusion
The shortest of the months owned, lived in, and since a prior exclusion.
Gain on the sale$274,000
Excluded under §121
$250,000
Taxable gain
$24,000
Federal and state tax on it
$3,600
Kept after selling costs and tax
$560,400
Gain and exclusion
StepAmount
Amount realized (price less selling expenses)$564,000
Adjusted basis$290,000
Gain$274,000
Maximum exclusion$250,000
Gain from depreciation, which cannot be excluded$0
Excluded$250,000
Taxable gain$24,000
Federal tax it adds$3,600
State tax it adds$0
  • Assumed. Whether you meet the ownership and use tests is your own answer. On a joint return the $500,000 maximum needs either spouse to have owned the home and both to have lived in it; this does not test that, nor the rules for a surviving spouse, a home used partly for business, or nonqualified use after 2008.
  • Assumed. The taxable gain is added to your household as a long-term capital gain and both engines are run with and without it; a home sold at a loss adds no tax, and the loss is not deductible.
How this was figured
  1. Maximum exclusion for your filing status: $250,000IRS, Publication 523 (for 2025 returns) and IRC §121(a), (b) and (c) — exclude "the first $250,000 of gain", "$500,000 for a married couple filing jointly", after owning and living in the home 24 months of the last 5 years; a reduced exclusion divides the shortest qualifying period by 24 months

How it works

The amount realized is the sale price less selling expenses; the adjusted basis is what you paid with the settlement costs that go into basis, plus improvements, less depreciation (Publication 523, Worksheet 2). The gain is the difference.

The exclusion is the §121 maximum, which the statute does not index: $500,000 on a joint return, $250,000 otherwise. A reduced maximum multiplies it by the qualifying months over 24, rounded to the cent. Depreciation claimed after May 6, 1997 is never excluded.

The rest of the gain is added to your household as a long-term capital gain and the Form 1040 engine and the state engine are run with and without it; the tax is the difference, carrying any bound the state figure has. A gain that includes depreciation, or a home held a year or less, is not taxed here, because its rate differs.

Nothing you enter leaves your browser, and nothing is stored. The same calculator is available to AI agents as the tool calc_home_sale_tax, in the page through WebMCP and at https://taxmath.org/mcp.

Sources

Put this calculator on your site

Paste this where the calculator should appear. Our script draws the calculator above the credit line, which is a plain link in your page. It is free, needs no signup and keeps nothing your readers type. Please keep the credit line. The embed page lists the options it takes.

<!-- TaxMath home sale capital gains tax calculator -->
<div class="taxmath-embed" data-taxmath-calc="home-sale-tax" data-taxmath-title="Home sale capital gains tax calculator" style="max-width:680px;margin:1.5rem auto">
  <p style="font:400 13px/1.4 system-ui,sans-serif;color:#4b4b5a;margin:.5rem 0 0">
    <a href="https://taxmath.org/calculators/home-sale-tax/?utm_source=embed&amp;utm_medium=referral&amp;utm_campaign=calculator-widget">Home sale capital gains tax calculator</a> by <a href="https://taxmath.org/?utm_source=embed&amp;utm_medium=referral&amp;utm_campaign=calculator-widget">TaxMath</a>
  </p>
</div>
<script src="https://taxmath.org/embed.js" async></script>
Your site strips scripts? Use the iframe version
<!-- TaxMath home sale capital gains tax calculator -->
<div class="taxmath-embed" style="max-width:680px;margin:1.5rem auto">
  <iframe src="https://taxmath.org/embed/v3/home-sale-tax/"
          title="TaxMath — Home sale capital gains tax calculator"
          width="100%" height="640" loading="lazy"
          style="width:100%;border:1px solid #d8dae6;border-radius:4px"></iframe>
  <p style="font:400 13px/1.4 system-ui,sans-serif;color:#4b4b5a;margin:.5rem 0 0">
    <a href="https://taxmath.org/calculators/home-sale-tax/?utm_source=embed&amp;utm_medium=referral&amp;utm_campaign=calculator-widget">Home sale capital gains tax calculator</a> by <a href="https://taxmath.org/?utm_source=embed&amp;utm_medium=referral&amp;utm_campaign=calculator-widget">TaxMath</a>
  </p>
</div>
<script src="https://taxmath.org/embed.js" async></script>

Go further