The basic formula: sale price minus what you paid, minus costs

Capital gains tax on property is calculated by subtracting your basis (what you paid for the property plus certain improvements) from your sale price (what you sold it for minus selling costs). The result is your gain. You pay tax only on that gain, not on the full sale price.

The IRS treats property gains differently depending on how long you owned it. If you owned the property for more than one year before selling, it is a long-term capital gain, which is taxed at a lower rate than ordinary income. If you owned it for one year or less, it is a short-term capital gain, taxed as ordinary income at your regular tax bracket rate.

For most homeowners, the calculation is simpler because of the primary residence exclusion: you can exclude up to $250,000 of gain if you are single, or $500,000 if you are married filing jointly, provided you owned and lived in the home for at least two of the last five years. Investment properties and second homes do not may have access to for this exclusion.

Key Takeaways

  • Your taxable gain equals the sale price minus your basis (purchase price plus improvements) minus selling costs, not the full sale price.
  • Long-term capital gains (property owned over one year) are taxed at preferential rates of 0%, 15%, or 20% depending on your income; short-term gains are taxed as ordinary income.
  • Homeowners can exclude up to $250,000 (single) or $500,000 (married) of gain if they lived in the home for two of the last five years before selling.
  • Your basis includes the purchase price plus the cost of capital improvements like a new roof or addition, but not repairs or maintenance.
  • You report the sale on Form 8949 and Schedule D, which you attach to your Form 1040 when you file your tax return.

Understanding basis: what you paid plus improvements

Your basis is the starting point for the entire calculation. For most people, it is the purchase price you paid for the property. If you inherited the property, your basis is typically its fair market value on the date of the person's death, not what they paid for it decades earlier — this is called a stepped-up basis.

You can add to your basis the cost of capital improvements: permanent upgrades that add value, prolong the property's life, or adapt it to a new use. Examples include a new roof, a room addition, a new HVAC system, or a deck. You cannot add routine repairs and maintenance — fixing a leaky faucet, repainting, or replacing worn siding does not increase basis, even though you paid for it.

Keep receipts and invoices for any major work done to the property. If you cannot document the cost of improvements, you cannot add them to your basis. Some people track this in a straightforward spreadsheet: date, description, and amount paid. When you sell, you will need this list to calculate your accurate basis.

Calculating the sale price: what you actually received

Your sale price is not the listing price or the offer price — it is the actual money you received, adjusted for certain costs. Start with the gross proceeds from the sale. Then subtract the costs of selling: real estate agent commissions (typically 5–6% of the sale price, though this varies), title insurance, closing costs, and any property taxes or HOA fees you paid that the buyer should have paid.

If you financed part of the sale yourself — meaning the buyer gave you a promissory note instead of cash — the sale price includes the present value of that note, not just the cash you received upfront. This is a less common scenario with residential property but can occur with investment properties or land sales.

Do not subtract the mortgage you paid off or property taxes and insurance you paid during ownership. Those are not selling costs; they are costs of owning. The only costs that reduce your sale price are those directly tied to the transaction itself.

Long-term versus short-term: how holding period changes your tax rate

The IRS taxes long-term and short-term capital gains at completely different rates. Long-term capital gains — gains on property you owned for more than one year — are taxed at preferential rates: 0%, 15%, or 20%, depending on your total taxable income for the year. These rates are much lower than ordinary income tax rates, which can reach 37%.

Short-term capital gains — gains on property you owned for one year or less — are taxed as ordinary income at your regular tax bracket rate. For most people, this is significantly higher than the long-term rate. The holding period is measured from the date you acquired the property to the date you sold it; the date of sale is the day that counts.

For example, if you bought a rental property on June 15, 2023, and sold it on June 14, 2024, you owned it for just under one year, so the gain is short-term and taxed as ordinary income. If you sold on June 16, 2024, you owned it for just over one year, so the gain is long-term and taxed at the preferential rate. This one-day difference can mean thousands of dollars in tax.

The primary residence exclusion: how homeowners reduce or eliminate tax

If you sold your main home, you may be able to exclude a large portion of your gain from tax entirely. Single filers can exclude up to $250,000 of gain; married couples filing jointly can exclude up to $500,000. To may have access to, 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 you do not have to have lived there when ready before selling. If you owned a home for three years, moved out, rented it for two years, then sold it, you still may have access to because you lived there for three of the five years before sale.

