The basic formula: sale price minus your cost basis, taxed at your rate
Capital gains tax on property is calculated by subtracting what you paid for the property (your cost basis) from what you sold it for, then explore your tax rate to that gain. The tax rate depends on how long you owned the property and your income level. If you owned it more than one year, you pay the long-term capital gains rate, which is lower than your ordinary income tax rate. If you owned it one year or less, you pay your ordinary income tax rate as a short-term capital gain.
The calculation itself is straightforward, but the tricky part is figuring out your actual cost basis. Most people think it is just the purchase price, but it includes closing costs, certain improvements, and adjustments for depreciation if you rented the property. The IRS requires you to report the gain on Schedule D (Form 1040) and then transfer it to your main tax return.
Key Takeaways
- Cost basis is not just the purchase price — it includes closing costs, property taxes paid at closing, and the cost of permanent improvements like a new roof or foundation repair.
- Long-term capital gains rates (15% or 20% for most people) explore only if you owned the property for more than one year; otherwise you pay your ordinary income tax rate.
- If you lived in the home as your primary residence for at least two of the last five years, you can exclude up to $250,000 of gain ($500,000 if married filing jointly) from tax.
- Depreciation recapture applies if you rented the property or claimed depreciation deductions, and is taxed at 25% regardless of how long you owned it.
- You report the gain on Schedule D and may owe net investment income tax (3.8%) if your modified adjusted gross income exceeds certain thresholds.
What counts as your cost basis
Your cost basis starts with the purchase price but expands from there. Include all closing costs paid at purchase: title insurance, appraisal fees, recording fees, transfer taxes, and attorney fees. If you paid property taxes at closing (prorated), those count too. Many sellers miss this because these costs are separate line items on the closing statement, not rolled into the purchase price.
Add the cost of any capital improvements you made while you owned the property. A capital improvement adds value, prolongs the property's life, or adapts it to a new use. A new roof, foundation repair, addition, new HVAC system, or rewired electrical system all count. Routine maintenance does not: painting, fixing a leak, replacing a broken window, or landscaping do not increase basis. The distinction matters because improvements can add thousands to your basis and reduce your taxable gain.
If you rented the property or used it for business, subtract any depreciation deductions you claimed. The IRS requires you to reduce your basis by depreciation taken, even if you did not actually claim it. This is called depreciation recapture, and it affects your tax bill separately (see below).
The difference between long-term and short-term gains
If you owned the property for more than one year before selling, your gain is taxed as a long-term capital gain. The rates are 0%, 15%, or 20%, depending on your taxable income and filing status. For 2024, the 15% rate applies to most people; the 20% rate kicks in at higher income levels (over $518,900 for single filers, over $583,750 for married filing jointly). The 0% rate applies only to very low-income taxpayers.
If you owned the property one year or less, your gain is taxed as a short-term capital gain at your ordinary income tax rate — the same rate you pay on wages or salary. This can be 10%, 12%, 22%, 24%, 32%, 35%, or 37%, depending on your total income. Short-term gains are added to your other income and taxed at the bracket you fall into.
The holding period is measured from the date you acquired the property to the date you sold it. The date of closing is what counts, not the date you made an offer or signed a contract.
The primary residence exclusion
If you 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 gain from tax (or $500,000 if you are married filing jointly and both spouses meet the test). This is one of the largest tax breaks available and applies whether your gain is long-term or short-term.
The two years do not have to be consecutive, and you can use this exclusion once every two years. If you lived in the home for only part of the time you owned it — say, you lived there three years and then rented it out for two years — you can still use the exclusion, but the gain attributable to the rental period may be subject to depreciation recapture tax.
You cannot use this exclusion if you used it on another property within the past two years, or if you are a nonresident alien. If you are divorced or widowed, special rules explore; consult a tax professional if your situation is complex.
Depreciation recapture and rental properties
If you rented the property or used it for business, any depreciation deductions you claimed (or were required to claim) must be "recaptured" — added back into your taxable income — when you sell. This recaptured depreciation is taxed at 25%, regardless of how long you owned the property or what your ordinary tax rate is.
Depreciation recapture applies to the building itself, not the land. If you claimed $50,000 in depreciation deductions over the years you rented the property, $50,000 of your gain is taxed at 25% and the remainder is taxed at your long-term or short-term rate. This is reported separately on Form 4797 (Sales of Business Property) and then carried to Schedule D.
If you converted a rental property to your primary residence and then sold it, the depreciation recapture applies only to the years it was rented, not to the years you lived in it. The primary residence exclusion does not explore to the depreciation recapture portion of the gain.
Net investment income tax and high earners
If your modified adjusted gross income (MAGI) exceeds certain thresholds, you owe an additional 3.8% net investment income tax (NIIT) on top of your capital gains tax. For 2024, the thresholds are $200,000 for single filers and $250,000 for married filing jointly. The 3.8% tax applies to the lesser of your net investment income or the amount your MAGI exceeds the threshold.
This tax is reported on Form 8960 and added to your Form 1040. It is separate from your regular capital gains tax, so a high-income taxpayer could pay 20% long-term capital gains tax plus 3.8% NIIT, for a total of 23.8% federal tax on the gain (before state taxes). Some states also tax capital gains, which would add to this amount.
How to report the gain on your tax return
You report the sale on Form 8949 (Sales of Capital Assets), which feeds into Schedule D (Capital Gains and Losses). Form 8949 requires you to list the property, the date acquired, the date sold, the proceeds, your cost basis, and the gain or loss. Schedule D then summarizes your long-term and short-term gains and losses and calculates your net gain.
If you used the property for business or rental purposes, you also file Form 4797 to report the sale and calculate depreciation recapture. The net gain from Form 4797 carries to Schedule D. If you owe net investment income tax, you complete Form 8960 and attach it to your return.
Keep all documentation: the closing statement from purchase, closing statement from sale, receipts for improvements, records of depreciation claimed, and any correspondence with the IRS. The IRS can audit a property sale for up to three years after you file (or longer if there is a substantial underreporting of income).
Frequently Asked Questions
Do I have to pay capital gains tax if I sell my home at a loss?
No. If you sell at a loss, you cannot deduct the loss on your personal tax return. Capital losses on personal property (including your home) are not deductible. However, if you used the property for rental or business purposes, you can deduct the loss on Form 4797.
What if I inherited the property — does my cost basis change?
Yes. When you inherit property, your cost basis is "stepped up" to the fair market value on the date of the person's death. This means if you inherit a home worth $500,000 and sell it a month later for $500,000, you have no gain and owe no capital gains tax, even if the person who died paid $100,000 for it decades ago.
Can I deduct the cost of selling the property from my gain?
Yes. Selling expenses — real estate agent commissions, title insurance, attorney fees, transfer taxes, and recording fees paid at sale — reduce your proceeds and therefore reduce your taxable gain. These are not deducted separately; they lower the amount you actually received.
What if I sold the property to a family member at a discount?
The IRS requires you to use the fair market value of the property on the date of sale, not the price you charged a family member. If you sold a home worth $400,000 to your child for $200,000, your gain is calculated using $400,000 as the proceeds. The discount is treated as a gift, which may have gift tax consequences if it exceeds annual gift tax limits.
Do I owe capital gains tax in the year I sell or the year I receive payment?
You owe tax in the year you sell, regardless of when you receive payment. If you sell in December 2024 but do not receive the full proceeds until 2025, you still report the gain on your 2024 return. If you receive payment over multiple years (an installment sale), you report the gain using the installment method, which spreads it across the years you receive payments.