Home sale capital gains calculator

Work out the gain on selling your main home, how much the $250,000 or $500,000 exclusion covers, and the federal tax on the rest.

Married couples get $500,000 only if both spouses used the home as a main home for 2 of the last 5 years.

Agent commissions, closing costs and other costs of selling.

Costs that add to your basis, such as title fees and recording fees.

Additions and other improvements that last more than a year. Repairs do not count.

Use 24 or more for the full exclusion.

Your income before the sale, before deductions. It decides which capital gains rate applies.

Rental use, depreciation and special cases

From a home office or a rental since 6 May 1997. It is taxed even when the rest of the gain is excluded.

For example, months you rented it out after 2008 before moving in.

A job change, a health reason or an unforeseen event allows a reduced exclusion if you lived there under 2 years.

Federal tax on the sale

$24,400.00

The gain is $400,000. $250,000 of it is excluded, and the remaining $150,000 is taxed.

Gain on the sale
$400,000.00
Most you can exclude
$250,000.00
Gain excluded
$250,000.00
Gain that is taxed
$150,000.00
Tax on the rest of the gain
−$22,500.00
Net investment income tax
−$1,900.00
Total federal tax on the sale
$24,400.00
  • Tax is estimated from the 2026 federal rates, stacking the gain on your other income. The net investment income tax uses income as given. State tax, the military and disability rules, and homes used partly for business are not included.

How it works

When you sell your main home, up to $250,000 of the gain is free of federal tax, or $500,000 on a joint return, if you owned it and lived in it for 2 of the last 5 years. The gain is the sale price, less selling costs, less what the home cost you. Depreciation and any gain above the limit are taxed.

Improvements add to what you paid for the home, and that includes wiring for a car charger, which you can size with the EV charger circuit calculator. Property tax paid in the year of the sale may be deductible, within the limit the SALT deduction calculator works out.

If you are buying again, work out the payment on the next mortgage before you commit the proceeds. The mortgage calculator also shows how a larger deposit changes the interest.

The formula

gain = sale price − selling costs − (purchase price + closing costs + improvements − depreciation)
excluded = the smaller of the maximum exclusion and (gain − depreciation − gain not excludable)
maximum exclusion = $250,000 ($500,000 joint) when owned and used 24 months or more
reduced maximum  = $250,000 × months (up to 24) ÷ 24, for a job, health or unforeseen reason
tax = depreciation at up to 25% + remaining gain at 0%, 15% or 20% + 3.8% net investment income tax

What each input means

A worked example

A single owner sold a home for $850,000 after 10 years, living there the whole time, with $100,000 of other income.

How the figures are rounded

Amounts are worked out to the cent. The gain is the sale price less selling costs, less the adjusted cost basis.

What it leaves out

State tax, the military and disability extensions, homes used partly for business, homes acquired in a like-kind exchange, the qualified opportunity zone rules and the surviving spouse rules. The net investment income tax uses your other income as given, without adjustments.

Common questions

Who qualifies for the exclusion?

You must have owned the home and used it as your main home for at least 2 of the 5 years before the sale. The 2 years do not have to be in a row. You cannot have excluded the gain on another home in the 2 years before.

What if I lived there less than 2 years?

You may get a reduced exclusion if you sold because of a job change, a health reason or an unforeseen event. The limit is cut in proportion, so 12 months gives half of $250,000, or $125,000.

Is depreciation taxed?

Yes. Depreciation you claimed or could have claimed since 6 May 1997, for example for a home office or a rental, cannot be excluded. It is taxed at your ordinary rate, up to 25%.

What if I rented the home before moving in?

The part of the gain for time it was not your main home before you lived in it cannot be excluded. It is the gain after depreciation, multiplied by the share of ownership that was non-qualifying use after 2008.

How is the rest of the gain taxed?

As a long-term capital gain at 0%, 15% or 20%, on top of your other income. A 3.8% net investment income tax can also apply if your income is over $200,000, or $250,000 on a joint return.

Sources and review

The method and any rates on this page come from:

This page gives general information to help you understand the numbers. It is not financial, tax or legal advice, and it cannot take account of your circumstances. Check important decisions with a qualified adviser or the official source.

Report an error on this page

Put this calculator on your website

Copy the code and paste it into your page. It is free to use. The embedded calculator updates as people type and carries a small credit that links back here.

Open the embedded version