The primary residence exclusion is the main way most homeowners avoid capital gains tax entirely

If you have lived in your home as your main residence for at least two of the last five years before you sell, you can exclude up to $250,000 of gain from federal income tax if you are single, or up to $500,000 if you are married filing jointly. This exclusion applies only once every two years. The gain is the difference between what you paid for the house (your basis) plus the cost of improvements, and what you sold it for.

This exclusion is not automatic — you do not have to file anything extra with the IRS to claim it, but you do have to meet the ownership and use test. The two years do not have to be consecutive, and they do not have to be the most recent two years, though they must fall within the five-year window before the sale. If you lived in the house for only one year out of the last five, you do not may have access to for the full exclusion, though you may may have access to for a partial one if you sold because of a job change, health condition, or unforeseen circumstance.

Key Takeaways

  • The primary residence exclusion lets you exclude $250,000 (single) or $500,000 (married filing jointly) of home sale gain from federal income tax if you owned and lived in the house for two of the last five years.
  • Your basis in the home includes what you paid for it plus the cost of capital improvements like a new roof or addition, but not repairs or maintenance.
  • If your gain exceeds the exclusion limit, you owe capital gains tax on the excess at either 0%, 15%, or 20% depending on your income, not your ordinary income tax rate.
  • State capital gains taxes vary widely — some states do not tax capital gains at all, while others tax them as ordinary income or at a flat rate.
  • If you do not meet the two-year ownership and use test, you may still may have access to for a reduced exclusion if you sold because of a job, health issue, or other unforeseen circumstance.

How to calculate your gain and determine what you owe

Start with your adjusted basis, which is what you paid for the house plus the cost of any capital improvements. Capital improvements are permanent upgrades that add value to the home — a new roof, a deck, a finished basement, or a kitchen remodel. Do not include repairs or maintenance, even if they were expensive. Keep receipts and closing documents for anything you add to basis.

Subtract your adjusted basis from the sale price. That number is your gain. If the gain is less than $250,000 (or $500,000 if married filing jointly) and you meet the ownership and use test, you owe no federal capital gains tax. If the gain exceeds the exclusion, you owe tax only on the excess.

The tax rate on that excess depends on your long-term capital gains rate, which is 0%, 15%, or 20% based on your taxable income for the year, not the amount of the gain itself. These rates are lower than ordinary income tax rates. Your tax professional or the IRS Form 1040 instructions can tell you which bracket you fall into for the year of the sale.

When you do not meet the two-year test but may still reduce your tax

If you owned and lived in the home for less than two of the last five years, you normally cannot use the full primary residence exclusion. However, the IRS allows a reduced exclusion if you sold because of a change in your place of employment, a health condition, or an unforeseen circumstance.

The reduced exclusion is calculated as a fraction of the full exclusion. If you owned and lived in the home for one year instead of two, you can exclude half of the normal amount — $125,000 if single, $250,000 if married. The IRS defines unforeseen circumstances narrowly: death, divorce, multiple births from the same pregnancy, job loss, natural disaster, or damage to the home from fire, flood, or similar cause. Wanting to move for a better job opportunity does not may have access to, but being transferred by your employer does.

You report the reduced exclusion on Form 8949 and Schedule D when you file your tax return. You will need to document the reason for the sale — a job transfer letter, medical records, a divorce decree, or a casualty report.

State capital gains taxes and how they differ from federal tax

Federal capital gains tax is only part of what you may owe. Thirteen states do not tax capital gains at all: Alaska, Florida, Illinois, Indiana, Iowa, Kansas, Louisiana, Mississippi, Missouri, Nevada, South Dakota, Tennessee, and Texas. Nine states tax capital gains as ordinary income at their regular income tax rates, which can be significantly higher than the federal long-term rate. These are California, Connecticut, Maine, New Jersey, New York, Oregon, Vermont, Washington, and Washington D.C.

