Advertiser disclosure: VistaRates has no affiliate or partner agreements today, and no provider pays for placement. Product links go to the provider's own page. How we make money

Home sale tax exclusion: the ownership and use tests

How the Section 121 ownership, use and look-back tests can let you exclude up to $250,000 of gain ($500,000 jointly) when you sell your main home.

By Martin Marinov 8 min read Published Updated Verified
Family unpacking moving boxes together in a new home

Key takeaways

  • IRS Publication 523 (2025) says you may exclude up to $250,000 of gain on the sale of your main home, or up to $500,000 for a married couple filing jointly.
  • To get the full exclusion you generally must own the home and live in it as your main home for at least 24 months each during the 5 years ending on the date of sale.
  • You can generally take the exclusion only once during a 2-year period.
  • If you don't meet the full test, you may still qualify for a partial exclusion if the main reason for the sale was a work move, a health issue or an unforeseeable event.
  • You generally cannot exclude gain equal to depreciation allowed or allowable after May 6, 1997, or gain allocable to periods of nonqualified use after 2008, with certain exceptions.
On this page 8 sections

When you sell your main home at a gain (an amount realized above your adjusted basis), part or all of that gain may be excluded from your income. The rule behind this is section 121 of the tax code. The IRS explains it in Publication 523, Selling Your Home. This guide follows the 2025 edition of that publication (for use in preparing 2025 returns) and IRS Tax Topic 701. It focuses on the calendar math: what you need to count, and which dates count.

What this means

The IRS says that if you meet certain conditions, you may exclude the first $250,000 of gain from the sale of your home from your income. The exclusion rises to $500,000 for a married couple filing jointly.

Two words matter most here: “gain” and “main home.”

  • Gain is not the sale price. The IRS formula is the selling price minus selling expenses (the amount realized), then minus your adjusted basis.
  • Main home means your principal residence. The IRS says an individual has only one main home at a time. If you own or live in more than one home, a “facts and circumstances” test applies. The most important factor is where you spend the most time. Other factors include the address on your tax returns, voter registration and driver’s license, and whether the home is near where you work and bank.

The exclusion can apply to a single-family home, a condominium, a cooperative apartment, a mobile home or a houseboat.

Example with made up numbers: A seller sells a home for $400,000 and pays $20,000 in selling expenses, so the amount realized is $380,000. Their adjusted basis (generally the purchase price plus qualifying closing costs and improvements, minus certain adjustments such as depreciation) is $250,000. The gain is $130,000. If the seller is single and meets every test below, the whole $130,000 is under the $250,000 limit.

Who it applies to

Before you count any months, check the two automatic disqualifications in Publication 523. Your sale is not eligible for the exclusion if:

  • You acquired the property through a like-kind exchange (section 1031 exchange) during the past 5 years.
  • You are subject to expatriate tax.

If neither applies, you move on to the timeline tests.

How the Section 121 ownership and use tests can exclude gain

Every test looks backward from one date, so start there.

Step 1: pin down the date of sale

If you received Form 1099-S, the date of sale is in box 1. If you did not, the IRS says it is the earlier of the date the title transferred or the date the economic burdens and benefits of ownership shifted to the buyer. In most cases these are the same.

Step 2: run the three timeline tests

TestWhat the IRS requiresJoint filers
OwnershipYou owned the home at least 24 months (2 years) in the 5 years before the date of saleOnly one spouse must meet it
Residence (use)You used it as your residence at least 24 months (730 days) in the previous 5 years, not necessarily in one blockEach spouse must meet it individually
Look-backYou did not exclude gain on another home sold during the 2-year period before this saleBoth spouses must meet it

Tax Topic 701 adds that you can meet the ownership and use tests during different 2-year periods, as long as both fall within the 5-year period ending on the date of sale.

A few timing details from Publication 523:

  • A vacation or other short absence counts as time you lived at home, even if you rented the home out while you were gone.
  • If you become physically or mentally unable to care for yourself and you lived in the home as your main home for at least 12 months in the 5 years before the sale, time living in a care facility (such as a nursing home) counts toward the residence requirement, as long as the facility is licensed by a state or other political entity to care for people with your condition.

Example with made up numbers: A couple files jointly and sells in 2025. One spouse bought the home 4 years before the sale and lived there the whole time, and both spouses lived there for the last 3 years. Neither has excluded gain on a home sale in the prior 2 years, and no automatic disqualification applies. One spouse meets ownership, both meet residence and look-back, so the couple’s exclusion limit is $500,000.

Step 3: if you fall short, check the partial exclusion

