Capital Gains on Home Sale Calculator

.cg-calc-container { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; max-width: 800px; margin: 20px auto; padding: 25px; border: 1px solid #e1e4e8; border-radius: 12px; background-color: #ffffff; box-shadow: 0 4px 6px rgba(0,0,0,0.05); color: #333; } .cg-calc-header { text-align: center; margin-bottom: 25px; } .cg-calc-header h2 { color: #2c3e50; margin-bottom: 10px; } .cg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; } @media (max-width: 600px) { .cg-grid { grid-template-columns: 1fr; } } .cg-input-group { margin-bottom: 15px; } .cg-input-group label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; } .cg-input-group input, .cg-input-group select { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box; font-size: 16px; } .cg-calc-btn { grid-column: span 2; background-color: #27ae60; color: white; padding: 15px; border: none; border-radius: 6px; font-size: 18px; font-weight: bold; cursor: pointer; transition: background 0.3s; margin-top: 10px; } @media (max-width: 600px) { .cg-calc-btn { grid-column: span 1; } } .cg-calc-btn:hover { background-color: #219150; } .cg-results { margin-top: 25px; padding: 20px; background-color: #f8f9fa; border-radius: 8px; display: none; } .cg-result-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #eee; } .cg-result-row:last-child { border-bottom: none; } .cg-result-label { font-weight: 500; } .cg-result-value { font-weight: bold; color: #2c3e50; } .cg-highlight { color: #e67e22 !important; font-size: 1.2em; } .cg-article { margin-top: 40px; line-height: 1.6; } .cg-article h3 { color: #2c3e50; border-left: 4px solid #27ae60; padding-left: 15px; margin-top: 25px; }

Capital Gains on Home Sale Calculator

Calculate your potential taxable gain and IRS exclusion eligibility.

Single Filer Married Filing Jointly
Yes No
Adjusted Cost Basis:
Net Sale Proceeds:
Total Capital Gain:
IRS Exclusion Applied:
Estimated Taxable Gain:

How Capital Gains on Real Estate Works

When you sell your primary residence, you may be eligible to exclude a significant portion of the profit from your federal income taxes. This is known as the Section 121 exclusion. This calculator helps you estimate your "Adjusted Basis" and your "Taxable Gain" based on current IRS guidelines.

Understanding the Adjusted Cost Basis

Your "Basis" isn't just what you paid for the house. It includes the original purchase price plus any major improvements that add value to the home, prolong its life, or adapt it to new uses.

  • Inclusions: Adding a deck, a new roof, kitchen remodeling, or installing central air conditioning.
  • Exclusions: Basic repairs like fixing a leak or painting a room are considered maintenance and generally do not increase your basis.

The $250,000 / $500,000 Rule

If the home was your primary residence and you lived in it for at least two of the five years leading up to the sale:

  • Single filers can exclude up to $250,000 of profit.
  • Married couples filing jointly can exclude up to $500,000 of profit.

Example Calculation

Imagine you bought a home for $400,000 and spent $50,000 on a kitchen renovation. Your Adjusted Basis is $450,000. If you sell it for $800,000 and pay $48,000 in Realtor commissions and closing costs, your Net Proceeds are $752,000. Your total Capital Gain is $302,000 ($752,000 – $450,000). If you are married filing jointly, the entire $302,000 is covered by your $500,000 exclusion, meaning you owe $0 in capital gains tax.

function calculateCapitalGains() { var purchasePrice = parseFloat(document.getElementById('purchasePrice').value) || 0; var improvementCosts = parseFloat(document.getElementById('improvementCosts').value) || 0; var sellingPrice = parseFloat(document.getElementById('sellingPrice').value) || 0; var sellingExpenses = parseFloat(document.getElementById('sellingExpenses').value) || 0; var filingStatus = document.getElementById('filingStatus').value; var livedTwoYears = document.getElementById('livedTwoYears').value; if (purchasePrice <= 0 || sellingPrice <= 0) { alert("Please enter valid purchase and sale prices."); return; } // 1. Calculate Adjusted Basis var adjustedBasis = purchasePrice + improvementCosts; // 2. Calculate Net Proceeds var netProceeds = sellingPrice – sellingExpenses; // 3. Calculate Realized Gain var totalGain = netProceeds – adjustedBasis; // 4. Calculate Exclusion var maxExclusion = 0; if (livedTwoYears === "yes") { maxExclusion = (filingStatus === "married") ? 500000 : 250000; } // 5. Calculate Taxable Gain var actualExclusionApplied = Math.min(Math.max(0, totalGain), maxExclusion); var taxableGain = Math.max(0, totalGain – actualExclusionApplied); // Format currency var formatter = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', maximumFractionDigits: 0 }); // Display Results document.getElementById('resAdjustedBasis').innerText = formatter.format(adjustedBasis); document.getElementById('resNetProceeds').innerText = formatter.format(netProceeds); document.getElementById('resTotalGain').innerText = formatter.format(totalGain); document.getElementById('resExclusion').innerText = formatter.format(actualExclusionApplied); document.getElementById('resTaxableGain').innerText = formatter.format(taxableGain); document.getElementById('cgResults').style.display = 'block'; }

Leave a Comment