How to Calculate Capital Gains Tax on Sale of House
Use this premium calculator to estimate federal capital gains tax, depreciation recapture, NIIT, and optional state tax when selling a home.
Results
Enter your details and click Calculate to see your estimated gain, exclusion, and tax breakdown.
Expert Guide: How to Calculate Capital Gains Tax on Sale of House
When you sell a house, your tax bill is usually driven by one central number: your taxable capital gain. Many homeowners overpay because they skip basis adjustments or do not account for the home sale exclusion under Internal Revenue Code Section 121. Others underestimate taxes because they forget depreciation recapture or state-level tax. A reliable method is to calculate your gain in layers, using a clear formula and documented records.
At a high level, you compute: net sale proceeds minus adjusted cost basis. Then you apply any exclusion you qualify for (up to $250,000 single or $500,000 married filing jointly, in many cases), then apply federal and state tax rates to the remaining taxable amount. This page gives you both the calculator and the detailed framework so you can estimate taxes with confidence before listing your property.
Step 1: Calculate Net Sale Proceeds
Start with your contract sale price and subtract valid selling expenses. These commonly include:
- Real estate agent commissions
- Transfer taxes and recording fees paid by the seller
- Attorney fees tied to the sale
- Title and escrow charges paid by the seller
- Certain staging or marketing costs directly related to the sale
If your sale price is $750,000 and your selling costs are $45,000, your net sale proceeds are $705,000.
Step 2: Build Your Adjusted Cost Basis
Your adjusted basis is not just what you originally paid. It can be increased by acquisition costs and capital improvements, and reduced by depreciation claimed.
- Start with purchase price
- Add acquisition costs that are capitalized
- Add capital improvements that add value, prolong life, or adapt use
- Subtract depreciation claimed for rental or business use
Example: purchase price $320,000 + purchase costs $8,000 + improvements $60,000 = $388,000 adjusted upward basis. If depreciation claimed is $0, adjusted basis remains $388,000.
Step 3: Compute Realized Gain
Now subtract adjusted basis from net sale proceeds:
Realized Gain = Net Sale Proceeds – Adjusted Basis
Using the sample above: $705,000 – $388,000 = $317,000 realized gain.
If the result is negative, you generally have a loss, and personal residence losses are usually not deductible. That is why documentation is so important. A small basis mistake can flip your tax estimate dramatically.
Step 4: Determine Whether You Qualify for the Home Sale Exclusion
Many homeowners can exclude part of gain if they pass the ownership and use tests. In plain language, you usually need to have:
- Owned the home for at least 2 years in the 5-year period before sale
- Lived in the home as your main home for at least 2 years in that same 5-year window
- Not claimed the exclusion on another home sale in the 2 years before this sale
The standard exclusion limits are typically:
- $250,000 for Single filers
- $500,000 for Married Filing Jointly (if qualifications are met)
Important limitation: gain attributable to depreciation after May 6, 1997, is generally not excludable under this rule and may be taxed as recapture.
Step 5: Separate Depreciation Recapture from Remaining Gain
If you rented the home or claimed home office depreciation, the depreciation component can trigger tax up to 25% federal for unrecaptured Section 1250 gain. In practical planning terms:
- Depreciation-related gain is taxed first (up to the amount of gain)
- Then exclusion is typically applied to remaining non-recapture gain if eligible
- Any leftover gain is taxed at long-term capital gains rates (0%, 15%, or 20%) based on taxable income thresholds
This is one of the most common reasons two sellers with similar profits pay very different tax bills.
2024 Federal Long-Term Capital Gains Thresholds
| Filing Status | 0% Rate up to Taxable Income | 15% Rate up to Taxable Income | 20% Rate Above |
|---|---|---|---|
| Single | $47,025 | $518,900 | Over $518,900 |
| Married Filing Jointly | $94,050 | $583,750 | Over $583,750 |
These thresholds are applied with income stacking logic, meaning your other taxable income uses up lower brackets first. The calculator handles this by adding gain on top of your other income to estimate the blended capital gains rate.
Additional Tax Layers You Should Not Ignore
Beyond federal long-term capital gains rates, two extra tax layers can materially change your estimate:
- Net Investment Income Tax (NIIT) at 3.8%: often applies when modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly).
- State tax: many states tax capital gains as ordinary income or at special rates. Your location can add meaningful cost.
If your federal estimate seems low but your final settlement-year tax bill is high, this is usually why.
Threshold Comparison Table for Planning
| Item | Single | Married Filing Jointly | Why It Matters |
|---|---|---|---|
| Home sale exclusion (Section 121) | $250,000 | $500,000 | Reduces taxable gain if ownership/use tests are met |
| NIIT threshold | $200,000 | $250,000 | Potential extra 3.8% tax on investment income |
| LTCG 0% ceiling (2024) | $47,025 | $94,050 | Portion of gain may be taxed at 0% if income is low enough |
Records You Need Before You Calculate
Gathering records first can increase your basis and reduce taxable gain. Keep copies of:
- Closing disclosure or settlement statement from purchase and sale
- Invoices for major improvements (roof, additions, HVAC replacement, structural work)
- Permits and contractor agreements
- Depreciation schedules if any rental or business use occurred
- Prior tax returns showing depreciation claimed or prior exclusions used
Small missing details can mean thousands of dollars in tax difference. A homeowner who misses $40,000 of valid basis at a 15% capital gains rate plus 5% state tax may overpay by about $8,000.
Common Mistakes When Estimating Capital Gains Tax
- Confusing repairs with capital improvements
- Ignoring purchase and selling transaction costs
- Applying the exclusion without meeting the 2-out-of-5-year use test
- Forgetting depreciation recapture after rental periods
- Assuming all gain is taxed at one flat federal rate
- Ignoring NIIT or state taxes
Simple Formula Checklist You Can Reuse
- Net Proceeds = Sale Price – Selling Costs
- Adjusted Basis = Purchase Price + Purchase Costs + Capital Improvements – Depreciation
- Realized Gain = Net Proceeds – Adjusted Basis
- Recapture Portion = Depreciation (up to realized gain)
- Non-Recapture Gain = Realized Gain – Recapture Portion
- Excludable Gain = Min(Section 121 limit, Non-Recapture Gain) if qualified
- Taxable LTCG = Non-Recapture Gain – Excludable Gain
- Total Federal Estimate = LTCG tax + Recapture tax + NIIT (if applicable)
- Total Estimate = Federal + State
How to Use This Calculator Strategically
Run at least three scenarios before listing your home:
- Base case: expected sale price and normal selling costs
- High-price case: 5% to 10% above expected price to test tax impact
- Timing case: compare sale this year vs next year when other income may differ
This helps you understand whether tax planning should include timing compensation, harvesting losses, documenting more basis items, or delaying sale until ownership/use milestones are fully met.
Authoritative Government and Academic References
For official rules, review primary sources directly:
- IRS Topic No. 701: Sale of Your Home
- IRS Publication 523: Selling Your Home
- Cornell Law School (Legal Information Institute): 26 U.S. Code Section 121
Final Takeaway
Capital gains tax on a home sale is rarely just sale price minus purchase price. A complete estimate includes adjusted basis, selling costs, qualification for exclusion, depreciation recapture, federal income thresholds, NIIT exposure, and state tax. If your numbers are large or your property had mixed personal and rental use, a tax professional should validate the final calculation before filing. Still, a structured calculator like this gives you a strong planning estimate and helps you make better decisions before the sale closes.