In short
You can exclude up to $250,000 of gain from your income when you sell your main home ($500,000 for most married couples filing jointly) if, in the 5 years before the sale, you owned it and lived in it for at least 2 years (26 U.S.C. 121; IRS Publication 523). You can use the exclusion once every 2 years. Gain above the limit is taxable.
Who qualifies?
Section 121 has three tests, and Publication 523 explains each one:
- Ownership. You owned the home for periods adding up to at least 2 years during the 5 years ending on the sale date.
- Use. You lived in it as your main home for at least 2 years in that same 5-year window. The statute counts periods that add up to 2 years, so they need not be consecutive.
- Frequency. You did not use the exclusion on another home sale during the 2 years before this sale.
For the $500,000 limit, you must file jointly, at least one spouse must meet the ownership test, both spouses must meet the use test, and neither spouse can be barred by the 2-year frequency rule. If you do not meet those conditions, each spouse can claim up to $250,000 on his or her own, counting both spouses’ ownership. A surviving spouse can still claim $500,000 if the sale is no later than 2 years after the death and the other requirements were met just before the death.
What if I sell early?
If you fail the 2-year tests or used the exclusion within the last 2 years, you may still qualify for a reduced exclusion if the sale is due to a change in place of employment, health, or unforeseen circumstances specified by the IRS (26 U.S.C. 121(c)). The limit is cut by a fraction: the shorter of your time owning and living in the home, or the time since your last exclusion, divided by 2 years.
Example: a single owner lived in the home 12 months, then moved for a new job. The fraction is 12/24, or one half, so the maximum exclusion is $125,000 (one half of $250,000).
How is the gain calculated?
Gain is the amount you realize on the sale minus your adjusted basis. Publication 523 says closing costs you can add to basis when you buy include abstract and title search fees, legal fees, recording fees, survey fees, transfer or stamp taxes and the owner’s title insurance. Improvements add to basis too. Transfer taxes and similar charges that you pay as seller are expenses of the sale and reduce the amount realized (Publication 530).
A worked example for a joint filer or single filer:
| Line | Amount |
|---|---|
| Sale price | $750,000 |
| Selling expenses (commissions, transfer tax, other) | -$45,000 |
| Amount realized | $705,000 |
| Purchase price plus buying costs | $300,000 |
| Improvements | $40,000 |
| Adjusted basis | $340,000 |
| Gain | $365,000 |
| Taxable if single ($250,000 exclusion) | $115,000 |
| Taxable if married filing jointly, qualified ($500,000 exclusion) | $0 |
The numbers are illustrations. See real estate commission for the selling expense most sellers pay, and closing costs explained for buying costs.
When does part of the gain stay taxable?
- Depreciation. If you used part of the home for business or rented it out and claimed depreciation, that gain is not excluded and is reported as unrecaptured section 1250 gain. Publication 523 gives a home office example: $2,000 of depreciation claimed was recognized as unrecaptured section 1250 gain, and the rest of the gain was excluded.
- Periods of non-residential use. Publication 523 has rules for property used as a rental or business and for nonqualified use after 2008. Use Worksheet 2 in the publication.
- Form 1099-S. If the closing agent sends you a Form 1099-S, you must report the sale on Form 8949 even if all the gain is excluded. You must report any gain you cannot exclude on Schedule D.
The tax rate on taxable gain depends on your income and how long you owned the home; use the Schedule D instructions or ask a tax professional. If the home is an investment property instead of your residence, see 1031 exchange.
Where states differ
The Section 121 exclusion is federal and the same in every state. What differs is how your state taxes the gain that remains, what transfer taxes and fees you pay on the sale, and the property tax proration at closing. See Texas transfer tax and California transfer tax.
Frequently asked questions
Do I pay tax when I sell my house?
Only on gain above your exclusion. If you meet the ownership, use and frequency tests, the first $250,000 of gain is excluded ($500,000 for qualifying joint filers).
Do the 2 years have to be in a row?
No. Section 121 counts periods of ownership and use that add up to 2 years within the 5 years before the sale.
How often can I use the exclusion?
Not more than once every 2 years. The statute denies it if you used it on another sale during the 2-year period ending on the sale date.
I have to move early for a job. Is any exclusion left?
Possibly. A sale because of a change in place of employment, health or unforeseen circumstances can qualify for a partial exclusion, prorated by the time you lived there out of 2 years (26 U.S.C. 121(c)).
Do I have to report the sale if the gain is excluded?
Only in some cases. You must report if you received Form 1099-S, if you have taxable gain, or if you choose to report. Publication 523 lists these conditions.
More taxes guides
Sources
- 26 U.S.C. 121, Exclusion of gain from sale of principal residence (Cornell LII) (consulted October 13, 2026)
- Publication 523 (2025), Selling Your Home (IRS) (consulted October 13, 2026)
- Publication 530 (2025), Tax Information for Homeowners (IRS) (consulted October 13, 2026)