Capital Gains Tax on Real Estate: The Section 121 Home Sale Exclusion Explained
Selling a main home can create a capital gain, but U.S. Section 121 may exclude a significant part of it. The core question is whether the property was genuinely your main home and whether you meet the ownership, use, and timing tests.

Try our free ROI Calculator to calculate your return on an investment before taxes.
1. What Section 121 does when you sell a main home
Section 121 can exclude gain on the sale of a qualifying main home from U.S. federal taxable income. The maximum exclusion is generally $250,000 for an eligible single taxpayer and up to $500,000 for many eligible married couples filing jointly. It does not make every home sale tax-free and it does not apply simply because you own the property.
The rule is about your principal residence. A vacation home, a pure rental, a property held for investment, or a second home does not become eligible merely because you prefer the tax result. The IRS uses facts and circumstances to determine your main home when you own or live in more than one property.
The IRS guide to selling your home is the primary reference for the exclusion. It also covers special situations that can change the result, including divorce, the death of a spouse, qualified service, rental or business use, vacant land, and like-kind exchanges.
- The exclusion is for a main home, not every property you sell.
- The maximum amount is an exclusion of gain, not a deduction from the sale price.
- Federal treatment does not automatically determine state income-tax treatment.
- A sale can still need to be reported in some circumstances, including when you receive Form 1099-S.
2. The ownership and use tests: the 2-out-of-5-year rule
To claim the maximum Section 121 exclusion, you generally must pass an ownership test and a use test. During the five-year period ending on the sale date, you must have owned the home for at least two years and used it as your main home for at least two years. Those periods may be separate and do not have to be consecutive.
For example, a homeowner may buy a home, live there for two years, rent it for a period, and later sell. Meeting the bare ownership and use tests does not end the analysis because rental use can introduce depreciation recapture and nonqualified-use rules. Still, the example shows why “two years in a row immediately before closing” is not the general test.
The IRS looks at the actual center of your life when the answer is not obvious. Relevant facts can include the address on tax returns, voter registration, driver’s licence, mailing address, bank accounts, work location, family location, and the time spent at the home. Keep records that support the reality of how you used the property.
- Ownership: at least two years during the five-year window.
- Use: at least two years as your main home during the same five-year window.
- The two periods can overlap, but they do not have to.
- One taxpayer can have only one main home at a time.
3. Married couples, the $500,000 limit, and the two-year look-back
A married couple filing jointly may qualify for a maximum $500,000 exclusion, but the rules are stricter than simply doubling the individual amount. At least one spouse must meet the ownership test, both spouses must meet the use test, and neither spouse may have claimed an exclusion on another home sale during the two-year period before the current sale.
If the requirements for the larger joint exclusion are not met, a couple may still qualify for up to the individual $250,000 amount under the applicable rules. Do not assume the result from one spouse transfers automatically to the other, especially after a recent home sale, marriage, separation, or change in ownership.
The look-back rule also matters for frequent movers. You generally may use the exclusion only once in a two-year period. Review the sale dates of any earlier home sales before you list a property, not after a contract is signed.
- File a joint return for the year of sale to seek the larger joint exclusion.
- Confirm that both spouses meet the use test.
- Check whether either spouse used a home-sale exclusion during the prior two years.
- Treat a divorce, remarriage, or inherited home as a reason to review the rules early.
4. Work out the gain before applying the exclusion
Your gain is not simply the sale price minus the purchase price. Start with the amount realised from the sale, which is generally the sale price adjusted for selling expenses. Then compare that amount with your adjusted basis in the home. Adjusted basis can include the original purchase price and certain qualifying acquisition costs and capital improvements, adjusted for items that affect basis.
A capital improvement is generally an amount that adds value, adapts the home to a new use, or extends its useful life. Routine repairs and maintenance usually do not raise basis. The line can be fact-specific, particularly where a project combines repair and improvement work, so keep invoices, contracts, permits, and proof of payment instead of relying on memory.
Illustration: if net proceeds are $660,000 and adjusted basis is $350,000, the gain is $310,000. An eligible single taxpayer with the full $250,000 exclusion may have $60,000 of gain left before considering other rules and federal or state tax calculations. This example is only arithmetic; it does not establish eligibility or the tax due in a real sale.
Gain before exclusion = amount realised from sale − adjusted basis
Potential taxable gain = gain before exclusion − available Section 121 exclusion
- Save the purchase closing statement and settlement records.
- Keep paid invoices and permits for qualifying improvements.
- Record selling costs such as eligible commissions and legal fees.
- Do not treat a home-improvement receipt as automatically deductible or automatically added to basis.
5. A partial exclusion may be available when you sell early
You may qualify for a reduced Section 121 exclusion even if you do not meet the full two-year ownership and use tests. The IRS allows partial exclusions where the main reason for the sale is a change in employment, health, or an unforeseen circumstance, provided the applicable conditions are met.
The maximum exclusion is generally prorated using the shortest of your ownership period, residence period, or time since you last used the exclusion, divided by two years. A person who meets one year of a qualifying period may therefore have a potential maximum exclusion equal to one-half of the usual amount, subject to the detailed rules.
Do not use a partial-exclusion category as a label for a sale after the fact. Preserve the facts that explain the move, such as an employer transfer, medical recommendation, insurance claim, court record, or evidence of a qualifying unforeseen event. Publication 523 gives the IRS definitions and examples.
- Employment: a qualifying workplace change can support a reduced exclusion.
- Health: moving to obtain, provide, or facilitate care may qualify in certain cases.
- Unforeseen circumstances: the IRS lists specific types and facts that can qualify.
- The maximum partial exclusion is not automatic; confirm the detailed requirements.
6. Rental use, business use, and nonqualified use need extra care
Converting a main home into a rental does not automatically erase Section 121, but it adds rules that can limit the exclusion. Gain attributable to periods of nonqualified use after 2008 may not be excludable. The order and timing of personal use, rental use, and the eventual sale are important.
Depreciation creates another trap. The IRS generally requires gain attributable to depreciation allowed or allowable for business or rental use after May 6, 1997 to be recognised rather than excluded. A homeowner who did not claim available depreciation should not assume that omission removes the adjustment.
A home office inside the same dwelling can be treated differently from a separate portion of property used exclusively for business. Likewise, an exchange involving investment property can bring Section 1031 rules into the picture. These situations deserve individual advice before a listing, conversion, or exchange—not a rushed calculation at closing.
- Keep rental dates, leases, depreciation schedules, and property-use records.
- Identify whether business use was within the dwelling or a separate area of the property.
- Do not assume rental income turns a property into a fully ineligible asset.
- Review any 1031 exchange history before calculating a home-sale exclusion.
7. Divorce, death, and qualified service can change the answer
A divorce or separation agreement can allow a spouse who moved out to count the time the other spouse uses the home as a main residence, provided the agreement and other IRS conditions are satisfied. Property transfers between spouses or former spouses can also have separate nonrecognition rules. The ownership history and residence history should be reviewed together, not in isolation.
A surviving spouse may be able to use the $500,000 exclusion if the sale occurs within two years of the spouse’s death, the survivor has not remarried, the other conditions are met, and neither spouse recently used the exclusion on another sale. This is a narrow rule with strict dates, so preserve the closing and death records.
Eligible members of the uniformed services, Foreign Service, intelligence community, and Peace Corps may be able to suspend the five-year test period during qualified official extended duty for up to 10 years. That can extend the relevant test window, but it is an election with detailed eligibility requirements.
8. Prepare for a home sale before you accept an offer
The best Section 121 preparation happens before closing documents arrive. Build a timeline of purchase, move-in, move-out, rental periods, renovations, and prior home sales. Collect the records that establish the story, then have a qualified tax professional review the calculation before you assume the full exclusion applies.
Keep your analysis separate from the emotional decision to sell. A main-home exclusion can materially change the after-tax outcome, but it is only one part of a sale decision that may also involve mortgage payoff, replacement housing, state tax, estate planning, and timing. The IRS home-sale FAQs and Publication 523 are a strong starting point for the federal rules.
- Confirm the closing date and the five-year look-back window.
- Verify ownership, main-home use, and prior-exclusion history.
- Gather purchase, improvement, depreciation, and sale-expense evidence.
- Check federal and state rules before finalising your estimated proceeds.
Keep exploring Percentio
Browse the full directory to find related calculators and compare the assumptions that matter to your situation.
Browse all financial calculators →Questions and answers
Practical answers to common planning questions.




