How capital gains tax on a home sale works
When you sell a home for more than you paid, the profit is a capital gain. Most homeowners owe nothing on the sale of a main home because of the federal home sale exclusion.
The home sale exclusion
You can exclude up to $250,000 of gain if you are single, or $500,000 if you are married filing jointly. To qualify you must generally have owned the home and lived in it as your main home for at least two of the five years before the sale.
How the gain is calculated
Gain = sale price − selling costs − adjusted basis
Your adjusted basis is what you paid for the home plus the cost of capital improvements such as an addition or a new roof. Routine repairs do not count.
Worked example
A married couple bought a home for $300,000, spent $50,000 on improvements and sold it for $950,000 with $55,000 in selling costs. Gain = $950,000 − $55,000 − $350,000 = $545,000. After the $500,000 exclusion, $45,000 is taxable.
Long-term capital gains rates
Gain on a home owned more than one year is taxed at the federal long-term rates of 0%, 15% or 20%, depending on taxable income. Higher earners may also owe the 3.8% net investment income tax. Most states tax the gain as well. Homes owned one year or less are taxed at ordinary income rates.
How to use this calculator
Enter the sale price, the purchase price, what you spent on capital improvements and your selling costs. Then choose the exclusion (single $250,000, married filing jointly $500,000, or none if it is not a main home) and your long-term capital gains rate of 0%, 15% or 20%. The calculator works out the total gain, subtracts the exclusion you chose and estimates the federal tax on the taxable gain that is left. The result is an estimate of capital gains tax on a home sale. It does not include state tax.
What the result means
A taxable gain of zero means the exclusion covers your whole profit, so no federal capital gains tax is due on the sale. A figure above zero is the part of the gain that is taxed. The tax itself depends on your rate, which depends on your taxable income for the year.
More examples
The same sale for a single owner
Take the numbers in the worked example with a single owner. The gain is still $545,000. After the $250,000 exclusion, $295,000 is taxable. If all of it were taxed at 15%, the federal tax would be $44,250.
Tax on the couple’s $45,000
If the couple’s $45,000 were taxed at 15%, the tax would be $6,750. At 20% it would be $9,000. If the 3.8% net investment income tax applied to the whole amount, it would add $1,710.
A sale with no tax
Suppose the same home sold for $600,000 with $40,000 in selling costs. Gain = $600,000 − $40,000 − $350,000 = $210,000. That is below both exclusion amounts, so neither a single owner nor a couple would have a taxable gain.
What changes the result
- Capital improvements. Each dollar you can document raises your basis and lowers the gain by a dollar.
- Selling costs. Commission and other costs of the sale come off the gain.
- The exclusion that applies. In the example, moving from the $500,000 to the $250,000 exclusion raises the taxable gain from $45,000 to $295,000.
- How long you owned the home. One year or less means ordinary income rates. More than one year means long-term rates.
- Your income. It decides whether the 0%, 15% or 20% rate applies.
Common mistakes
- Confusing proceeds with gain. Paying off your mortgage does not change the gain.
- Counting repairs and upkeep as improvements. Painting and fixing leaks do not raise your basis.
- Losing receipts for improvements. Keep records for as long as you own the home.
- Assuming the exclusion covers a rental or second home.
- Forgetting depreciation. If you claimed it on the home, that amount is taxed on sale at up to 25% federally.
Related calculators
To see the cash you walk away with, use the home sale proceeds calculator. If part of the home was a rental, the rental property depreciation calculator shows how depreciation builds up. The home appreciation calculator projects a future sale price.
Frequently asked questions
Do I have to buy another home to avoid the tax?
No. That rule ended in 1997. The exclusion applies whether or not you buy again.
Does the exclusion apply to rental or second homes?
Not in general. It is for a main home. Investment property may qualify for a 1031 exchange instead.
How often can I use the exclusion?
Generally once every two years.
Is the tax based on my proceeds or my gain?
Your gain. That is the sale price minus selling costs and your adjusted basis. The amount left on your mortgage plays no part.
Do home improvements lower the tax?
Capital improvements do, because they raise your basis. In the worked example, the $50,000 of improvements cut the gain from $595,000 to $545,000.
What if I sell after owning the home for less than a year?
The gain is taxed at ordinary income rates, not the long-term rates. You would also be short of the two years of ownership and use the exclusion generally requires.
Does this calculator include state tax?
No. It estimates federal tax only. Most states tax the gain as well, and their rules differ.
This page is general information, not tax advice. Tax rules change, so confirm your situation with a tax professional or IRS Publication 523.