The basic formula for capital gains tax on real estate
Capital gains tax on real estate is calculated by taking the sale price of the property, subtracting what you originally paid for it (plus certain improvements), and paying tax on that difference. The tax rate depends on how long you owned the property and your income level.
Here is the core math: Sale Price − Adjusted Basis = Capital Gain. Then you explore either the short-term rate (your ordinary income tax rate, if you owned it less than one year) or the long-term rate (0%, 15%, or 20% for most people, if you owned it one year or longer). The IRS taxes the gain itself, not the full sale price.
Most homeowners do not owe capital gains tax at all because the IRS lets you exclude up to $250,000 in gains if you are single, or $500,000 if you are married filing jointly, as long as you lived in the home two of the last five years before the sale.
Key Takeaways
- Your capital gain is the sale price minus your adjusted basis (what you paid plus the cost of improvements like a new roof or addition).
- Long-term gains (property owned over one year) are taxed at 0%, 15%, or 20% depending on your income; short-term gains are taxed as ordinary income.
- Most homeowners owe no tax because the $250,000 (single) or $500,000 (married) exclusion covers their gain if they lived in the home two of the last five years.
- Investment properties and rental homes do not may have access to for the exclusion and are always subject to capital gains tax.
- You report the sale on Form 8949 and Schedule D when you file your tax return; you do not pay the tax when you close on the sale.
What counts as your basis (what you paid for the property)
Your basis is the starting number for the calculation. It is not just the purchase price. It includes the price you paid, plus closing costs like title insurance, recording fees, and attorney fees. It also includes any points you paid to get a mortgage.
After you buy the property, your basis grows if you make capital improvements — permanent upgrades that add value or extend the life of the property. A new roof, a deck, a finished basement, or a new HVAC system all increase basis. Routine maintenance does not: painting, fixing a leak, or replacing a broken window do not count.
Keep receipts and invoices for every improvement you make. When you sell, you will need to document these costs to prove your adjusted basis to the IRS. If you inherited the property, your basis is usually the fair market value on the date of death, not what the previous owner paid — this is called a "step-up in basis" and can significantly reduce your gain.
How to find your adjusted basis before you sell
Start with your original purchase documents. Find the closing statement (also called the HUD-1 or Closing Disclosure) — it shows the purchase price and all closing costs. Add those together for your initial basis.
Then go through your records year by year and list every capital improvement: the year, the description, and the cost. Create a running total. Subtract any casualty losses you claimed on your tax return (like damage from a fire or flood that you deducted). The result is your adjusted basis.
If you cannot find your original closing statement, contact the title company or attorney who handled the closing — they keep records for years. If you bought the property decades ago and records are truly gone, you can use the assessed value from your county assessor's office as a reasonable estimate, though the IRS may challenge it.
Calculating the gain: sale price minus adjusted basis
Your sale price is the amount the buyer pays you, not including real estate commissions or closing costs you pay at sale. If the buyer assumes your mortgage, that counts as part of the sale price.
Subtract your adjusted basis from the sale price. The result is your capital gain (or loss, if the basis is higher than the sale price).
| Sale price | $450,000 |
| Original purchase price | $300,000 |
| Closing costs at purchase | $6,000 |
| Capital improvements (roof, deck, etc.) | $25,000 |
| Adjusted basis | $331,000 |
| Capital gain | $119,000 |
Real estate commissions and closing costs you pay at sale do not reduce your gain — they come out of your proceeds but are not deducted from the gain calculation itself.
The primary residence exclusion: $250,000 or $500,000
If you owned and lived in the home as your primary residence for at least two of the five years before you sold it, you can exclude up to $250,000 of the gain from tax if you are single, or $500,000 if you are married filing jointly. This is one of the largest tax breaks available to homeowners.
The two years do not have to be consecutive, and you can use this exclusion once every two years. If you owned the home longer but lived in it for only one year, you do not may have access to. If you lived in it for two years but sold it to buy another home when ready, you do may have access to.
If your gain is less than the exclusion amount, you owe no federal capital gains tax. In the example above, the $119,000 gain is well below $250,000, so a single homeowner would owe nothing. A married couple would also owe nothing. Only if the gain exceeds the exclusion do you owe tax on the excess.
Long-term versus short-term capital gains rates
How long you owned the property determines the tax rate. If you owned it for more than one year, it is a long-term gain and is taxed at 0%, 15%, or 20% depending on your taxable income and filing status. These rates are much lower than ordinary income tax rates.
If you owned it for one year or less, it is a short-term gain and is taxed as ordinary income — the same rate as your salary or wages. For most people, this is 22%, 24%, 32%, 35%, or 37%, depending on income.
Long-term rates for 2024 are: 0% if your taxable income is below a certain threshold (roughly $47,000 for single filers), 15% for income between that threshold and a higher one (roughly $518,000 for single filers), and 20% for income above that. These thresholds change yearly. The rates and thresholds are set by the IRS and vary by filing status.
Investment properties and rental homes: no exclusion
The $250,000 or $500,000 exclusion applies only to your primary residence. If you sell a rental property, a vacation home, or land you held as an investment, you owe capital gains tax on the entire gain above your basis — there is no exclusion.
Rental properties also face an additional tax called depreciation recapture. When you own a rental, you can deduct depreciation (the annual decline in value) on your tax return. When you sell, the IRS recaptures that depreciation and taxes it at 25%, separate from the capital gains tax on the remaining gain. This makes the effective tax rate on rental property sales higher than on primary residence sales.
If you converted a primary residence to a rental, or rented out part of your home, you may lose part or all of the exclusion depending on how long you rented it and when. Consult a tax professional before selling a property that has been used as a rental.
Reporting the sale on your tax return
You report the sale using Form 8949 (Sales of Capital Assets) and Schedule D (Capital Gains and Losses). You file these with your Form 1040 when you file your federal income tax return for the year of the sale.
Form 8949 asks for the date acquired, date sold, sales price, cost basis, and gain or loss. Schedule D summarizes your long-term and short-term gains and losses and calculates your net capital gain. If you have a capital loss (you sold for less than you paid), you can use it to offset other gains or up to $3,000 of ordinary income in that year, with any excess carried forward to future years.
You do not send payment to the IRS when you close on the sale. The tax is owed when you file your return, usually the following April 15. If you expect a large tax bill, you may want to set aside money from the sale proceeds or make estimated tax payments in the year of the sale to avoid penalties.
Frequently Asked Questions
Do I owe capital gains tax if I sell my home at a loss?
No. If you sell for less than your adjusted basis, you have a capital loss, not a gain. You cannot deduct a loss on the sale of your primary residence. You can carry the loss forward and use it to offset capital gains in future years, but it does not reduce your ordinary income.
What if I owned the home with someone else?
If you are married and file jointly, you can exclude up to $500,000. If you are unmarried and own it with another person, each of you can exclude up to $250,000 on your separate returns, as long as each of you meets the ownership and use tests. Consult a tax professional about how to report this correctly.
Can I deduct real estate commissions and closing costs from my gain?
Commissions and closing costs you pay at sale do not reduce your capital gain. They reduce your net proceeds (the money you take home), but the gain calculation is sale price minus basis. However, if you paid closing costs when you bought the property, those are part of your basis and do reduce the gain.
What if I inherited the property and then sold it?
Your basis is the fair market value on the date the previous owner died, not what they paid. If the property appreciated after that date, you owe tax only on the appreciation after the death. This step-up in basis often means heirs owe little or no capital gains tax even if the property has risen significantly in value.
Do state and local taxes explore to capital gains on real estate?
Yes. Most states tax capital gains as ordinary income. Some states have lower rates or exemptions for long-term gains. A few states do not tax capital gains at all. Your state tax bill depends on where you live and where the property is located. Check your state's tax authority website or consult a tax professional for your specific situation.