How capital gains tax works when you sell real estate

When you sell a house for more than you paid for it, the profit is called a capital gain, and the federal government taxes it. The tax rate depends on how long you owned the property and your total income for the year. Most homeowners pay between 0% and 20% in federal capital gains tax, though some pay 3.8% more on top of that. State and local taxes add another layer on top of the federal amount.

The key distinction is between long-term and short-term capital gains. If you owned the house for more than one year before selling, it counts as long-term, and you get lower tax rates. If you owned it for one year or less, it counts as short-term, and you pay ordinary income tax rates—which are usually much higher.

Most homeowners also get a major break: you can exclude up to $250,000 of gain if you're single, or $500,000 if you're married filing jointly, as long as you lived in the house as your primary residence for at least two of the last five years before the sale. That means many people owe zero federal capital gains tax on a home sale.

Key Takeaways

  • Long-term capital gains (property owned over one year) are taxed at 0%, 15%, or 20% federally, depending on your income; short-term gains are taxed as ordinary income at rates up to 37%.
  • You can exclude $250,000 (single) or $500,000 (married) of profit from federal tax if the house was your primary residence for at least two of the last five years.
  • Your state and local government may also tax capital gains, and the rates vary widely—some states have no capital gains tax, while others tax it like ordinary income.
  • The gain is calculated as the sale price minus your original purchase price plus the cost of major improvements, minus selling expenses like realtor commissions.
  • If you inherited the property, you may may have access to for a "step-up in basis," which can eliminate or drastically reduce the capital gains tax.

Federal tax rates for long-term capital gains

The federal government taxes long-term capital gains at three rates: 0%, 15%, or 20%. Which rate you pay depends on your taxable income for the year—not just the gain itself. The income thresholds change each year, so the exact cutoffs vary, but the structure stays the same.

For 2024, if you're single and your taxable income is under roughly $47,000, you pay 0% on long-term gains. Between roughly $47,000 and $518,000, you pay 15%. Above that, you pay 20%. If you're married filing jointly, the thresholds are higher—roughly $94,000 and $583,000. These numbers shift annually with inflation, so check the IRS website or your tax preparer for the current year's brackets.

This means a couple selling a house for a $300,000 gain might owe nothing in federal tax if their other income is low enough to keep them in the 0% bracket. The same gain could trigger a 15% or 20% tax bill if their income is higher.

Short-term capital gains and ordinary income tax

If you owned the property for one year or less before selling, the gain is taxed as short-term capital gain, which means it's taxed at your ordinary income tax rate. Those rates run from 10% to 37% depending on your total income and filing status—much steeper than long-term rates.

Short-term gains are rare in real estate because most people hold houses longer than a year. But they can happen if you buy a property, make quick improvements, and flip it within months. The tax hit is significant enough that it's one reason real estate investors usually hold properties for at least a year before selling.

The primary residence exclusion: $250,000 or $500,000

The biggest tax break for homeowners is the primary residence exclusion. If you lived in the house as your main home for at least two of the last five years before selling, you can exclude $250,000 of gain from federal tax (or $500,000 if you're married filing jointly). This exclusion applies once every two years.

This rule eliminates federal capital gains tax for most home sales. A single person who bought a house for $300,000, lived in it for five years, and sold it for $500,000 would have a $200,000 gain—all of which is covered by the $250,000 exclusion. They owe zero federal capital gains tax.

The exclusion does not explore if you used the house as a rental property or a second home. It also does not explore if you already used the exclusion on another property within the last two years. If you're married but filing separately, each spouse can exclude only $250,000.

How to calculate your capital gain

Your capital gain is not straightforward the sale price minus what you paid. The calculation includes adjustments for improvements and expenses.

Start with your cost basis. This is usually what you paid for the house, including closing costs like title insurance and recording fees. If you inherited the property, your basis is typically the fair market value on the date of death—this is called a "step-up in basis" and can wipe out most or all of the tax.

Add the cost of capital improvements. These are permanent upgrades that add value: a new roof, a kitchen remodel, an addition, a new HVAC system, or new windows. Repairs and maintenance do not count—painting, fixing a leak, or replacing a broken window are not deductible. The line between repair and improvement can be fuzzy; when in doubt, ask a tax professional.

Subtract selling expenses. Realtor commissions (typically 5–6% of the sale price), title insurance, transfer taxes, and attorney fees all reduce your gain. These are costs you paid to sell, not costs of owning.

The result is your taxable gain. If you bought for $300,000, spent $50,000 on a kitchen and roof, and sold for $500,000 after paying $25,000 in realtor fees, your gain is $500,000 − $300,000 − $50,000 + $25,000 = $175,000. (You subtract the improvements from the sale price because they increase your basis, and you add back the selling expenses because they reduce the net proceeds.)

State and local capital gains taxes

Federal tax is only part of the picture. Most states also tax capital gains, and the rates vary widely. Some states have no capital gains tax at all—including Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, and Wyoming. Others tax capital gains as ordinary income, which can mean rates of 10% or higher.

A few states have a separate capital gains tax that applies only to gains above a certain threshold. Washington State, for example, taxes long-term capital gains on the sale of stocks and certain other assets at 7%, but real estate is generally exempt. California taxes capital gains as ordinary income, with rates up to 13.3%.

Some cities and counties also impose local taxes on real estate sales or capital gains. New York City, for instance, has a real estate transfer tax. Check with your state's tax authority or a local tax professional to understand what you owe where you live.

Special situations: inherited property and investment real estate

If you inherited a house, you usually get a step-up in basis. This means your cost basis is the fair market value of the house on the date the previous owner died, not what they originally paid. If the house was worth $400,000 when you inherited it and you sold it a year later for $420,000, your gain is only $20,000—even if the original owner bought it for $100,000 decades ago. This can eliminate most or all of the capital gains tax.

If you own investment property or a rental house, the rules are different. You cannot use the primary residence exclusion, so you owe tax on the full gain. You also may owe depreciation recapture tax at 25% on the portion of the gain that comes from depreciation deductions you claimed while renting the property. This is a separate tax on top of capital gains tax, and it applies even if your long-term capital gains rate would otherwise be 0% or 15%.

Frequently Asked Questions

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

No. If you sell for less than you paid, you have a capital loss, not a gain. You cannot deduct the loss from your taxes (real estate losses are not deductible for personal residences). You straightforward owe no capital gains tax.

What if I owned the house with my spouse but we're now divorced?

If you transfer the house to your spouse as part of a divorce settlement, there is no capital gains tax on the transfer itself. When the house is later sold, the person who receives it can use the primary residence exclusion if they meet the requirements. Consult a tax professional about your specific situation, as timing and ownership structure matter.

Can I avoid capital gains tax by gifting the house to my children instead of selling it?

You can gift the house, but your children will not get a step-up in basis unless you die. If they later sell, they will owe capital gains tax on the full gain from your original purchase price. If you die and they inherit, they get the step-up and owe much less tax. Gifting during your lifetime does not reduce the eventual tax burden.

Do I have to report the sale to the IRS even if I owe no tax?

Yes. You report the sale on Form 8949 and Schedule D of your tax return, even if the primary residence exclusion means you owe zero tax. The IRS wants a record of all sales. Your title company or realtor will provide a Form 1099-S, which the IRS also receives.

What if I used part of the house as a home office or rental?

The primary residence exclusion applies only to the portion of the house you used as your primary residence. If you rented out part of it or claimed a home office deduction, you may owe capital gains tax on that portion. The calculation depends on the percentage of the house that was used for business. A tax professional can help you determine the split.