The basic formula: what you sold it for minus what you paid for it

Capital gains tax on property is calculated by taking your sale price and subtracting your cost basis — the original purchase price plus certain improvements you made. The result is your gain. You pay tax only on that gain, not on the full sale price.

For example: you bought a rental house for $200,000, spent $50,000 on a new roof and foundation repairs, and sold it for $350,000. Your cost basis is $250,000 ($200,000 + $50,000). Your capital gain is $100,000 ($350,000 − $250,000). That $100,000 is what gets taxed, not the $350,000 sale price.

The tax rate you pay on that gain depends on how long you owned the property and your income level. Long-term gains (property held more than one year) are taxed at lower rates than short-term gains, which are taxed as ordinary income.

Key Takeaways

  • Capital gain equals sale price minus cost basis; cost basis includes the purchase price plus the cost of permanent improvements like a new roof or foundation work.
  • Long-term capital 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 at your regular tax bracket.
  • 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.
  • Depreciation claimed on rental or business property reduces your cost basis and creates a "recapture" tax at 25% on that portion of the gain.
  • Closing costs, real estate commissions, and legal fees reduce your net sale proceeds but do not reduce your cost basis for tax purposes.

What counts as your cost basis

Your cost basis is not just what you paid for the property. It includes the purchase price plus the cost of any capital improvements — permanent upgrades that add value or extend the life of the property. New roofing, a new HVAC system, a deck, a pool, foundation repair, or a room addition all count. Painting, landscaping, and routine maintenance do not.

Keep receipts and invoices for any work you have done. When you sell, you will report these improvements on Schedule D (Form 1040), which is where you report capital gains and losses to the IRS. If you cannot document an improvement, the IRS will not let you add it to your basis.

If you inherited the property, your cost basis is usually the fair market value on the date of the person's death, not what they originally paid. This is called a stepped-up basis and can significantly reduce your taxable gain.

Long-term versus short-term capital gains rates

How long you owned the property determines which tax rate applies. If you held it for more than one year, it is a long-term gain. If you sold it within one year of purchase, it is a short-term gain.

Short-term gains are taxed as ordinary income — at your regular federal tax bracket, which ranges from 10% to 37% depending on your income. Long-term gains are taxed at preferential rates: 0%, 15%, or 20%, depending on your total income for the year. For 2024, the 0% rate applies to single filers with taxable income up to $47,025; the 15% rate applies up to $518,900; and anything above that is taxed at 20%.

These income thresholds change each year, so check the IRS website or Form 1040 instructions for the year you are selling. The advantage of long-term treatment is substantial — a $100,000 gain taxed at 15% costs $15,000, while the same gain taxed at your ordinary rate could cost $24,000 or more.

The primary residence exclusion

If you are selling a home you lived in as your primary residence, you may be able to exclude a large portion of your gain from tax entirely. You can exclude up to $250,000 of gain if you are single, or $500,000 if you are married filing jointly.

To may have access to, you must have owned the home and lived in it as your main home for at least two of the last five years before the sale. The two years do not have to be consecutive. If you meet these conditions, you do not report the excluded gain on your tax return at all.

This exclusion is available once every two years. If you sold another home and used the exclusion within the past two years, you cannot use it again. If your gain exceeds the exclusion amount — for instance, you are single and your gain is $400,000 — you pay tax only on the excess $150,000.

Depreciation recapture on rental and business property

If you rented out the property or used it for business, you likely claimed depreciation deductions on your tax returns each year. Depreciation reduces your taxable income while you own the property, but it also reduces your cost basis when you sell.

When you sell, the IRS taxes the depreciation you claimed at a rate of 25%, regardless of your income level or how long you owned the property. This is called depreciation recapture. The remaining gain is taxed as a long-term capital gain at the preferential rates (0%, 15%, or 20%).

Example: you bought a rental house for $300,000 and claimed $60,000 in depreciation over ten years. Your adjusted cost basis is now $240,000. You sell for $400,000. Your total gain is $160,000. Of that, $60,000 is recapture (taxed at 25% = $15,000), and $100,000 is long-term capital gain (taxed at 15% or 20% depending on your income). The recapture portion cannot be excluded or reduced.

How closing costs and commissions affect your calculation

Real estate commissions, title insurance, attorney fees, and other closing costs reduce the amount of money you actually receive from the sale. However, they do not reduce your cost basis for tax purposes.

Instead, they reduce your net sale proceeds. If you sold for $350,000 but paid $21,000 in commissions and closing costs, your net proceeds are $329,000. For tax purposes, your sale price is still $350,000, but your actual cash is $329,000. The difference is a real cost to you, but it does not lower your taxable gain.

Some sellers mistakenly try to deduct these costs as a loss. You cannot. They are part of the cost of selling, already reflected in the lower amount of money you take home.

Reporting your gain on your tax return

You report capital gains from property sales on Schedule D (Form 1040), which is filed with your federal income tax return. Schedule D asks for the date you bought the property, the date you sold it, your cost basis, your sale price, and your gain or loss.

If your gain qualifies as long-term, you will also complete Form 8949 (Sales of Capital Assets), which feeds into Schedule D. The IRS uses these forms to match your reported gain against any 1099-S forms your real estate agent or title company may have filed.

If you had a loss instead of a gain — you sold for less than your cost basis — you can use that loss to offset other capital gains. If you have no other gains, you can deduct up to $3,000 of capital loss against ordinary income in a single year, with any remaining loss carried forward to future years.

State and local taxes on property sales

Federal capital gains tax is only part of the picture. Many states tax capital gains as ordinary income, some at rates higher than the federal rate. A few states have no income tax at all. Some cities impose local income taxes on gains.

New York, for example, taxes long-term capital gains at ordinary income rates, which can be as high as 10.9% at the state level. California taxes all capital gains as ordinary income with no preferential rate. If you are selling property in a state with a high income tax, your total tax bill — federal plus state — can be significantly higher than the federal rate alone.

Check your state's tax authority website or speak with a tax professional in your state to understand what you owe locally. State rules vary widely and change frequently.

Frequently Asked Questions

Do I have to pay capital gains tax if I sell my primary home?

Not if your gain is under $250,000 (or $500,000 if married filing jointly) and you lived in the home as your main residence for at least two of the last five years. If your gain exceeds those amounts, you pay tax only on the excess. The primary residence exclusion is automatic — you do not have to do anything special to claim it, but you must report the sale on Schedule D.

What if I inherited the property and then sold it?

Your cost basis is the fair market value on the date the person died, not what they originally paid. This stepped-up basis usually means little or no taxable gain, even if the property is worth much more now. You still report the sale on Schedule D, but your gain will typically be small or zero.

Can I deduct the cost of selling — realtor commission, title insurance, attorney fees — from my gain?

No. These costs reduce the money you actually receive, but they do not reduce your taxable gain. Your sale price for tax purposes is the full amount the buyer paid, even though you net less after paying these costs. You cannot deduct them as a loss.

What is the difference between cost basis and adjusted cost basis?

Cost basis is your original purchase price plus improvements. Adjusted cost basis is cost basis minus depreciation you claimed. If you rented the property or used it for business, depreciation reduces your adjusted basis. When you sell, you calculate gain using adjusted basis, not original cost basis.

If I sell at a loss, can I deduct it?

Yes, but only against other capital gains. If you have no capital gains, you can deduct up to $3,000 of capital loss against ordinary income in one year. Any loss beyond that carries forward to future years. You report the loss on Schedule D.