The remaining states either tax capital gains at a flat rate, tax only certain types of capital gains, or have special rules. For example, Colorado taxes capital gains at 4.63%, Hawaii at 7.25%, and New Mexico at 5.9%. Some states offer their own primary residence exclusions or exemptions, though they are less common than the federal one.

Check your state's tax authority website or speak with a tax professional in your state to understand what you owe at the state level. The state tax is separate from federal tax and is calculated on the same gain.

Timing the sale and managing your income to stay in a lower tax bracket

Because your long-term capital gains rate depends on your taxable income for the year, the year you sell matters. If you are close to the edge of a tax bracket, you may be able to reduce your rate by timing the sale or managing other income in that year.

For 2024, the 0% long-term capital gains rate applies to single filers with taxable income up to $47,025 and married filing jointly filers with taxable income up to $94,050. The 15% rate applies to income above those thresholds up to $518,900 (single) or $583,750 (married filing jointly). Income above those amounts is taxed at 20%. These thresholds change each year for inflation.

If you have a large gain and are near a bracket edge, you might sell in a year when you have lower other income, such as after retirement or a leave of absence. You might also bunch deductions or defer other income to the following year. These strategies require planning with a tax professional and are not always possible, but they can save significant tax if your situation allows.

What basis means and why keeping records matters

Your basis is what you paid for the house. If you bought it for $300,000, your basis is $300,000. If you inherited it, your basis is usually its fair market value on the date of death, not what the previous owner paid. If you received it as a gift, your basis is usually what the giver paid, though there are exceptions.

You increase your basis by the cost of capital improvements. If you added a $50,000 deck, your basis becomes $350,000. You do not increase basis for repairs, even major ones. The difference is that an improvement adds value or extends the life of the home, while a repair restores it to its previous condition. A new roof is an improvement; fixing a leak in an existing roof is a repair.

Keep all closing documents, receipts for improvements, and records of what you paid for materials and labor. The IRS may ask for these records if you report a large gain. If you cannot document an improvement, you cannot add it to your basis, which means your gain will be larger and your tax bill higher.

Special situations: divorce, inherited homes, and rental property

If you sell a home after a divorce, the primary residence exclusion still applies if you owned and lived in it for two of the last five years, even if your ex-spouse now owns it or lives elsewhere. Each spouse can claim the exclusion separately on their own return if they meet the test.

If you inherited a home and lived in it as your main residence for two of the last five years before selling, you can use the primary residence exclusion. Your basis is the home's fair market value on the date of death, not what the previous owner paid, so your gain is usually much smaller.

If you rented out the home or used part of it for business, the rules are different. You cannot use the primary residence exclusion for any period you did not live in it as your main home. If you lived in it for two years and rented it for one year, you can exclude gain only for the two years you lived there. You may also owe depreciation recapture tax on any depreciation you claimed while renting it.

Frequently Asked Questions

Do I have to report the sale if my gain is less than the exclusion amount?

You must report the sale on Form 8949 and Schedule D even if your entire gain is excluded. The IRS needs to see the transaction and verify that you meet the ownership and use test. Failing to report it, even when you owe no tax, can trigger an audit.

What if I sold my home before I lived in it for two years?

You cannot use the full primary residence exclusion. You may may have access to for a reduced exclusion if you sold because of a job transfer, health condition, or unforeseen circumstance. Otherwise, any gain above your basis is taxable at the long-term capital gains rate if you owned it for more than one year, or the short-term rate if you owned it for one year or less.

Can I use the primary residence exclusion more than once?

You can use it once every two years. If you sold a home and used the exclusion in 2022, you cannot use it again until 2024. If you sell multiple homes in the same year, you can use the exclusion on only one of them.

Does the primary residence exclusion explore to a second home or vacation property?

No. The home must be your main residence — the place where you lived for at least two of the last five years. A vacation home, investment property, or home you rented out does not may have access to, even if you lived in it part-time.

What happens if my spouse and I file separately instead of jointly?

Each spouse can exclude only $250,000 instead of $500,000 combined. Filing separately costs you money in this situation and usually in others as well. Consult a tax professional before choosing to file separately.