Selling Your Home: How the Section 121 Exclusion Works
Published November 4, 2026
When you sell your home for more than you paid, the gain may be taxable. Section 121 of the tax code lets many homeowners exclude part or all of that gain. The exclusion is up to $250,000 for a single filer and up to $500,000 for married couples filing jointly. This page covers the rules for your main home. It is not a full guide to home sales. IRS: Topic 701, Sale of your home
Step 1: Is it your main home?
The exclusion applies only to your main home, also called your principal residence. You can have only one main home at a time. If you own or live in more than one home, the IRS looks at the facts and circumstances to decide which one is your main home. IRS: Publication 523, Selling Your Home
Step 2: Pass the ownership test
You must have owned the home for at least 24 months (2 years) out of the 5 years before the sale. The sale date is the closing date. The 24 months do not have to be in a row. For married couples filing jointly, only one spouse must meet the ownership test. IRS: Topic 701
Step 3: Pass the residence test
You must have lived in the home as your main home for at least 24 months, or 730 days, during the same 5-year period. The days do not have to be in a row. A short trip or vacation counts as time at home, even if you rented the home while you were away. Each spouse must meet the residence test on their own to get the full $500,000. IRS: Publication 523
Step 4: Check the two-year look-back
You generally cannot claim the exclusion if you excluded gain on another home sale during the 2 years before this sale. Under the rules, you may take the exclusion only once in a 2-year period. IRS: Publication 523
Special cases
Some rules change the tests above. A surviving spouse may count the time the late spouse owned and lived in the home. A surviving spouse who has not remarried may be able to use the $500,000 limit if the home is sold within 2 years of the death, and other conditions are met. A separated or divorced owner may count time when a former spouse lives in the home under a divorce or separation document. Members of the uniformed services, the Foreign Service, and the intelligence community may suspend the 5-year test while on qualified extended duty, for up to 10 years. IRS: Publication 523 · IRS: Topic 701
Partial exclusion for a move, health, or unforeseen event
If you fail the tests, you may still get a smaller exclusion. This applies when the main reason for the sale was a work move, a health issue, or an unforeseeable event. A work move counts if the new job is at least 50 miles farther from the home than the old job.
The IRS method works like this. Find the shortest of three periods: time you lived in the home in the 5 years before the sale, time you owned it, and time since you last sold a home with an exclusion, if that applies. Divide that period by 730 days (or by 24 months). Multiply the result by the full limit. IRS: Publication 523, Worksheet 1
Three examples
Illustration only, with round numbers.
Example 1: Full exclusion. Maria is single. She owned and lived in her home for 3 years. Her gain is $180,000. That is under $250,000, and she passes both tests. Her taxable gain is $0. If she received a Form 1099-S, she still reports the sale.
Example 2: Over the limit. Sam and Lee are married and file jointly. Both lived in the home for 3 years, and Sam owned it. Their gain is $600,000. They exclude $500,000, so $100,000 is taxable.
Example 3: Partial exclusion. Dana owned and lived in her home for 12 months. She moved for a new job 60 miles farther away. She has no earlier exclusion. The shortest period is 12 months. 12 divided by 24 is 0.5. Her limit is 0.5 times $250,000, or $125,000. Her gain is $150,000, so $25,000 is taxable.
Reporting the sale
If you receive a Form 1099-S, Proceeds From Real Estate Transactions, you must report the sale even if the whole gain is excluded. You must also report the sale if any part of the gain is taxable. Use Schedule D (Form 1040) and Form 8949. IRS: Topic 701
Two situations need extra care. First, if you used part of the home for business or rent, depreciation you claimed for that part can be taxed when you sell. The business part of a gain goes on Form 4797, not under the home exclusion. See Home Office Deduction for the Self-Employed. Second, gain tied to periods of "nonqualified use" after 2008, when the home was not your main home, generally cannot be excluded. IRS: Publication 523
For how capital gains appear on your return, see How Are Stock and Crypto Sales Reported on My Return?
Your checklist
- Confirm the home was your main home on the sale date.
- Count 24 months of ownership in the 5 years before closing.
- Count 24 months (730 days) of residence in the same 5 years.
- Check that you did not take an exclusion on another sale in the last 2 years.
- Check for a Form 1099-S, and report the sale if you get one.
- Keep records of your purchase price and improvements, since they affect the gain.
This page is general information, not advice for your return. Publication 523 has the worksheets and full rules.
Sources: IRS: Topic 701, Sale of your home (https://www.irs.gov/taxtopics/tc701); IRS: Publication 523, Selling Your Home (https://www.irs.gov/publications/p523) This is general information, not advice about your specific return.