You can exclude up to $250,000 of gain from tax when you sell your main home, or $500,000 if you’re married filing jointly, by meeting the IRS ownership and use tests. Section 121 of the Internal Revenue Code provides the exclusion; see IRS Publication 523 and Topic No. 701 for the official rules and worksheets. In most cases you must have owned the house at least 24 months and lived in it at least 24 months during the five-year period ending on the sale date, and you generally can’t have claimed the exclusion on another home in the prior two years except for limited exceptions. Read the steps below to document ownership, compute adjusted basis and gain, and determine whether you must report the sale on your federal return.

If your computed gain falls under the $250,000 or $500,000 exclusion limits, you generally don't include that gain in income because Section 121 of the tax code permits that exclusion.

1. Confirm you meet the ownership and use tests

The first gating facts are the two tests the IRS requires: the Ownership test and the Use test. You meet the ownership test if you owned the home for at least 24 months during the five-year period ending on the date of sale. You meet the use test if you lived in the home as your main residence for at least 24 months during that same five-year window. Publication 523 and Topic no. 701 describe these rules and include worksheets to help you apply the timing.

Worked example: imagine you bought a house on June 1, 2018, and you plan to sell on August 1, 2024. Count back five years to August 1, 2019. If you owned the house from June 1, 2018, through the sale date, you meet the ownership test because you owned it for more than 24 months during the five-year lookback. If you lived there as your main home for at least 24 months in that same lookback window, you meet the use test.

2. Understand the joint filer rules and two-year bar

For married taxpayers filing jointly the rules change the result you can claim. Either spouse can satisfy the ownership test, but both spouses must satisfy the use test individually to claim the full $500,000 exclusion. If one spouse fails the use test, you may still qualify for the $250,000 exclusion applicable to single filers unless other circumstances change that outcome. The IRS also bars the exclusion if you claimed it for the sale of another home within the two years immediately preceding this sale, subject to limited exceptions such as certain unforeseen circumstances, a change in employment, or health reasons. Publication 523 explains the limited exceptions and the mechanics for partial exclusions.

Worked example: a married couple bought a house in 2016 and one spouse moved out in 2020 for work while the other remained. If both spouses lived in the home for 24 months during the lookback period before selling, they can claim $500,000. If only one spouse meets the use test, the maximum exclusion for the sale may fall back to $250,000.

3. Assemble the documents that prove ownership and residence

Prepare records before you file. The IRS recommends you preserve deeds and closing statements, such as HUD-1 forms or closing disclosures, plus utility bills and other documents that show you occupied the house for the required periods. Save evidence of moving dates and any bills or official mail that show the property was your main home. Those records are the core of the ownership and use proofs the IRS expects if it questions the exclusion.

Worked example: keep the final closing disclosure from the purchase, the sale closing statement, utility bills showing service at the property, and a copy of the deed. If you rented part of the property, maintain records showing the time you actually lived there as your main residence.

4. Compute adjusted basis and your realized gain

Next you must calculate the gain you actually realized on sale. Compute gain by subtracting your Adjusted basis and allowable selling expenses from the sale price. Publication 551 and Topic no. 409 explain the IRS definition of basis and special rules that change basis, including capital improvements and basis adjustments for casualty losses. Note that losses on personal-use property aren't deductible under the tax code.

Worked example: if you bought the house for $200,000 and made $30,000 in capital improvements that increased basis, your adjusted basis would be $230,000. If you sold the house for $520,000 and paid $20,000 in selling expenses, your computed gain would be $520,000 minus $230,000 minus $20,000, which equals $270,000. Under those numbers, a single filer would have $20,000 of taxable gain above the $250,000 exclusion, and a married joint filer would have the entire gain excluded if they meet the joint requirements.

5. Decide how and whether to report the sale

If your computed gain is equal to or less than the permitted exclusion amount for your filing status, you generally don't include that gain in income. The IRS notes, however, that the receipt of an informational return such as Form 1099-S, Proceeds From Real Estate Transactions, generally requires you to report the sale even when the gain is otherwise excludable. If any part of the gain is taxable, report the taxable portion on Schedule D (Form 1040) and, when required, on Form 8949.

Worked example: using the prior numbers, a single filer with $270,000 computed gain who received a Form 1099-S must report the transaction; they would report $20,000 as taxable capital gain on Schedule D and Form 8949, unless an exception applies. If the entire gain is excludable and you didn't receive Form 1099-S, IRS guidance generally doesn't require reporting the sale on your return, but you should keep the documentation that proves eligibility.

