Capital Gain Tax Calculator for Home Sale
Estimate federal capital gains tax, depreciation recapture, NIIT, and state tax when selling a primary residence.
How to Calculate Capital Gain Tax on the Sale of a Home
If you are preparing to sell a house, one of the most important planning questions is how much tax you might owe on the gain. Many homeowners assume that if they sell their primary residence, there is never any tax due. In reality, U.S. tax law is favorable, but not automatic. You need to calculate adjusted basis correctly, subtract allowable selling costs, apply the home sale exclusion rules under Internal Revenue Code Section 121, and then determine whether any remaining gain is taxed at long-term capital gains rates, depreciation recapture rules, the 3.8% Net Investment Income Tax, and state taxes.
This guide gives you a practical framework to estimate your liability before closing. The calculator above is designed for pre-sale planning, and the sections below explain each number it uses so you can verify your assumptions with confidence.
Step 1: Start with Your Amount Realized
Your gross sale price is not your taxable amount by itself. First compute your amount realized:
- Contract selling price
- Minus selling expenses such as agent commission, title fees, transfer taxes, legal closing costs, and certain seller-paid transaction costs
This matters because higher selling expenses reduce gain. Homeowners often forget that these costs are usually subtracted from proceeds for gain calculation purposes.
Step 2: Calculate Adjusted Basis
Adjusted basis is usually your purchase price plus eligible basis adjustments, then reduced by any depreciation claimed for business or rental use. A common formula is:
- Original purchase price
- Plus certain purchase closing costs
- Plus capital improvements (new roof, room addition, major system replacement, kitchen remodel that adds value or extends life)
- Minus depreciation taken after May 6, 1997, if part of the home was used for rental or business
Routine maintenance like painting or minor repairs usually does not increase basis. Keeping detailed records of improvements is one of the highest-value tax habits for homeowners in appreciating markets.
Step 3: Determine Raw Capital Gain
Now subtract adjusted basis from amount realized:
Raw gain = Amount realized – Adjusted basis
If this number is zero or negative, there is typically no capital gains tax. If positive, move to exclusion testing.
Step 4: Apply the Home Sale Exclusion (Section 121)
Many sellers can exclude a large part of gain if they satisfy ownership and use tests. Under current federal law, the standard exclusion is:
- $250,000 for single filers
- $500,000 for married filing jointly (if requirements are met)
In general, you must have owned and used the property as your main home for at least 2 of the last 5 years before the sale, with additional limitations on exclusion frequency. The IRS explains details in Topic 701 and Publication 523.
| Federal Home Sale Exclusion Rules | Single | Married Filing Jointly |
|---|---|---|
| Maximum exclusion amount | $250,000 | $500,000 |
| Ownership/use period (general rule) | 2 of last 5 years | 2 of last 5 years (joint rule details apply) |
| Typical result for many primary homeowners | Large or full gain may be excluded | Even more gain may be excluded |
A critical nuance: depreciation recapture generally cannot be excluded under Section 121. If you claimed depreciation on home office or rental use, that portion can still be taxed, often up to 25% federally.
Step 5: Separate Depreciation Recapture from Remaining Gain
If depreciation was claimed, the gain associated with that depreciation is commonly treated as unrecaptured Section 1250 gain, taxed at a maximum 25% federal rate. Even when your primary residence exclusion removes most appreciation gain, depreciation recapture can remain taxable.
This is why former rental-to-primary conversions often produce tax even when the homeowner expected full exclusion. The calculator handles this by isolating depreciation first and applying exclusion to the remaining eligible gain.
Step 6: Apply Long-Term Capital Gains Brackets
For property held more than one year, federal gain rates are generally 0%, 15%, or 20%, based on taxable income and filing status. These brackets are not applied in isolation; your other taxable income fills lower brackets first, and gain is stacked on top.
| 2024 Long-Term Capital Gains Thresholds | 0% Rate Up To | 15% Rate Up To | 20% Rate Above |
|---|---|---|---|
| Single | $47,025 | $518,900 | Over $518,900 |
| Married Filing Jointly | $94,050 | $583,750 | Over $583,750 |
These statutory thresholds are essential planning statistics because they determine whether your taxable gain is charged mostly at 15% or if part spills into 20%. High-income sellers should also estimate the Net Investment Income Tax.
Step 7: Evaluate the 3.8% Net Investment Income Tax (NIIT)
For higher-income taxpayers, an additional 3.8% NIIT can apply to some or all taxable gain. The NIIT is based on the lesser of net investment income or excess modified adjusted gross income above threshold amounts. Common thresholds are:
- $200,000 for single filers
- $250,000 for married filing jointly
Even if your base long-term gain rate is 15% or 20%, NIIT may increase effective federal burden. Strategic timing, retirement account contributions, installment planning, and charitable giving can sometimes reduce NIIT exposure in the sale year.
Step 8: Add State and Local Tax Impact
State treatment of capital gains varies widely. Some states tax capital gains as ordinary income at high marginal rates; others have lower rates or no state income tax. For this reason, two sellers with identical federal numbers can have materially different total tax outcomes depending on residency at the time of sale.
The calculator includes a state rate input so you can stress-test scenarios. If you live in a no-income-tax state, enter 0%. If you live in a state with high rates, use a realistic marginal estimate from your state department of revenue guidance.
Worked Example: Primary Residence with Significant Appreciation
Suppose you bought a home for $300,000, paid $5,000 in basis-eligible purchase costs, and later spent $50,000 on capital improvements. You sell for $700,000 and pay $42,000 in selling expenses. You are single, have $90,000 of other taxable income, owned and used the home long enough, and claimed no depreciation.
- Adjusted basis = $300,000 + $5,000 + $50,000 = $355,000
- Amount realized = $700,000 – $42,000 = $658,000
- Raw gain = $658,000 – $355,000 = $303,000
- Exclusion = $250,000
- Taxable long-term gain = $53,000 (before NIIT and state)
That single exclusion often removes most gain. But if the same seller had a larger gain, higher income, or depreciation history, total tax could rise quickly.
Common Mistakes That Inflate Tax Bills
- Forgetting basis records: Missing improvement receipts can overstate taxable gain by tens of thousands.
- Ignoring depreciation recapture: Former rental or business use can create tax even when exclusion applies.
- Using gross sale price only: Not subtracting selling expenses overstates gain.
- Confusing ownership with use: You generally need both tests for full exclusion.
- Misjudging bracket stacking: Other income can push your gain from 0% into 15% or 20%.
- Skipping NIIT analysis: High earners often under-estimate this additional 3.8% layer.
Planning Strategies Before Listing
1) Reconstruct Basis Early
Do not wait until after closing. Gather HUD statements, contractor invoices, permit records, and improvement receipts now. If records are incomplete, start reconstruction while documentation is still available from banks, counties, and contractors.
2) Model Multiple Closing Dates
If your income varies year to year, moving the sale into a lower-income year can reduce the portion taxed at 20% and lower NIIT exposure. A one-year timing shift can produce a material difference.
3) Confirm Exclusion Eligibility
If you are near the 2-year use threshold, selling too early may reduce or eliminate exclusion benefits. In some hardship or employment-related relocations, partial exclusions may be available, so review facts carefully.
4) Review Rental or Home Office History
If any depreciation has been taken, set realistic expectations for recapture tax. This is one of the most common surprises in home sale transactions.
5) Coordinate with a Tax Professional Before Closing
By the time proceeds are wired, many strategy options are gone. Advance planning is where the biggest savings opportunities usually exist.
Why Market Statistics Matter for Home Sale Tax Planning
Tax planning is not just law, it is also valuation context. Home values in many U.S. regions increased substantially over the past decade, making exclusion limits more likely to be reached in expensive metros. In practical terms, more homeowners now have gains large enough that recordkeeping and pre-sale modeling are necessary. The fixed statutory exclusion amounts of $250,000 and $500,000 have not automatically risen with local home prices in high-cost areas, so taxable residual gain is more common than many households expect.
You can monitor market and policy context through authoritative sources like federal housing datasets and IRS guidance. When combined with your own basis records, these inputs make tax outcomes far more predictable.
Authoritative References
- IRS Topic No. 701: Sale of Your Home (.gov)
- IRS Publication 523: Selling Your Home (.gov)
- 26 U.S. Code Section 121 text via Cornell Law School (.edu)
Important: This calculator is an educational estimator, not legal or tax advice. Actual returns may differ based on partial exclusions, prior exclusions, nonqualified use periods, installment sales, state-specific rules, filing details, and IRS updates for the tax year of sale.