House Sale Capital Gains Calculator
Estimate your gain, Section 121 exclusion, taxable amount, and potential federal plus state tax impact.
Estimator uses common IRS rules for principal residence exclusion and long-term capital gains stacking. Not legal or tax advice.
How to Calculate Capital Gains on a House Sale: Complete Expert Guide
If you are selling a home, one of the biggest financial questions is simple: how much capital gains tax will I owe? The answer can range from zero to a significant number, depending on your purchase basis, improvements, selling costs, filing status, occupancy history, and income. This guide walks you through the exact framework professionals use to estimate gain and tax exposure before closing day.
The core formula in plain English
At a high level, your taxable gain starts with this structure:
- Amount realized = sale price minus allowable selling costs.
- Adjusted basis = original purchase price plus acquisition costs plus capital improvements minus depreciation claimed.
- Capital gain = amount realized minus adjusted basis.
- Exclusion adjustment = subtract any Section 121 exclusion you qualify for.
- Tax calculation = apply federal rates (and state rates where applicable) to the remaining taxable gain.
This is why two homeowners selling for the exact same price can owe dramatically different taxes. One may have documented major improvements and full exclusion eligibility. Another may have converted the home to rental use and claimed depreciation, which changes both basis and taxation.
Step 1: Determine your amount realized
Your amount realized is generally not just the contract sales price. It is reduced by selling expenses directly tied to the sale, such as:
- Real estate commissions
- Title fees and transfer taxes paid by seller
- Attorney or escrow charges tied to closing
- Certain advertising and listing expenses
Example: if you sell for $700,000 and spend $42,000 on selling costs, your amount realized is $658,000.
Step 2: Build the adjusted basis correctly
Your adjusted basis starts with what you paid and then moves up or down as ownership events occur.
- Add: purchase price, settlement fees connected to acquisition, and capital improvements.
- Subtract: depreciation you claimed (or were allowed to claim), casualty loss adjustments, or certain credits.
A critical distinction: repairs (paint, minor fixes, routine maintenance) usually do not increase basis, while permanent value-adding projects (new roof, full kitchen remodel, additions, HVAC replacement, major landscaping improvements) generally do.
Documentation matters. Keep invoices, permits, and payment records. If you are ever questioned, good records can materially reduce taxable gain.
Step 3: Calculate total gain before exclusions
Now subtract adjusted basis from amount realized. If the number is positive, you have gain. If negative, you have a loss. Personal residence losses are generally not deductible. Investment property losses may be handled differently under separate tax rules.
This step gives you the economic gain, but not yet your final taxable amount.
Step 4: Apply the Section 121 home sale exclusion
For many homeowners, this is the most valuable rule. Under Internal Revenue Code Section 121, qualifying taxpayers can exclude:
- $250,000 of gain if filing single
- $500,000 of gain if married filing jointly (and other conditions are met)
To qualify for the full exclusion, you usually must meet both tests during the 5-year period ending on the sale date:
- Owned the property for at least 2 years
- Used it as your principal residence for at least 2 years
You generally cannot have claimed the same exclusion on another home sale within the prior 2 years. Partial exclusions may be available for qualifying employment, health, or unforeseen circumstances.
Important: depreciation recapture tied to nonqualified use is not fully shielded by the exclusion. That is why rental history and home office depreciation can still create taxable amounts even when you otherwise qualify.
Step 5: Understand long-term vs short-term treatment
If your holding period is more than one year, gains are generally long-term, which uses preferential federal rates. If one year or less, gains are short-term and typically taxed at ordinary income rates.
Long-term gains can be taxed at 0%, 15%, or 20%, depending on total taxable income and filing status. The gain effectively stacks on top of ordinary income, which means some portion can fall in one rate band and the rest in another.
2024 federal long-term capital gains thresholds (IRS)
| Filing Status | 0% Rate Up To | 15% Rate Up To | 20% Rate Above |
|---|---|---|---|
| Single | $47,025 | $518,900 | Above $518,900 |
| Married Filing Jointly | $94,050 | $583,750 | Above $583,750 |
These thresholds are inflation-adjusted and can change each tax year. Always verify current-year values before filing.
Trend comparison of long-term capital gains income thresholds
| Tax Year | Single 0% Ceiling | Single 15% Ceiling | MFJ 0% Ceiling | MFJ 15% Ceiling |
|---|---|---|---|---|
| 2022 | $41,675 | $459,750 | $83,350 | $517,200 |
| 2023 | $44,625 | $492,300 | $89,250 | $553,850 |
| 2024 | $47,025 | $518,900 | $94,050 | $583,750 |
This table shows how threshold inflation can affect planning. If your sale timing is flexible, crossing calendar years may influence the amount taxed at 0%, 15%, or 20%.
Worked example: principal residence with exclusion
Suppose you bought a home for $320,000, paid $8,000 in acquisition costs, and invested $55,000 in qualifying improvements. Your adjusted basis is $383,000. You later sell for $690,000 and pay $41,000 in selling costs, so your amount realized is $649,000. Total gain is $266,000.
If you are single, owned and lived in the home long enough, and have not used the exclusion recently, you can exclude up to $250,000. That leaves $16,000 potentially taxable. If married filing jointly and otherwise qualified, all $266,000 could be excluded, resulting in no federal capital gains tax from that sale.
Worked example: mixed-use home with depreciation
Now imagine a property that was a primary residence, then rented for several years with $30,000 depreciation claimed. Even if you meet occupancy tests for exclusion, that depreciation component is usually not fully excluded. In many cases, it is subject to depreciation recapture tax treatment, often up to 25% federally, plus possible state tax.
This is a common surprise. Sellers focus on the $250,000 or $500,000 exclusion and forget that prior depreciation can still produce tax liability.
How state taxes change the final number
Federal law gets most of the attention, but state treatment can materially change your net proceeds. Some states tax capital gains as ordinary income, some have dedicated rates, and some have no broad state income tax. If your expected federal tax is moderate, state tax can still be meaningful and should be modeled before listing.
Practical planning tip: estimate federal and state together, then build net proceeds estimates with a buffer for closing adjustments and prorations.
Documentation checklist before you sell
- Original closing disclosure or settlement statement from purchase
- Receipts and contracts for capital improvements
- Records of depreciation schedules (if rental or home office use)
- Prior tax returns reflecting basis-affecting elections
- Sale-side estimated closing statement with commission and fees
- Occupancy timeline proving principal residence use where relevant
Good records improve accuracy and reduce the risk of overpaying due to missing basis additions.
Common errors that cost sellers money
- Forgetting improvements: major upgrades never added to basis.
- Overstating repairs: routine maintenance incorrectly treated as capital improvements.
- Ignoring depreciation recapture: especially after rental conversion.
- Misapplying occupancy test: not enough use within the final 5-year window.
- Skipping state modeling: federal estimate only, causing settlement-day shock.
Authoritative references
For official guidance and legal text, review:
Final planning perspective
Calculating capital gains on a house sale is less about one tax rate and more about a sequence: basis accuracy, exclusion eligibility, depreciation treatment, and bracket interaction. If your numbers are close to exclusion limits or your property had mixed personal and rental use, estimate early and verify with a CPA or enrolled agent before closing. A pre-sale tax review can help with timing decisions, withholding expectations, and realistic net-proceeds planning.
Use the calculator above as a decision tool: test multiple sale prices, improvement assumptions, and income scenarios. Even small changes in selling costs, documented basis, or filing status can materially shift taxable gain and final cash retained from the sale.