6. Special situations to watch

The IRS lists several special rules. Members of the military and certain government employees can elect to suspend the five-year test period for up to 10 years while on qualified official extended duty. That election preserves eligibility for the exclusion despite long absences from the residence. Installment sales are reported under the installment method unless you elect out, but the portion of gain that's eligible for exclusion may still be excluded under Section 121. There are also partial exclusion rules if the sale is due to a change in employment, health reasons, or certain unforeseen circumstances, and special mechanics for sales after divorce, when spouses are separated, or when property is inherited. Publication 523 provides the detailed rules and the worksheets for partial exclusions.

Worked example: a service member deployed for a long period who made the suspension election can have those years excluded from the five-year lookback, preserving eligibility to claim Section 121 when selling later. For an installment sale you report payments as received, but you must allocate the excluded portion appropriately under the installment reporting rules.

7. Recordkeeping and defending the exclusion

Good recordkeeping is both the easiest way to claim the exclusion and the best defense if the IRS asks questions. Keep sale closing statements, the HUD-1 or closing disclosure, records of purchase and sale dates, receipts for capital improvements that increase basis, and any documentation of periods of nonqualified use. If you receive a Form 1099-S but believe the gain is fully excludable, keep the documents that establish eligibility and be ready to either attach an explanation to your return or report the sale with the exclusion claimed if circumstances require it.

Worked example: suppose you filed your return without reporting a sale that you believed was fully excludable but later receive a notice from the IRS referencing the Form 1099-S. Having the closing disclosure, proof of residence, and records of capital improvements will let you respond quickly and, if needed, amend a prior return.

8. When to consider an amended return and surtax interactions

If you discover after filing that you were eligible for the exclusion, Publication 523 and IRS procedures describe when an amended return may be appropriate to claim the exclusion and recover overpaid tax. Higher-income taxpayers should also consider interactions with the Net Investment Income Tax and other surtaxes, which advisers note may affect overall tax liability even when Section 121 reduces ordinary capital gains.

Worked example: a taxpayer who originally reported a gain and paid tax may, under the IRS rules, file an amended return if they later find documentation proving eligibility for Section 121. Separately, a taxpayer with significant investment income should check whether Net Investment Income Tax rules apply to any remaining taxable gain.

9. How the home-sale exclusion fits with other capital gains reliefs

Section 121 applies to gains on the sale of your main home, but it sits in a broader capital-gains landscape. Inherited assets often receive a stepped-up basis that can eliminate appreciation realized during the decedent's lifetime. Gains inside retirement accounts are subject to different tax treatments based on account type. Section 1202 can exclude part or all of a qualifying small business stock gain if statutory tests are met and the stock was held at least five years. Like-kind exchange rules under Section 1031 allow deferral of gain on qualifying real estate trades when replacement property and timing conditions are satisfied. For long-term capital gains generally, the IRS sets age-based thresholds and rates, and for taxable years beginning in 2025 the IRS lists long-term capital gains tax brackets that determine 0 percent, 15 percent, or 20 percent rates depending on taxable income and filing status. These other provisions are distinct from Section 121 and have their own statutory tests and limits as explained in IRS guidance and tax practice materials.

Worked example: if you own rental property and trade it for a replacement real estate investment that meets Section 1031 rules, you are dealing with deferral mechanics distinct from the Section 121 exclusion for a primary residence. Likewise, a qualifying Section 1202 sale of small business stock follows an entirely different set of requirements than a home sale.

In Short

- Confirm you pass the ownership and use tests: 24 months each within the five-year lookback.

- Compute adjusted basis, subtract selling expenses, and compare your realized gain to the $250,000 or $500,000 exclusion amounts.

- Report on Schedule D and Form 8949 if any gain is taxable or if you received Form 1099-S; keep documentation if the gain is fully excludable but Form 1099-S was issued.

- Use Publication 523 and Topic no. 701 to run the worksheets and to check special rules for military service, installment sales, and partial exclusions.

Related Articles

Use IRS Publication 523, Selling Your Home, and Topic no. 701 as your step-by-step worksheets and rulebook to confirm eligibility, compute adjusted basis and gain, and decide whether you must report the sale on Form 1040.

This article was created with AI assistance.