You may owe capital gains tax on the profit from selling your house, but most homeowners don't

Capital gains tax applies to the profit you make when you sell a house — the difference between what you paid for it and what you sold it for. However, the federal government lets you exclude up to $250,000 of that profit from taxation if you're single, or $500,000 if you're married filing jointly, as long as you meet two conditions: you owned the house for at least two of the last five years before the sale, and you lived in it as your primary residence for at least two of those same five years. This means most people who sell a home they've lived in pay no federal capital gains tax at all.

If your profit exceeds the exclusion amount, you'll owe tax on the excess. The tax rate depends on your overall income for the year — it's either 0%, 15%, or 20% at the federal level. Some states also tax capital gains on real estate sales, and the rules vary by state. Your mortgage interest and property taxes paid during ownership do not reduce your capital gains; only the actual purchase price and certain improvements to the house count toward your basis.

Key Takeaways

  • You can exclude $250,000 (single) or $500,000 (married) of profit from federal tax if you owned and lived in the house for two of the last five years.
  • Capital gains tax applies only to profit above the exclusion amount, and the rate is 0%, 15%, or 20% depending on your total income for the year.
  • Improvements you made to the house — like a new roof or kitchen — add to your cost basis and reduce your taxable profit, but routine maintenance does not.
  • Some states tax capital gains on real estate; others do not, so your state of residence matters when calculating what you owe.
  • You report the sale on Form 8949 and Schedule D when you file your tax return; your real estate agent or title company can provide the sale price and closing documents you'll need.

How capital gains tax is calculated on a house sale

Your taxable gain is the sale price minus your cost basis. Cost basis is what you originally paid for the house plus the cost of any improvements — a new foundation, roof, deck, or major system replacement. It does not include routine maintenance like painting, repairs, or landscaping. If you inherited the house, your basis is typically the fair market value on the date of the person's death, not what they paid for it.

Once you know your gain, you subtract the exclusion ($250,000 or $500,000). If the result is zero or negative, you owe no federal capital gains tax. If it's positive, that amount is taxed at your long-term capital gains rate. Long-term capital gains rates are 0%, 15%, or 20% depending on your taxable income for the year — not the sale price. You can find your rate by checking IRS tables or asking a tax professional what your income bracket is.

Example: You bought a house for $300,000, made $50,000 in improvements, and sold it for $600,000. Your cost basis is $350,000. Your gain is $250,000. If you're single and meet the ownership and residence test, you exclude $250,000, leaving $0 taxable. You owe no federal capital gains tax. If you're married and the gain was $600,000 instead, you'd exclude $500,000 and owe tax on $100,000.

The primary residence exclusion and who qualifies

The primary residence exclusion is the main reason most homeowners pay no capital gains tax. To use it, you must have owned the house and lived in it as your main home 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 — you could have lived there years one and three, for example, and still may have access to.

If you're married filing jointly, both spouses do not have to meet the test, but at least one must. If you're divorced or widowed, you may still use the full $500,000 exclusion if the sale happens within two years of the divorce or death, provided you meet the ownership and residence test.

You can use this exclusion only once every two years. If you sold a house and used the exclusion two years ago, you can use it again now. If you used it less than two years ago, you cannot use it on this sale.

State capital gains taxes on real estate

Most states do not tax capital gains on real estate sales at all — they tax only the sale itself through transfer taxes or sales taxes. However, some states do tax capital gains, and the rules differ. California, for example, taxes capital gains as ordinary income with no exclusion for primary residences. New York taxes capital gains but offers a partial exclusion for primary residences under certain conditions. A few states have recently passed capital gains taxes that explore to high-income earners.

Check your state's Department of Revenue or tax authority website to learn whether your state taxes capital gains on real estate and what the rate is. If you're moving out of state before selling, the state where you lived when you sold the house is generally the one that taxes the gain, not the state where you're moving to.

What counts as an improvement versus maintenance

Improvements add to your cost basis and reduce your taxable gain. Maintenance and repairs do not. The difference is whether the work adds value to the house or extends its useful life, or whether it straightforward keeps it in its current condition.

Improvements include a new roof, new foundation work, a deck or patio, a new kitchen or bathroom, new windows, a furnace or air conditioning system, or an addition. Painting the interior, fixing a leaky faucet, replacing broken shingles, or patching drywall are maintenance and do not count. If you're unsure, ask a tax professional — the IRS distinguishes based on whether the work is capital in nature, and the line can be blurry for some projects.

Keep receipts and invoices for any work you had done. When you sell, you'll need to document the improvements you made so you can add them to your basis. If you did the work yourself, you can include the cost of materials but not the value of your own labor.

Reporting the sale on your tax return

You report the sale using Form 8949 (Sales of Capital Assets) and Schedule D (Capital Gains and Losses). Your real estate agent or title company will provide you with a closing statement that shows the sale price and closing costs. You'll need the original purchase price and documentation of any improvements.

If your gain is below the exclusion amount and you owe no tax, you still need to report the sale on your return — you cannot straightforward skip it. File Form 8949 and Schedule D showing the sale, the gain, and the exclusion you claimed. If you do not report it, the IRS may send you a notice asking why.

If you're unsure how to calculate your basis or whether your improvements count, a tax professional or CPA can help. The cost of getting information is often less than the cost of underpaying or overpaying tax on a large sale.

Special situations: inherited homes, rental properties, and second homes

If you inherited a house and then sold it, your cost basis is the fair market value on the date the previous owner died, not what they paid for it. This "stepped-up basis" can mean you owe little or no capital gains tax even if the house appreciated significantly after the death. You still need to own and live in it for two of the five years before the sale to use the primary residence exclusion.

If you owned a rental property or second home and then converted it to your primary residence, the exclusion applies only to the years you lived in it as your main home, not the years you rented it out. You may owe tax on the appreciation during the rental years. Similarly, if you used part of your house as a home office and claimed depreciation deductions, you'll owe tax on that depreciation when you sell, even within the exclusion amount.

If you sold a house at a loss — you sold it for less than you paid for it — you cannot deduct the loss on your personal tax return. Capital losses on personal residences are not deductible. You can only use capital losses to offset capital gains from other investments.

Frequently Asked Questions

Do I have to report the sale if I don't owe any tax?

Yes. You must file Form 8949 and Schedule D showing the sale, your gain, and the exclusion you claimed, even if the result is zero tax owed. The IRS matches your return against the closing statement your title company files, so reporting it protects you from a notice later.

What if I sold the house before living in it for two years?

You cannot use the primary residence exclusion. You'll owe capital gains tax on the full profit above your cost basis. However, you may be able to claim a partial exclusion if you sold due to a change in employment, health, or unforeseen circumstances — ask a tax professional about the rules for your situation.

Does the exclusion explore if I'm married but filing separately?

If you're married filing separately, each spouse can exclude only $250,000, not $500,000. Filing jointly is almost always better for this reason. Consult a tax professional before deciding how to file.

Can I use the exclusion if I sold the house to a family member?

Yes, the exclusion applies regardless of who bought the house. The IRS does not care whether you sold to a stranger or a relative — the same rules explore. However, if the sale price is significantly below fair market value, the IRS may question whether it was a genuine sale, so document the transaction carefully.

What if I lived in the house for only one year before selling?

You do not meet the two-year test and cannot use the primary residence exclusion. You'll owe capital gains tax on the full profit. The only exception is if you sold due to a change in employment, health, or unforeseen circumstances — in that case you may claim a partial exclusion equal to the fraction of two years you actually lived there.