{
  "id": "home-sale-capital-gains-tax",
  "version": "3c1339745c25",
  "status": "published",
  "name": "Home Sale Capital Gains Tax Calculator",
  "question": "My home sale capital gains tax?",
  "summary": "Estimates the 2026 federal capital gains tax on selling your home: the gain after selling costs and improvements, the $250,000 or $500,000 exclusion (or a partial one), and the tax on the rest.",
  "category": "finance",
  "subcategory": "tax-and-pay",
  "url": "https://www.acalculator.org/finance/home-sale-capital-gains-tax-calculator",
  "markdown": "https://www.acalculator.org/finance/home-sale-capital-gains-tax-calculator.md",
  "kind": "function",
  "method": "Gain = (sale price − selling costs) − (purchase price and buying costs + improvements). Maximum exclusion = $250,000 ($500,000 married filing jointly); × months ÷ 24 for a partial exclusion; $0 with none. Taxable gain = gain − the smaller of the gain and the maximum exclusion. Tax = 2026 Form 1040 tax with the taxable gain (long-term, or short-term when owned 1 year or less) − tax without it, both with the standard deduction.",
  "assumptions": [
    "Tax year 2026, federal tax only, your main home. Married filing jointly assumes both spouses lived in the home 2 of the last 5 years and neither excluded gain on another home in the last 2 years; other statuses use $250,000.",
    "Other income is ordinary income such as wages, with the standard deduction and no credits. Every amount is at most $1 trillion.",
    "Not included: depreciation claimed for a home office or rental use after May 6, 1997 (taxed up to 25% and never excluded), time the home was not your main home after 2008, the surviving spouse and military rules, and state tax. An estimate, not tax advice."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "price": {
        "title": "Sale price",
        "description": "What the buyer paid for the home.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 1000000000000
      },
      "costs": {
        "title": "Selling costs (optional)",
        "description": "Real estate commissions, title, legal and other closing costs you paid to sell.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 1000000000000
      },
      "basis": {
        "title": "Purchase price and buying costs",
        "description": "What you paid for the home plus closing costs you paid to buy it (your basis).",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 1000000000000
      },
      "improve": {
        "title": "Improvements (optional)",
        "description": "Additions and improvements that add value or life, such as a new roof or kitchen; not repairs.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 1000000000000
      },
      "status": {
        "title": "Filing status",
        "description": "Your 2026 filing status; married filing jointly can exclude up to $500,000.",
        "type": "string",
        "enum": [
          "single",
          "mfj",
          "mfs",
          "hoh",
          "qss"
        ]
      },
      "test": {
        "title": "Owned and lived in it 2 of the last 5 years?",
        "description": "Yes: the full exclusion. Moved early for a job, health or an unforeseen event: a partial exclusion. No: none.",
        "type": "string",
        "enum": [
          "full",
          "partial",
          "none"
        ]
      },
      "months": {
        "title": "Months that count",
        "description": "The shortest of: months you owned it, months you lived in it in the last 5 years, months since you last used the exclusion.",
        "type": "integer",
        "minimum": 0,
        "maximum": 24
      },
      "held": {
        "title": "Owned it for",
        "description": "More than 1 year makes the gain long-term (0%, 15% or 20%); 1 year or less is taxed as ordinary income.",
        "type": "string",
        "enum": [
          "long",
          "short"
        ]
      },
      "income": {
        "title": "Other income",
        "description": "Your other 2026 income before deductions, such as wages; the gain stacks on top of it.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 1000000000000
      }
    }
  },
  "outputs": {
    "tax": {
      "label": "Federal tax on the sale",
      "description": "Federal tax with the taxable gain minus the tax without it.",
      "format": "money"
    },
    "gain": {
      "label": "Gain on the sale",
      "description": "(Sale price − selling costs) − (purchase price and buying costs + improvements); below $0 is a loss.",
      "format": "money"
    },
    "exclusion": {
      "label": "Gain you exclude",
      "description": "The smaller of the gain and your maximum exclusion.",
      "format": "money"
    },
    "maxExclusion": {
      "label": "Maximum exclusion",
      "description": "$250,000 ($500,000 married filing jointly), × months ÷ 24 for a partial exclusion, $0 with none.",
      "format": "money"
    },
    "taxable": {
      "label": "Taxable gain",
      "description": "Gain − the excluded gain, not below $0.",
      "format": "money"
    },
    "niit": {
      "label": "Net investment income tax part",
      "description": "The 3.8% net investment income tax the taxable gain adds.",
      "format": "money"
    },
    "rate": {
      "label": "Rate on the taxable gain",
      "description": "Tax on the sale ÷ taxable gain × 100.",
      "format": "percent"
    },
    "afterTax": {
      "label": "Gain after tax",
      "description": "Gain − the tax on the sale.",
      "format": "money"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "price": 900000,
      "costs": 54000,
      "basis": 400000,
      "improve": 60000,
      "status": "single",
      "test": "full",
      "months": 12,
      "held": "long",
      "income": 85000
    },
    "outputs": {
      "tax": 21198,
      "gain": 386000,
      "exclusion": 250000,
      "maxExclusion": 250000,
      "taxable": 136000,
      "niit": 798,
      "rate": 15.586764705882352,
      "afterTax": 364802
    },
    "text": "Selling for $900,000.00 with a $386,000.00 gain, you exclude $250,000.00 and owe $21,198.00 of 2026 federal tax."
  },
  "examples": [
    {
      "given": {
        "price": 900000,
        "costs": 54000,
        "basis": 400000,
        "improve": 60000,
        "status": "single",
        "test": "full",
        "income": 85000
      },
      "expect": {
        "gain": 386000,
        "exclusion": 250000,
        "taxable": 136000,
        "tax": 21198,
        "niit": 798,
        "afterTax": 364802
      },
      "source": "IRS Publication 523 (2025), Selling Your Home: gain or loss, the $250,000 and $500,000 exclusion, the eligibility test, and the partial exclusion (months ÷ 24), https://www.irs.gov/publications/p523; tax with the gain − tax without it on the 2026 Form 1040 (Qualified Dividends and Capital Gain Tax Worksheet with IRS Rev. Proc. 2025-32 breakpoints; Form 8960); hand calculation in content.mdx; Python 3 check in docs/progress/WP-142/xcheck.py"
    },
    {
      "given": {
        "price": 1200000,
        "costs": 70000,
        "basis": 500000,
        "improve": 100000,
        "status": "mfj",
        "test": "full",
        "income": 150000
      },
      "expect": {
        "gain": 530000,
        "exclusion": 500000,
        "taxable": 30000,
        "tax": 4500,
        "niit": 0
      },
      "source": "IRS Publication 523 (2025), Selling Your Home: gain or loss, the $250,000 and $500,000 exclusion, the eligibility test, and the partial exclusion (months ÷ 24), https://www.irs.gov/publications/p523 ($500,000 joint); tax with the gain − tax without it on the 2026 Form 1040 (Qualified Dividends and Capital Gain Tax Worksheet with IRS Rev. Proc. 2025-32 breakpoints; Form 8960) (15% on $30,000); hand calculation in content.mdx; Python 3 check in docs/progress/WP-142/xcheck.py"
    },
    {
      "given": {
        "price": 600000,
        "costs": 36000,
        "basis": 380000,
        "status": "single",
        "test": "partial",
        "months": 15,
        "held": "long",
        "income": 70000
      },
      "expect": {
        "gain": 184000,
        "maxExclusion": 156250,
        "exclusion": 156250,
        "taxable": 27750,
        "tax": 4162.5,
        "rate": 15
      },
      "source": "IRS Publication 523 (2025), Selling Your Home: gain or loss, the $250,000 and $500,000 exclusion, the eligibility test, and the partial exclusion (months ÷ 24), https://www.irs.gov/publications/p523 (partial exclusion: months ÷ 24 × $250,000); IRS Topic 701, Sale of your home, https://www.irs.gov/taxtopics/tc701; Python 3 check in docs/progress/WP-142/xcheck.py"
    },
    {
      "given": {
        "price": 300000,
        "costs": 18000,
        "basis": 320000,
        "status": "single",
        "test": "full",
        "income": 60000
      },
      "expect": {
        "gain": -38000,
        "exclusion": 0,
        "taxable": 0,
        "tax": 0
      },
      "source": "IRS Publication 523 (2025), Selling Your Home: gain or loss, the $250,000 and $500,000 exclusion, the eligibility test, and the partial exclusion (months ÷ 24), https://www.irs.gov/publications/p523 (a loss on the sale of your main home cannot be deducted); Python 3 check in docs/progress/WP-142/xcheck.py"
    }
  ],
  "sources": [
    "IRS, Publication 523 (2025), Selling Your Home: figuring gain or loss (amount realized − adjusted basis), the eligibility test (ownership and residence 24 months in the 5 years, the look-back), the $250,000 and $500,000 maximum exclusion, the partial exclusion (work, health, unforeseeable events; the shortest period ÷ 730 days or 24 months), depreciation after May 6, 1997, and reporting. https://www.irs.gov/publications/p523 (retrieved 2026-10-19)",
    "IRS, Topic no. 701, Sale of your home (reviewed 12-Oct-2026): up to $250,000 of gain ($500,000 joint), the ownership and use tests, the 2-year rule, and reporting a sale with a Form 1099-S. https://www.irs.gov/taxtopics/tc701 (retrieved 2026-10-19)",
    "IRS, Rev. Proc. 2025-32 (Internal Revenue Bulletin 2025-45): 2026 rate tables (section 4.01), capital gains breakpoints (section 4.03), standard deduction (section 4.14). https://www.irs.gov/irb/2025-45_IRB (retrieved 2026-10-19)",
    "IRS, Instructions for Form 8960 (2025): 3.8% net investment income tax on the lesser of net investment income and modified AGI over $200,000 ($250,000 joint and qualifying surviving spouse, $125,000 married filing separately). https://www.irs.gov/instructions/i8960 (retrieved 2026-10-19)",
    "IRS, 2025 Tax Table (Instructions for Form 1040): taxable income under $100,000 is taxed at the middle of its row (rows of $0 to $5, $5 to $15 and $15 to $25, then $25 rows up to $3,000 and $50 rows from $3,000), in whole dollars. https://www.irs.gov/instructions/i1040tt (retrieved 2026-10-19)"
  ],
  "related": [
    "capital-gains-tax",
    "home-sale-proceeds",
    "depreciation-recapture",
    "income-tax"
  ],
  "changelog": []
}
