Short answer: If you sell your main home at a profit, federal law lets you exclude up to $250,000 of that gain from income, or up to $500,000 if you're married and file jointly. To qualify, you generally must have owned the home and lived in it as your main home for at least two of the five years before the sale, and not used the exclusion on another home in the past two years. Gain above the limit is taxed as a capital gain. Even when none of it is taxable, you may still have to report the sale.
The exclusion: $250,000 or $500,000
The IRS rules are in Publication 523, Selling Your Home and Topic 701. You can exclude up to $250,000 of gain, or $500,000 on a joint return, if you pass three tests.
The 2-out-of-5-years checklist
Answer yes to all three and you likely qualify for the full exclusion:
- Ownership: Did you own the home for at least 24 months in the 5 years before the sale?
- Use: Did you live in it as your main home for at least 24 months in those 5 years?
- Look-back: Have you gone at least 2 years without excluding gain on another home?
The 24 months don't have to be in a row. The IRS counts a total of 24 months, or 730 days, within the five-year window.
Married couples filing jointly
For the $500,000 exclusion, only one spouse has to meet the ownership test, but both spouses must meet the use test, and neither can have used the exclusion in the past two years (Publication 523).
How to figure your gain
Your gain is not simply the sale price minus what you paid. The IRS formula:
- Amount realized = sale price minus selling expenses.
- Adjusted basis = what you paid, plus certain purchase costs, plus improvements.
- Gain = amount realized minus adjusted basis.
What goes into your basis, per Publication 523:
| Adds to basis | Does not add to basis |
|---|---|
| Purchase price | Fire and homeowners insurance |
| Legal fees for title search and the contract | Mortgage insurance premiums |
| Recording, survey and abstract fees | Loan points and lender-required appraisal fees |
| Transfer taxes you paid when you bought | Refinancing costs |
| Owner's title insurance | Routine repairs and maintenance |
| Improvements, such as an addition, a new roof or central air | Painting or fixing leaks, unless part of a larger remodel |
This is why keeping receipts for improvements matters. A new roof or a kitchen remodel raises your basis and lowers your gain. A coat of paint usually doesn't.
A worked example
These numbers are made up to show the math.
A single homeowner bought a house for $300,000, paid $5,000 in purchase costs that count toward basis, and later spent $40,000 on a new roof and an addition. Adjusted basis: $345,000. They sell for $700,000 and pay $45,000 in selling expenses. Amount realized: $655,000. Gain: $655,000 minus $345,000, or $310,000.
If they pass the 2-out-of-5 test, they exclude $250,000. The remaining $60,000 is a taxable capital gain. A married couple filing jointly in the same situation could exclude the whole $310,000.
If you don't meet the two-year test
You may still get a partial exclusion if you sold mainly because of one of these, according to Publication 523:
- Work: a new job location at least 50 miles farther from the home than your old job.
- Health: to get or provide care for an illness or injury, or on a doctor's recommendation.
- Unforeseeable events: such as the home being destroyed or condemned, a disaster, a death, a divorce or legal separation, multiple births from one pregnancy, or becoming eligible for unemployment.
Members of the uniformed services, the Foreign Service, the intelligence community and the Peace Corps on qualified extended duty can suspend the five-year window for up to 10 years.
What's taxed if your gain is over the limit
Gain above the exclusion is a capital gain. If you owned the home more than one year, it's long-term, which is usually taxed at a lower rate than wages (IRS Topic 409).
For tax year 2026, the IRS has set the long-term capital gains brackets (Revenue Procedure 2025-32):
| Filing status | 0% rate up to | 15% rate up to | 20% above |
|---|---|---|---|
| Single | $49,450 | $545,500 | $545,500 |
| Married filing jointly | $98,900 | $613,700 | $613,700 |
| Head of household | $66,200 | $579,600 | $579,600 |
These thresholds are based on your total taxable income, not just the home sale.
Two other rules can apply:
- Depreciation recapture: if you claimed depreciation for a home office or rental use after May 6, 1997, that part of the gain can't be excluded (Publication 523).
- State taxes: many states tax capital gains too. Some states also collect tax at closing when a nonresident sells. New York, for example, requires nonresident sellers to file Form IT-2663 and pay estimated tax when the deed is recorded, unless the home qualifies in full as a principal residence under the federal exclusion (New York State Department of Taxation and Finance).
Do you have to report the sale?
You must report it on your tax return if (Publication 523):
- You have gain you can't fully exclude, or
- You received Form 1099-S for the sale. In that case you must report it on Form 8949 even if none of the gain is taxable.
The sale is reported on Form 8949 and Schedule D.
What to ask your tax professional
- Do I meet the ownership and use tests, counting the exact dates?
- Which of my past projects count as improvements for basis?
- Did I claim depreciation on this home at any point?
- Will I receive a Form 1099-S, and how should I report it?
- Does my state tax the gain, or withhold anything at closing?
This article is general information, not tax advice. A tax professional can apply these rules to your dates and numbers.
Sources
All checked on November 30, 2026.
