What you owe depends on your purchase price, sale price, and how long you owned the property
Capital gains tax on real estate is calculated by subtracting what you paid for the property from what you sold it for. That difference is your gain. You then owe tax on that gain at either a short-term rate (if you owned it less than one year) or a long-term rate (if you owned it one year or longer). Long-term rates are lower. The exact amount you owe also depends on your total income that year and your filing status.
The calculation itself is straightforward arithmetic. The complexity comes from figuring out what counts as your "purchase price" — because it includes more than just the down payment — and what counts as a deductible expense that reduces your gain. This guide walks you through both.
Key Takeaways
- Your gain is the sale price minus your adjusted basis, which includes the purchase price plus improvements you made to the property.
- Long-term capital gains (property owned over one year) are taxed at 0%, 15%, or 20% depending on your income; short-term gains use your ordinary income tax rate, which is higher.
- Closing costs, real estate agent commissions, and certain repairs reduce the amount of gain you owe tax on.
- You report the gain on Schedule D (Form 1040) and may also owe the Net Investment Income Tax of 3.8% if your modified adjusted gross income exceeds certain thresholds.
- Primary residence exclusions allow you to exclude up to $250,000 (or $500,000 if married filing jointly) of gain if you meet ownership and use tests.
Calculate your adjusted basis: what you actually paid for the property
Your adjusted basis is not just the purchase price. It is the purchase price plus the cost of improvements you made, minus any depreciation you claimed if you rented out the property.
Start with the purchase price — the amount shown on your closing statement. Add the cost of any capital improvements: a new roof, a deck, a finished basement, a new HVAC system, or a kitchen renovation. Do not include repairs (fixing a leaky roof) or maintenance (painting, landscaping). The IRS distinguishes between improvements that add value or extend the life of the property and repairs that restore it to its original condition. If you are unsure, the improvement typically costs more than $500 and adds to the property's value or useful life.
If you rented out the property or used part of it for business, you may have claimed depreciation deductions on your tax returns. Subtract that depreciation from your basis. You owe tax on that depreciation when you sell, even if you did not actually receive the money back.
Keep receipts and invoices for all improvements. The IRS may ask for them if you are audited. A spreadsheet listing the date, description, and cost of each improvement is easier to defend than a single number.
Subtract selling expenses from your sale price
Your sale price is not the amount the buyer paid. It is the amount you keep after paying to sell the property. Subtract real estate agent commissions, title insurance, transfer taxes, attorney fees, and any other costs you paid to complete the sale.
These are not deductions from your income. They reduce the sale price itself, which directly lowers your gain. If you sold for $400,000 and paid $24,000 in agent commissions and $3,000 in closing costs, your net sale price is $373,000.
Do not subtract a mortgage payoff or property taxes you owed. Those are separate financial transactions, not selling expenses.
The formula: gain equals net sale price minus adjusted basis
Once you have your adjusted basis and your net sale price, the math is straightforward:
Gain = Net Sale Price − Adjusted Basis
Example: You bought a house for $200,000. You spent $50,000 on a new roof, deck, and kitchen over the years. Your adjusted basis is $250,000. You sold it for $450,000 and paid $27,000 in commissions and closing costs. Your net sale price is $423,000. Your gain is $423,000 − $250,000 = $173,000.
If the result is negative, you have a loss. You cannot deduct a loss on the sale of a personal residence, but you can carry forward a loss on rental or investment property to offset other capital gains.
Determine whether your gain is long-term or short-term
The holding period matters because it determines your tax rate. Long-term capital gains are taxed at preferential rates (0%, 15%, or 20% depending on your income). Short-term capital gains are taxed as ordinary income, at rates up to 37%.
The holding period is measured from the date you acquired the property to the date you sold it. If you owned it for more than one year, it is long-term. If you owned it for one year or less, it is short-term. The date you closed on the purchase and the date you closed on the sale are what matter — not when you listed it or when you made an offer.
Most residential real estate sales result in long-term gains because people typically own homes for years. Short-term gains on real estate are less common but can happen if you buy a property, make improvements, and sell it within a year.
Find your tax rate based on income and filing status
Long-term capital gains tax rates depend on your taxable income, not your total income. The rates for 2024 are:
| Tax Rate | Single | Married Filing Jointly | Head of Household |
|---|---|---|---|
| 0% | Up to $47,025 | Up to $94,050 | Up to $62,975 |
| 15% | $47,025 to $518,900 | $94,050 to $583,750 | $62,975 to $551,350 |
| 20% | Over $518,900 | Over $583,750 | Over $551,350 |
These thresholds change each year. Check the IRS website or your tax software for the current year's rates. Also note that if your modified adjusted gross income exceeds certain thresholds ($200,000 for single filers, $250,000 for married filing jointly), you may owe an additional 3.8% Net Investment Income Tax.
Short-term gains use your ordinary income tax brackets, which range from 10% to 37% depending on your total taxable income and filing status.
explore the primary residence exclusion if you may have access to
If you owned and lived in the home as your primary residence for at least two of the five years before the sale, you can exclude up to $250,000 of gain from tax (or $500,000 if you are married filing jointly and both spouses meet the test). This exclusion is available once every two years.
Using the earlier example: your gain was $173,000. If this is your primary residence and you meet the ownership and use tests, you exclude the entire $173,000. You owe no federal capital gains tax on this sale.
If your gain exceeds the exclusion limit, you owe tax only on the excess. A married couple with a $600,000 gain on their primary residence would exclude $500,000 and owe tax on $100,000.
The exclusion does not explore to rental properties or investment properties. It also does not explore if you used the exclusion on another home within the past two years.
Report the gain on your tax return
You report capital gains on Schedule D (Form 1040), which is part of your federal income tax return. List each property sale separately: the date acquired, date sold, purchase price, sale price, and gain or loss.
If you have only one sale and it qualifies for the primary residence exclusion, you may not need to file Schedule D at all — you straightforward do not report the gain. But if you have multiple sales, rental property sales, or a gain that exceeds the exclusion, Schedule D is required.
Your tax software (TurboTax, H&R Block, TaxAct) will walk you through the Schedule D questions. If you use a tax preparer, provide them with your closing statement, records of improvements, and the date you acquired and sold the property.
Some states also tax capital gains. California, New York, and others add a state capital gains tax on top of federal tax. Check your state's tax agency website to see whether you owe state tax on the sale.
Frequently Asked Questions
Do I have to pay capital gains tax on the sale of my primary home?
Not if you meet the primary residence test: you owned and lived in the home for at least two of the five years before the sale. You can exclude up to $250,000 of gain (or $500,000 if married filing jointly). If your gain exceeds that amount, you owe tax only on the excess.
What if I inherited the property — does that change my basis?
Yes. Inherited property receives a "stepped-up basis," meaning your basis is the fair market value of the property on the date of the person's death, not what they originally paid. This usually eliminates or greatly reduces the gain when you sell.
Can I deduct the cost of selling my home from the gain?
Yes. Real estate agent commissions, title insurance, transfer taxes, and attorney fees all reduce your net sale price, which directly lowers your gain. Keep all closing documents and receipts.
What counts as a capital improvement versus a repair?
A capital improvement adds value, prolongs the property's life, or adapts it to a new use — a new roof, deck, or HVAC system. A repair restores it to its original condition — fixing a leak or repainting. Improvements can be added to your basis; repairs cannot. When in doubt, keep the receipt and ask your tax preparer.
Do I owe tax if I sell at a loss?
You cannot deduct a loss on the sale of your primary residence. On rental or investment property, you can use the loss to offset other capital gains that year, and carry forward unused losses to future years.