The main way to avoid capital gains tax on a home sale is the primary residence exclusion

If you own a home and live in it as your main residence, you can exclude up to $250,000 of profit from capital gains tax if you are single, or $500,000 if you are married filing jointly. This exclusion applies when you sell, meaning you only pay tax on the profit above those thresholds. You must have owned the home and lived in it for at least two of the five years before the sale.

This is the largest tax break most homeowners will ever receive. It means a single person can sell a home they bought for $300,000 and sell it for $550,000 — a $250,000 gain — and owe zero federal capital gains tax on that profit. A married couple with the same numbers owes nothing on a $500,000 gain.

The exclusion is available once every two years. If you sold a home and used the exclusion, you cannot use it again until two years have passed, even if you buy and sell a different home in the meantime.

Key Takeaways

  • The primary residence exclusion lets you exclude $250,000 (single) or $500,000 (married) of home sale profit from federal tax if you lived there two of the last five years.
  • You can use the exclusion once every two years, and it applies automatically — you do not need to claim it separately on your return.
  • If your profit exceeds the exclusion amount, you pay long-term capital gains tax on the remainder, which is lower than ordinary income tax rates.
  • Keeping records of home improvements and the original purchase price helps you calculate your actual profit accurately and may lower your tax bill.
  • State and local taxes on home sales vary widely; some states have no capital gains tax, while others tax the full profit above the federal exclusion.

How the primary residence exclusion actually works

The exclusion is not something you have to explore for or claim separately. It is built into the tax code, and the IRS assumes you are may be able to access unless you tell them otherwise. When you file your tax return in the year you sell, you report the sale on Schedule D (Capital Gains and Losses). The exclusion reduces your taxable gain automatically.

Your profit is the sale price minus your cost basis. Cost basis is what you paid for the home plus the cost of major improvements — a new roof, a kitchen renovation, an addition — but not routine maintenance like painting or repairs. If you bought the home for $300,000 and spent $50,000 on a new roof and kitchen, your basis is $350,000. If you sell for $550,000, your gain is $200,000, which is entirely covered by the $250,000 exclusion.

If you are married and file jointly, both spouses must meet the ownership and use test. If one spouse does not, you can still claim the exclusion, but it is limited to $250,000 instead of $500,000.

What happens if your profit exceeds the exclusion

Profit above the exclusion amount is taxed as a long-term capital gain. Long-term capital gains rates are 0%, 15%, or 20% depending on your total income for the year — much lower than ordinary income tax rates, which go up to 37%. Most people in the middle income range pay 15% on long-term gains.

If you are single and sell a home for a $400,000 gain, the first $250,000 is tax-free. The remaining $150,000 is taxed at your long-term capital gains rate. At 15%, that is $22,500 in federal tax. At 0%, it is zero.

Your long-term capital gains rate depends on your taxable income for the year, not on how much you made from the home sale. If you have a low income year, you might pay 0% on the gain. If you have a high income year, you might pay 20%. This is one reason some people time home sales strategically — selling in a year when other income is lower can reduce the tax rate on the gain.

Documenting improvements to lower your taxable profit

The more you can prove you spent on improvements, the higher your cost basis, and the lower your taxable gain. Keep receipts and invoices for any major work: roof replacement, HVAC system, windows, siding, deck, kitchen or bathroom renovation, foundation repair, or electrical or plumbing upgrades.

Do not include repairs or maintenance. Replacing a broken window is a repair. Replacing all the windows in the house is an improvement. Repainting is maintenance. Adding a new room is an improvement. The line is whether the work extends the life of the home or adds value, or straightforward keeps it in working order.

If you have records going back years, gather them now. If you do not have receipts, you can sometimes reconstruct them from bank statements, credit card statements, or contractor websites. The IRS does not require original receipts — a clear copy or a statement from the contractor is acceptable. The stronger your documentation, the less likely you will face a question if the IRS audits your return.

State and local taxes on home sales

The federal exclusion applies everywhere, but state and local taxes vary. Some states have no capital gains tax at all. Others tax the full gain above the federal exclusion. A few states have special rules for home sales.

California, for example, has no special exclusion — it taxes capital gains as ordinary income at rates up to 13.3%. If you sell a home with a $300,000 gain in California and are single, you exclude $250,000 federally but owe California tax on the full $300,000. New York has a similar approach. Texas, Florida, and Washington have no state income tax at all, so there is no state capital gains tax.

If you are selling a home in a state with high capital gains or income tax, the state tax can be larger than the federal tax. Research your state's rules before you sell, and consider whether timing the sale in a lower-income year could reduce your state tax as well.

Special situations: divorce, inherited homes, and rental property

If you are going through a divorce and one spouse keeps the home, the spouse who keeps it can still use the full $500,000 exclusion if they meet the ownership and use test. The two-year ownership period includes time before the divorce.

If you inherit a home, you receive a "step-up" in basis. This means your cost basis is the home's fair market value on the date of death, not what the previous owner paid. If your parent bought the home for $200,000 and it is worth $500,000 when they die, your basis is $500,000. If you sell it when ready for $500,000, you have no gain and owe no tax. This step-up is separate from the primary residence exclusion and is one of the largest tax benefits in the code.

If you rent out the home or use it for business, you cannot use the primary residence exclusion. The exclusion is only for homes where you lived as your main residence. If you converted a rental property to your primary residence, you must have lived there for two of the five years before the sale to use the exclusion, and the exclusion only applies to the gain from the years you lived there, not the years you rented it.

Timing your sale and other planning strategies

If you are close to the two-year mark on ownership and use, waiting a few months to cross the threshold can mean the difference between owing tax and owing nothing. If you are single and have a $300,000 gain, waiting until you have lived there two years lets you exclude the full $250,000 instead of a smaller amount.

If you are married and one spouse has lived in the home for two of the last five years but the other has not, you can still claim the exclusion — it is just limited to $250,000 instead of $500,000. If waiting a few months lets the second spouse meet the test, it is worth the wait.

If you have a very large gain and expect to owe significant tax, consider whether you can spread the sale across two tax years. Some sales close in December but do not settle until January. The gain is typically reported in the year the sale closes, not the year it settles, but the timing can matter. Consult a tax professional if your gain is large enough that the timing could affect your tax bracket or your may be able to access for other tax benefits.

Frequently Asked Questions

Do I have to live in the home for the full two years before I sell?

No. You must have owned it and lived in it for at least two of the five years before the sale. You can have moved out three years ago and still use the exclusion if you lived there for two years at some point in the five years before selling. The two years do not have to be consecutive.

What if I sell the home at a loss?

You cannot deduct a loss on the sale of your primary residence. If you bought for $400,000 and sell for $350,000, you have a $50,000 loss, but you cannot use it to reduce other income. The exclusion only matters when you have a gain.

Can I use the exclusion if I am not a U.S. citizen?

Yes, if you are a resident alien or a nonresident alien with a U.S. tax filing requirement. Nonresident aliens have different rules and may face additional tax. Consult a tax professional if you are not a U.S. citizen, as your situation may be complex.

Do I owe tax on the sale if my gain is below the exclusion amount?

No. If you are single with a $200,000 gain, the entire amount is covered by the $250,000 exclusion, and you owe no federal capital gains tax. You still have to report the sale on your tax return, but your taxable gain is zero.

What if I sell the home less than two years after buying it?

You cannot use the primary residence exclusion. Any gain is taxed as a short-term capital gain at your ordinary income tax rate, which is higher than the long-term rate. This is one reason financial advisors suggest staying in a home for at least two years before selling.