The basic formula for capital gains tax on property

Capital gains tax on a property sale is calculated by taking the price you sold it for, subtracting what you paid for it plus any improvements you made, and then explore the tax rate that matches your income bracket and how long you owned the property. The result — the profit — is what gets taxed, not the full sale price.

The math looks like this: Sale Price minus Purchase Price minus Improvements equals Capital Gain. That capital gain is then taxed at either the long-term rate (if you owned the property for more than one year) or the short-term rate (if you owned it one year or less). Long-term rates are almost always lower, which is why the holding period matters.

You do not owe tax on the full sale price. Many people think they do, but the IRS only taxes the profit. If you bought a house for $300,000 and sold it for $350,000, your capital gain is $50,000 — and that $50,000 is what enters the tax calculation, not the $350,000.

Key Takeaways

  • Capital gain equals the sale price minus your purchase price and the cost of any improvements you made to the property.
  • Long-term capital gains (property owned more than 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.
  • You can exclude up to $250,000 of gain ($500,000 if married filing jointly) if you lived in the home as your primary residence for at least two of the last five years.
  • Improvements like a new roof or kitchen addition reduce your taxable gain, but routine maintenance and repairs do not.
  • Your adjusted basis — the purchase price plus improvements minus depreciation — is what you subtract from the sale price, not just the original purchase price.

Understanding your purchase price and adjusted basis

Your basis is the starting point for the entire calculation. For most property sales, your basis is what you paid for the property — the purchase price. But basis is not always just the number on the deed. It includes closing costs you paid at purchase, such as title insurance, recording fees, and attorney fees. These are added to your basis because they are part of what you invested in the property.

After you buy the property, your basis can go up if you make capital improvements — permanent upgrades that add value or extend the property's life. A new roof, a room addition, a new HVAC system, or a kitchen renovation all count. Painting, routine repairs, lawn maintenance, and replacing a broken window do not. The IRS distinguishes between improvements (which increase basis) and repairs or maintenance (which do not).

If you rented out the property or used part of it for business, you may have claimed depreciation deductions on your tax returns. Depreciation reduces your basis. So your adjusted basis is your original purchase price plus improvements minus any depreciation you claimed. This adjusted basis is what you subtract from the sale price.

Calculating the actual gain and explore tax rates

Once you have your adjusted basis, the calculation is straightforward. Take the price you sold the property for (the gross proceeds, before real estate agent fees or closing costs), subtract your adjusted basis, and you have your capital gain.

The tax rate applied to that gain depends on two things: how long you owned the property and your income level. If you owned it for more than one year, it is a long-term capital gain. The federal tax rate is 0%, 15%, or 20%, depending on your taxable income bracket for the year of the sale. These brackets change annually. If you owned it one year or less, it is a short-term capital gain, and it is taxed as ordinary income — at whatever your regular income tax rate is, which is typically higher.

You will also owe net investment income tax (3.8%) on capital gains if your modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly). This is a separate tax on top of the capital gains rate.

State and local taxes vary. Some states do not tax capital gains at all. Others tax them as ordinary income. A few have their own capital gains tax rate. You need to check your state's rules separately.

The primary residence exclusion

If the property you sold was your primary home, you may be able to exclude a portion of the gain from tax entirely. This is one of the most valuable tax breaks available. You can exclude up to $250,000 of capital gain if you are single, or $500,000 if you are married filing jointly — meaning that gain is not taxed at all.

To use this exclusion, you must have owned the home and lived in it as your primary residence for at least two of the five years before the sale. The two years do not have to be consecutive, and they do not have to be the most recent two years, but they must fall within that five-year window. If you meet these requirements, the exclusion is automatic — you claim it on your tax return when you report the sale.

If you are married filing jointly and only one spouse meets the two-year test, you can still exclude $250,000. If neither spouse meets it, neither can use the exclusion. If you have already used the exclusion on another home sale within the past two years, you cannot use it again until two years have passed since that previous sale.

What to include and exclude from the sale price

The sale price for capital gains purposes is the actual amount the buyer pays for the property. If you sold it for $400,000, that is your sale price — even if you owe a real estate agent commission, closing costs, or transfer taxes. Those costs reduce your net proceeds (the money in your pocket), but they do not reduce the sale price used in the capital gains calculation.

However, if the buyer assumed a mortgage you owed, that assumption counts as part of the sale price. If you owed $200,000 on a mortgage and the buyer took over that debt, and you received $300,000 in cash, your sale price is $500,000, not $300,000.

Selling costs like real estate commissions, title insurance, and attorney fees at closing do reduce your net proceeds, but they are not deducted from the sale price for capital gains purposes. They reduce what you take home, but the IRS calculates gain on the full sale price.

Reporting the sale on your tax return

When you sell property, you report the transaction on Form 8949 (Sales of Capital Assets) and then transfer the totals to Schedule D (Capital Gains and Losses). Schedule D is where you separate long-term gains from short-term gains and calculate your net capital gain or loss for the year.

You will need the settlement statement from closing, which shows the sale price and any credits or adjustments. You will also need your records of the original purchase price, closing costs at purchase, and documentation of any improvements you made (receipts, invoices, permits). If you claimed depreciation on the property, you will need those records too.

If you used the primary residence exclusion, you do not file a separate form — you just report the sale normally on Form 8949 and Schedule D, and the exclusion reduces your taxable gain automatically when you calculate it. Keep records of when you owned and lived in the home in case the IRS asks.

Special situations: inherited property and like-kind exchanges

If you inherited the property, your basis is not what the person who left it to you paid for it. Instead, your basis is the fair market value of the property on the date of death (or six months later if the estate chose the alternate valuation date). This is called a step-up in basis, and it can significantly reduce or eliminate capital gains tax if you sell soon after inheriting.

If you sold property and used the proceeds to buy another property of like-kind through a 1031 exchange, you may have deferred the capital gains tax rather than paid it. In a 1031 exchange, you do not recognize the gain at the time of the sale — instead, your basis in the new property is adjusted to defer the tax. The gain is still there; it just moves forward to a future sale. These exchanges have strict timing and identification rules, so work with a tax professional if you are considering one.

Frequently Asked Questions

Do I owe capital gains tax if I sell my home at a loss?

No. If you sell property for less than your adjusted basis, you have a capital loss, not a gain. You do not owe tax. However, you generally cannot deduct a loss on the sale of a personal residence. You can deduct capital losses on investment property or business property against capital gains from other sales, or up to $3,000 per year against ordinary income.

What if I owned the property for exactly one year?

If you owned it for one year or less, the gain is short-term and taxed at your ordinary income rate. The holding period is measured from the date you acquired the property to the date you sold it. One year and one day qualifies as long-term. One year exactly does not.

Can I deduct real estate agent commissions from my capital gain?

No. Commissions and other selling costs reduce the net proceeds you receive, but they do not reduce the sale price used to calculate capital gain. Your gain is still the sale price minus your adjusted basis. However, selling costs do reduce your net profit, which matters for cash flow.

Do I have to report the sale if my gain is below a certain amount?

You must report the sale on your tax return regardless of the amount of gain. Even if the gain is small or you had a loss, the transaction goes on Form 8949 and Schedule D. The IRS receives a copy of the settlement statement from the title company, so the sale is already reported to them.

What if I made improvements but do not have receipts?

Without receipts, you cannot claim the improvement as part of your basis. Keep all invoices, receipts, and permits for any work done on the property. If you have lost documentation, you may be able to reconstruct it by contacting contractors or suppliers, but the IRS will not accept estimates or memory alone.