If you miss the full test, you may still qualify for a partial exclusion if the main reason for the sale was:

  • A work move: a new job at least 50 miles farther from the home than your old work location (or, if you had no previous work location, a new job at least 50 miles from the home).
  • A health issue: for example, moving to get or provide care for a qualifying family member, or a doctor recommending a change in residence.
  • An unforeseeable event: such as the home being destroyed or condemned, a death, a divorce or legal separation, multiple births from the same pregnancy, becoming eligible for unemployment compensation, or a change in employment status that leaves you unable to pay basic household living expenses.

Worksheet 1 in Publication 523 sets out the math. Take the shortest of three periods: your residence during the 5 years before the sale, your ownership, and the time since you last sold a home on which you took the exclusion. Divide by 24 (months) or 730 (days), then multiply by $250,000. Joint filers repeat this for each spouse and add the results.

Example with made up numbers: A single seller owned and lived in a home for 12 months, then took a new job at a work location 60 miles farther from the home than the old work location, and sold. The shortest period is 12 months. 12 divided by 24 is 0.5, and 0.5 times $250,000 gives a reduced exclusion limit of $125,000.

Special timelines

  • Surviving spouses: If you have not remarried at the time of sale, you may count time your late spouse owned and lived in the home. You may be able to use the $500,000 limit if you sell within 2 years of your spouse’s death and meet the other conditions in Publication 523.
  • Service, intelligence and Peace Corps personnel: If you or your spouse are on qualified official extended duty, you may choose to suspend the 5-year test period for up to 10 years. The IRS says the suspension and the 5-year period together can be no more than 15 years.

Common mistakes

  • Assuming rental years don’t matter. The IRS says gain allocable to periods of nonqualified use cannot be excluded. Nonqualified use generally means any period after 2008 when neither you nor your spouse (or former spouse) used the home as your main home. One exception: time in the 5-year window after you last lived there does not count as nonqualified use.
  • Forgetting depreciation. If you were entitled to take depreciation deductions because you used part of your home for business or rental, you cannot exclude the part of the gain equal to depreciation allowed or allowable after May 6, 1997.
  • Treating a duplex like a single home. Gain on a separate part of the property used for business or rental, such as the other unit of a duplex, generally cannot be excluded unless you owned and lived in that part for at least 2 of the 5 years.
  • Skipping the tax return. If you receive Form 1099-S, Tax Topic 701 says you must report the sale even if the gain is excludable. Form 8949 and Schedule D (Form 1040) are used when reporting is required.
  • Losing basis records. Improvements such as a new roof, an addition or kitchen modernization add to basis. Routine repairs such as painting or fixing leaks do not. Keep records of improvements, because their cost adds to your basis.
  • Expecting to deduct a loss. Publication 523 says you cannot deduct a loss on the sale of your main home.

What to do next

  1. Write down the date you bought the home, the dates you lived there and your expected date of sale.
  2. Gather your purchase settlement statement and improvement receipts to estimate your adjusted basis.
  3. Work through Worksheets 1, 2 and 3 in IRS Publication 523, which cover the exclusion limit, gain or loss, and the taxable portion.
  4. If you rented the home, used part of it for business or sold under an installment contract, read those sections of Publication 523 closely or consider a qualified tax professional. Tax Topic 701 notes the exclusion remains available even if you use the installment method.

If you are lining up financing for your next home, you can compare current offers on our mortgage rates page.

How we make money

VistaRates currently has no affiliate or partner agreements and is not paid for any link on this page. Links go to the provider’s own page. See our advertiser disclosure.

FAQ

What is the home sale tax exclusion?

It is a federal tax rule, found in section 121 of the tax code, that lets you leave part or all of the gain from selling your main home out of your income. IRS Publication 523 (2025) puts the maximum at $250,000, or $500,000 for a married couple filing jointly.

Do the 24 months of living in the home have to be in a row?

No. The IRS says the 24 months (730 days) of residence can fall anywhere in the 5-year period and do not have to be one continuous block. Vacations and other short absences count as time you lived there.

Do I have to report the sale if all of my gain is excluded?

If you receive Form 1099-S, the IRS says you must report the sale even if the gain is excludable. You also must report it if you cannot exclude all of your gain.

Can a married couple get $500,000 if only one spouse owned the home?

For a joint return, only one spouse has to meet the ownership test, but each spouse must meet the residence test individually. Both spouses also must meet the look-back requirement.

Does this page give personal tax advice?

No. It is general educational information based on IRS Publication 523 and IRS Tax Topic 701. For your own situation, consider the IRS worksheets or a qualified tax professional.

Not advice. This guide is general education, not personalized financial, tax, or legal advice. Confirm numbers on primary sources before you act.