What capital gains tax means when you sell a house or property

Capital gains tax is the federal tax you owe on the profit you make when you sell real estate. It is not a tax on the sale price itself — it is a tax only on how much the property increased in value while you owned it. If you bought a house for $300,000 and sold it for $400,000, your capital gain is $100,000, and that is the amount the IRS taxes, not the full $400,000.

The calculation itself is straightforward: sale price minus what you paid for it, minus certain costs you can deduct. The tax rate depends on how long you owned the property and your income level. Most people who sell a primary residence owe nothing because the IRS lets you exclude up to $250,000 of gain if you are single, or $500,000 if you are married filing jointly — but only if you meet specific rules about how long you lived there.

Real estate capital gains are reported on Schedule D (Form 1040), the same form used for stock sales and other investments. If you inherited the property, the rules change significantly because of something called step-up in basis, which can eliminate the tax entirely.

Key Takeaways

  • Capital gain equals the sale price minus your original purchase price, minus deductible costs like improvements and selling fees.
  • You may owe no tax at all if you lived in the home as your primary residence for at least two of the last five years, because of the primary residence exclusion ($250,000 single, $500,000 married).
  • If you inherited the property, you typically owe no capital gains tax because inherited property receives a step-up in basis to its value on the date of death.
  • Long-term capital gains (property held over one year) are taxed at 0%, 15%, or 20% depending on your income; short-term gains are taxed as ordinary income.
  • You must report the sale on Schedule D even if you owe no tax, and you may also owe state capital gains tax depending on where you live.

How to calculate your cost basis — what you actually paid

Basis is what the IRS calls your starting point for calculating gain. For most people, basis is straightforward the purchase price of the property. But basis is not just the down payment — it includes the full purchase price, whether you paid cash or financed it with a mortgage.

You can add to your basis by including certain costs paid at closing: real estate transfer taxes, title insurance, recording fees, and attorney fees directly related to the purchase. You can also add the cost of major improvements — a new roof, a room addition, a new HVAC system, a deck. These are called capital improvements because they add value to the property or extend its life. You cannot deduct routine repairs like painting, fixing a leak, or replacing a broken window, because those just maintain the property at its current condition.

Keep receipts and closing documents for everything you add to basis. The IRS may ask for proof, especially if the gain is large or if you claim a significant amount in improvements.

Subtracting selling costs from your gain

When you sell, you can subtract the costs of selling from your sale price before calculating the gain. These include real estate agent commissions (typically 5–6% of the sale price, but this varies), title insurance for the buyer, recording fees, attorney fees for the sale, and transfer taxes. Some states and counties charge a transfer tax; others do not.

Do not subtract mortgage payoff, property taxes, or homeowner's insurance — these are not selling costs. The mortgage payoff is straightforward money you owed; it does not reduce your gain. Property taxes and insurance are expenses of ownership, not of the sale itself.

Your net sale proceeds (the check you receive) are not the same as your sale price. If you sold for $400,000 and paid $24,000 in agent commission and $2,000 in closing costs, your sale price for tax purposes is still $400,000, but your net proceeds are $374,000. The gain calculation uses the full $400,000.

The primary residence exclusion — when you owe zero tax

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 $250,000 of gain from tax if you are single, or $500,000 if you are married filing jointly. This is called the Section 121 exclusion, and it is one of the largest tax breaks available.

The two years do not have to be consecutive, and they do not have to be the most recent two years. If you owned the house for five years but lived in it for only the first two years, you still may have access to. If you owned it for three years and lived in it for two of those three, you may have access to.

You can use this exclusion only once every two years. If you sold a home and used the exclusion in 2022, you cannot use it again until 2024. If you are married, both spouses must meet the ownership and use test to claim the full $500,000 exclusion; if only one spouse meets the test, the exclusion is $250,000.

Example: You bought a house for $300,000, lived in it for three years, and sold it for $450,000. Your gain is $150,000. You are single and meet the two-year test, so you exclude $250,000 — but your gain is only $150,000, so you owe tax on $0. You report the sale on Schedule D, but you owe no capital gains tax.

Long-term versus short-term capital gains rates

