By Stephen Milner · UtilityForge · Last reviewed: May 2026
This home sale capital gains tax calculator estimates the federal tax you may owe when selling a primary residence or an investment property. Enter your sale price, original purchase price, improvements, selling costs, and filing status, and the tool instantly shows your adjusted cost basis, taxable gain, and total federal tax owed for tax year 2025. Results update as you type. No account, no email, no third-party data sharing.
Capital gains tax on a home sale is the federal tax levied on the profit you make when selling real estate. The profit, called the capital gain, equals your sale proceeds minus your adjusted cost basis. If you held the property for more than one year, the gain is taxed at the long-term capital gains rates of 0%, 15%, or 20%, depending on your taxable income. If you held it for one year or less, the gain is taxed at ordinary income rates, which can reach 37%.
For most homeowners, the Section 121 exclusion eliminates or substantially reduces the tax. For landlords selling a rental property, depreciation recapture adds a separate layer of tax at a flat 25% rate.
The Section 121 exclusion (IRC Section 121) allows qualifying homeowners to exclude up to $250,000 of capital gains from a home sale if filing single, or up to $500,000 if married filing jointly.
To qualify, you must meet two tests (per IRS Publication 523, Selling Your Home):
The two years do not need to be continuous or the same two years. You can claim the exclusion once every two years. If you only partially meet the requirements due to a job change, health issue, or unforeseen circumstance, a prorated exclusion may apply.
Your adjusted cost basis is the starting number that determines how large your gain is. A higher adjusted basis means a smaller taxable gain.
Adjusted cost basis = Purchase price + buying closing costs + qualifying improvements
Qualifying improvements are permanent additions that increase the value of the property: a new roof, kitchen remodel, added bathroom, central air conditioning system, or landscaping. Routine maintenance (painting, fixing a leaky faucet, replacing appliances) does not count.
Buying closing costs include title insurance, recording fees, legal fees, and certain loan origination costs paid at purchase. The agent commission you paid when you bought is also included.
For investment properties: Subtract the total depreciation you have claimed on the property from the adjusted basis. Depreciation reduces your basis over time, which increases the gain when you sell.
Depreciation recapture is a tax that applies when you sell an investment property and recover some of the depreciation deductions you took while you owned it. The IRS taxes this recovered depreciation as unrecaptured Section 1250 gain, at a maximum federal rate of 25%.
For example: if you bought a rental property for $300,000, claimed $40,000 in depreciation over the years, and then sell for $380,000, your adjusted basis is $260,000 (not $300,000). The $40,000 of recovered depreciation is taxed at 25%, and the remaining gain is taxed at long-term capital gains rates.
Depreciation recapture applies even if you forget to claim depreciation on your tax returns. The IRS treats you as having taken the maximum allowed amount.
High-income sellers may also owe the Net Investment Income Tax (NIIT), an additional 3.8% surcharge on capital gains. The NIIT applies when your modified adjusted gross income (MAGI) exceeds $200,000 (single) or $250,000 (married filing jointly). It applies to investment property sales and to the taxable portion of primary residence gains that are not covered by the Section 121 exclusion.
Most home sale tax calculators give you a single number without showing the work. This tool shows the full calculation: amount realized, adjusted basis, gain realized, exclusion applied, taxable gain, depreciation recapture, capital gains tax, NIIT, and total federal liability. Seeing each step lets you understand which inputs have the biggest impact on your bill before you close, not after.
State capital gains taxes are not included in this estimate. Most states tax capital gains as ordinary income, and some states offer their own exclusions for primary residence sales. Check your state tax authority or consult a tax professional for state-level estimates.
This calculator is for estimation purposes only and does not constitute tax advice. Consult a qualified tax professional before making decisions based on these results.
To qualify for the Section 121 exclusion, you must pass two tests. First, you must have owned the home for at least 2 of the last 5 years before the sale date (the ownership test). Second, you must have used the home as your primary residence for at least 2 of those 5 years (the use test). The two years do not need to be consecutive, and they do not need to be the same years. If you meet both tests, you can exclude up to $250,000 in gains if you are single, or up to $500,000 if you are married filing jointly.
A qualifying home improvement is a permanent addition or alteration that adds value to the property, prolongs its useful life, or adapts it to a new use. Examples include a new roof, kitchen or bathroom remodel, added rooms or square footage, a central HVAC system, new windows, a deck, or landscaping that adds lasting value. Routine maintenance does not count: painting, replacing worn carpeting, fixing a broken appliance, or patching a leaking pipe are repairs, not improvements. Keep receipts and records for all improvements, as they increase your adjusted cost basis and reduce your taxable gain.
A primary residence is the home you live in as your main home for at least 2 of the last 5 years. Selling a primary residence qualifies you for the Section 121 exclusion (up to $250,000 or $500,000). An investment property, such as a rental or vacation home, does not qualify for the Section 121 exclusion. Investment property sales are also subject to depreciation recapture at 25% on accumulated depreciation, and the full gain is taxable at capital gains rates (long-term or short-term depending on how long you held the property).
Every year you rent out a property, the IRS allows you to deduct a portion of the building's value as depreciation. This lowers your taxable income during the years you rent it. However, when you sell, the IRS adds back that depreciation by reducing your adjusted cost basis by the total amount claimed. The recovered depreciation is taxed as unrecaptured Section 1250 gain at a maximum federal rate of 25%, regardless of your ordinary income bracket. This depreciation recapture applies even if you did not actually claim the depreciation on your returns, because the IRS uses the amount you were allowed to claim.
Married couples filing jointly can exclude up to $500,000 in gains only if both spouses meet the use test (both must have used the home as a primary residence for 2 of the last 5 years), and at least one spouse meets the ownership test. If only one spouse meets the use test, the exclusion is limited to $250,000. Married couples filing separately are each limited to $250,000, but both spouses must independently meet the ownership and use tests for their respective exclusions.
No. If you sell your primary residence at a loss, you do not owe capital gains tax. However, you also cannot deduct the loss against other income. Personal-use property losses are not tax deductible. If you sell an investment property at a loss, the loss may be deductible against capital gains and, under certain conditions, up to $3,000 per year against ordinary income, depending on your income level and passive activity rules.
The Net Investment Income Tax (NIIT) is an additional 3.8% federal tax on investment income for high earners. It applies to the taxable portion of your home sale gain (the part not covered by the Section 121 exclusion) when your modified adjusted gross income (MAGI) exceeds $200,000 if single, $250,000 if married filing jointly, or $125,000 if married filing separately. For investment properties, the NIIT applies to the full taxable gain once you exceed the threshold.
Yes, most states tax capital gains from home sales separately from federal taxes. Many states treat capital gains as ordinary income and tax them at your state marginal rate, which can range from 0% to 13.3% depending on the state. Some states offer their own primary residence exclusions that mirror or partially mirror the federal Section 121 exclusion. States with no income tax (such as Texas and Florida) do not tax capital gains at all. This calculator covers federal tax only. Check your state tax authority's guidance for your state-specific liability.
If you held the property for more than one year before selling, your gain is a long-term capital gain, taxed at federal rates of 0%, 15%, or 20% depending on your taxable income and filing status. If you held it for one year or less, the gain is short-term and taxed as ordinary income at rates up to 37%. The holding period begins on the day after you acquire the property and ends on the date of sale. Most homeowners hold their primary residence for several years, so their gains are typically long-term.
The Section 121 exclusion can still apply if you converted a primary residence to a rental, as long as you meet the ownership and use tests (2 out of the last 5 years as your primary residence) at the time of sale. However, if you claimed depreciation during the rental period, that depreciation is subject to recapture at 25% even if the rest of the gain is excluded. In that case, use the investment property mode in this calculator to account for the depreciation recapture, and apply the Section 121 exclusion manually to reduce the non-recapture portion of your gain. For mixed-use situations like this, a tax professional can give you a precise calculation.