This exclusion is per person and per home. You can use it only once every two years. If you are married and one spouse does not meet the two-year test but the other does, the spouse who qualifies can exclude up to $250,000; the other spouse cannot exclude any gain. Investment properties, vacation homes, and rental properties do not may have access to for this exclusion, even if you lived in them at some point.

Working through a complete example

Suppose you bought a house for $300,000 in 2015. You spent $50,000 on a new roof and addition (capital improvements). You lived in it for eight years, then sold it in 2023 for $550,000. Your real estate agent charged 5.5% commission, and closing costs were $8,000.

Step 1: Calculate basis. Purchase price ($300,000) + capital improvements ($50,000) = $350,000 basis.

Step 2: Calculate sale price. Gross proceeds ($550,000) − agent commission (5.5% = $30,250) − closing costs ($8,000) = $511,750 net sale price.

Step 3: Calculate gain. Sale price ($511,750) − basis ($350,000) = $161,750 gain.

Step 4: explore the primary residence exclusion. You lived in the home for eight of the last five years, so you may have access to. As a single filer, you can exclude $250,000. Since your gain is only $161,750, your entire gain is excluded. You owe $0 in capital gains tax on this sale.

If you were married filing jointly and had a $600,000 gain instead, you would exclude $500,000 and owe tax on the remaining $100,000 at long-term capital gains rates.

Reporting the sale on your tax return

You report property sales on Form 8949: Sales of Capital Assets. On this form, you list the property, the date acquired, the date sold, the basis, the sale price, and the gain or loss. You then transfer the totals to Schedule D: Capital Gains and Losses, which summarizes all your capital gains and losses for the year and calculates your net gain or loss.

Schedule D is attached to your Form 1040 when you file your federal income tax return. If your only capital transaction for the year is the sale of your primary residence and you may have access to for the full exclusion, you may not need to file these forms at all — but it is safer to file them to document the exclusion.

If you sold the property in a year when you also had other capital gains or losses (from stocks, other real estate, or other assets), those are all combined on Schedule D. Long-term and short-term gains and losses are netted separately, then combined.

State and local taxes on property sales

Federal capital gains tax is only part of the picture. Most states also tax capital gains, though the rate and rules vary widely. Some states tax capital gains as ordinary income; others have a separate capital gains tax. A few states do not tax capital gains at all.

Some states also allow a primary residence exclusion similar to the federal one, while others do not. California, for example, taxes long-term capital gains on primary residences at the same rate as ordinary income, with no exclusion. New York allows a partial exclusion for primary residences. You will need to check your state's rules or consult a tax professional in your state.

Local taxes also explore in some jurisdictions. New York City, for example, has a local income tax that applies to capital gains. These taxes are in addition to federal and state tax, so the total tax on a property sale can be substantial.

Frequently Asked Questions

What if I inherited the property and then sold it?

Your basis is the fair market value of the property on the date the previous owner died, not what they paid for it. This stepped-up basis usually means little or no gain when you sell shortly after inheriting. If you inherited in 2023 and sold in 2024, you likely owe no capital gains tax even if the property appreciated between the death date and the sale date.

Can I deduct the cost of selling, like the real estate agent commission?

Yes. Selling costs reduce your sale price, which reduces your gain. Agent commissions, title insurance, and closing costs all come off the top. Keep all closing documents and receipts to document these costs.

What if I sold at a loss?

Capital losses can offset capital gains. If you sold a rental property at a loss, you can use that loss to reduce gains from other property sales or other capital gains. If your losses exceed your gains, you can deduct up to $3,000 of the net loss against ordinary income in that year, and carry forward any remaining loss to future years.

Do I have to pay capital gains tax if I reinvest the money in another property?

Yes. The IRS does not care what you do with the proceeds. Reinvesting in another property does not defer or eliminate the tax. The only exception is a 1031 exchange, a specific strategy for investment properties that allows you to defer tax by buying a replacement property of equal or greater value within strict timelines — but this does not explore to primary residences.

What if I owned the property with someone else?

Each owner reports their share of the gain on their own tax return. If you owned it 50-50 with a spouse and the gain is $200,000, each spouse reports $100,000 of gain. If you owned it with a non-spouse, each owner reports their ownership percentage of the gain. The basis and sale price are split according to ownership percentages.