If you held the property for more than one year before selling, the gain is long-term and 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.

If you held the property for one year or less, the gain is short-term and taxed as ordinary income at your regular tax bracket — which could be 10%, 12%, 22%, 24%, 32%, 35%, or 37%, depending on your income and filing status.

For real estate, short-term gains are rare unless you buy and sell quickly. Most people hold homes for years, so long-term rates explore. The 0% rate applies to lower-income taxpayers; the 15% rate applies to most middle-income taxpayers; the 20% rate applies to high-income taxpayers. The exact income thresholds change each year and depend on filing status.

What happens if you inherited the property

If you inherited real estate, the rules are different and usually much better. Inherited property receives a step-up in basis to its fair market value on the date the person died. This means your basis is not what the original owner paid — it is what the property was worth when you inherited it.

Example: Your parent bought a house in 1990 for $150,000. It was worth $500,000 when they died in 2023. Your basis is $500,000, not $150,000. If you sell it in 2024 for $510,000, your gain is only $10,000, not $360,000. You may owe tax on the $10,000 gain, but the $350,000 increase that happened while your parent owned it is never taxed.

This step-up applies to most inherited property, including real estate, stocks, and bonds. It does not explore to inherited retirement accounts like IRAs or 401(k)s. If you inherited the property and then held it for more than one year before selling, the gain is long-term and taxed at the preferential rates described above.

State capital gains tax and other taxes you may owe

Federal capital gains tax is only part of the picture. Some states tax capital gains as ordinary income; others have a separate capital gains tax; others tax capital gains only on high earners; and some states do not tax capital gains at all. Where you live when you sell matters.

California, for example, taxes capital gains as ordinary income at rates up to 13.3%. New York taxes them at ordinary income rates up to 10.9%. Washington state has a 7% capital gains tax on long-term gains over $250,000. Florida, Texas, and several other states have no capital gains tax. If you moved out of state before selling, you may owe tax to your former state if you owned the property while living there.

You may also owe the Net Investment Income Tax (NIIT), which is an additional 3.8% federal tax on investment income, including capital gains, if your modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly).

How to report the sale on your tax return

Real estate sales are reported on Schedule D (Form 1040), the Capital Gains and Losses form. You list the property description, the date you bought it, the date you sold it, your basis, the sale price, and the gain or loss. If you used the primary residence exclusion, you note that on the form.

You may also receive a Form 1099-S from the title company or real estate agent if the sale price exceeded $600,000 (the threshold varies by state and changes year to year). This form reports the sale price to the IRS. You do not send the 1099-S with your return, but you should keep it with your records and make sure the information matches your Schedule D.

If you owe no tax because of the primary residence exclusion, you still file Schedule D to report the sale. The IRS wants to see that you calculated the gain correctly and that you meet the exclusion requirements.

Frequently Asked Questions

Do I owe capital gains tax if I sell my primary home?

Not if you lived in it as your primary residence for at least two of the five years before the sale. You can exclude $250,000 of gain (single) or $500,000 (married). If your gain is less than the exclusion, you owe no tax. If your gain exceeds the exclusion, you owe tax only on the excess.

What is the difference between basis and purchase price?

Basis is your purchase price plus closing costs and capital improvements, minus any depreciation you claimed (if you rented out the property). Purchase price alone is not enough — you must add in the costs that increased the property's value or your investment in it.

Can I deduct the cost of repairs and maintenance from my capital gain?

No. Repairs maintain the property but do not add value or extend its life, so they cannot be added to basis. Capital improvements — a new roof, an addition, a new HVAC system — can be added. The distinction is whether the work adds value or just keeps the property in working order.

What if I inherited the house and then sold it — do I owe capital gains tax?

Probably not on the gain that occurred before you inherited it. Your basis steps up to the property's value on the date of death, so only gains after that date are taxed. If you inherited it for $500,000 and sold it for $510,000 a year later, your gain is $10,000 and taxed at long-term rates.

Do I have to report the sale if I owe no capital gains tax?

Yes. You must file Schedule D even if you owe no tax, to show the IRS that you calculated the gain correctly and that you meet the primary residence exclusion requirements. Not reporting the sale can trigger an audit.