Internal Revenue Code Section 121: Home Sale Gain Exclusion

The Section 121 home sale exclusion lets you keep up to $250,000 of profit from selling your main home free of federal tax, or up to $500,000 if you’re married and file jointly, provided you owned the place and lived in it as your principal residence for at least two of the five years before the sale.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence The exclusion isn’t automatic, and several situations can shrink it or wipe it out: an early sale, prior rental use, depreciation you claimed, or a gain that runs past the cap.

Who Qualifies

Two tests decide whether you get the exclusion at all, and both are measured over the five-year window ending on the date you sell. You need at least two years of ownership during that window (the Ownership Test), and at least two years using the home as your main residence during that window (the Use Test).1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence Neither stretch has to be continuous. You can add up months to reach 24.

The two periods don’t have to line up. Buy a house, live in it two years, rent it for three, sell: you still pass both tests. Buy a rental, rent it three years, move in for two, sell: same result. That flexibility is what makes Section 121 usable for people converting a property between personal and investment use.

For a married couple filing jointly, only one spouse has to meet the Ownership Test.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence Both must meet the Use Test to claim the full $500,000. When only one spouse meets both tests, the couple’s exclusion is typically capped at $250,000.

Proving It Was Your Principal Residence

If you own more than one home, the IRS treats the one where you spend most of your time as your principal residence, and it looks at all facts and circumstances. Voter registration, the address on your tax returns, your driver’s license, utility bills, and local bank activity all point in the same direction when your claim is honest. Getting mail somewhere isn’t enough on its own.

The Nursing Home Rule

If you become physically or mentally unable to care for yourself, time spent in a state-licensed care facility counts toward the Use Test, as long as you owned and lived in the home for at least one year during the five-year lookback.2eCFR. 26 CFR 1.121-1 – Exclusion of Gain From Sale or Exchange of a Principal Residence Someone who lived at home for 14 months and then moved to a nursing home for three years before the sale still meets the two-year use requirement.

How Much Gain You Can Exclude

The ceiling depends on filing status at the time of sale:

There’s also a frequency limit. You can’t claim the exclusion if you already used it on a different home sale within the two years before this sale.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence The clock runs sale date to sale date. The rule follows the taxpayer, not the property, so a couple who took the $500,000 exclusion together can’t use it again for two years, even if they later divorce and file separately.

Figuring the Gain the Exclusion Applies To

The exclusion only matters when there’s a taxable gain, and the gain is rarely sale price minus purchase price. Two adjustments reduce it before the exclusion is even in the picture: your adjusted basis and your selling expenses.

Adjusted Basis

Your starting basis is generally what you paid, including certain settlement costs from the purchase: title insurance, transfer taxes, recording fees, survey fees, legal fees for the title search and contract, and charges to install utility services.3Internal Revenue Service. Publication 551 Basis of Assets Mortgage-related costs — loan origination fees, lender-required appraisal, mortgage insurance premiums — don’t go into basis.

After you move in, capital improvements increase your basis. The IRS separates improvements from repairs on a clear line: an improvement adds value, extends the home’s useful life, or adapts it to a new use, while a repair only maintains existing condition. A new deck, a new roof, central air, a modernized kitchen, or a finished basement are improvements. Patching drywall, painting a room, or fixing a faucet are repairs and don’t count.4Internal Revenue Service. Publication 523 (2025), Selling Your Home One nuance: repair-type work done as part of a larger remodel can be treated as part of the improvement. Replacing one broken window is a repair; replacing every window in the house during a renovation is an improvement.

Selling Expenses

When you sell, transaction costs reduce the amount you’re treated as receiving. Real estate commissions are usually the biggest one, but title search fees, escrow fees, attorney fees, recording fees, transfer taxes, and document preparation costs also subtract from the sale price. Costs that touch the property itself, like pre-listing cleaning or painting, don’t qualify. What remains after these expenses is your amount realized. Your gain is that number minus your adjusted basis.

Selling Before Two Years

If you sell before hitting the full two years of ownership or use, you may still get a prorated exclusion when the sale was driven by one of three hardship categories: a job relocation, a health-related move, or unforeseen circumstances.4Internal Revenue Service. Publication 523 (2025), Selling Your Home

The IRS provides a safe harbor for job-related moves: the new workplace must be at least 50 miles farther from the sold home than the old workplace was. A health-related move requires a physician’s recommendation to relocate for treatment or to care for a family member. Unforeseen circumstances include:

  • Death of the taxpayer, spouse, or co-owner.
  • Becoming physically or mentally unable to care for yourself.
  • Divorce or legal separation.
  • Involuntary conversion, meaning the home is destroyed or condemned.
  • Certain natural or man-made disasters.

The math is straightforward. Take the shorter of your ownership or residence time, divide by 24 months, multiply by the full $250,000 or $500,000. A single filer who qualifies at 18 months gets an exclusion ceiling of $187,500. Keep documentation of the qualifying reason in case the IRS asks.

When Rental Use or Depreciation Shrinks the Exclusion

When a home has served as both a residence and a rental or business property, two separate rules pull gain back into tax, and they work independently.

Non-Qualifying Use

Any period after December 31, 2008, when the property wasn’t your principal residence (or your spouse’s) counts as non-qualifying use. The share of gain tied to that period is taxable no matter how large your exclusion would otherwise be. The formula is total non-qualifying use divided by total ownership.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

Order of use matters here. If you rented first and moved in later, the rental period is non-qualifying and the corresponding gain is taxable. But if you lived in the home first and then rented it before selling, the rental period after your last date of principal-residence use isn’t counted against you. The statute specifically excludes that trailing period. That asymmetry is one of the most overlooked planning points in Section 121.

Own a home 10 years, rent it the first 3, live in it the next 7: three of 10 years are non-qualifying, so 30% of the gain is taxable. Flip the sequence — live in it 7 years, rent it 3, sell — and none of the gain is allocated to non-qualifying use.

Depreciation Recapture

Any depreciation you claimed, or were entitled to claim, after May 6, 1997, is always taxable when you sell, regardless of the exclusion.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence It’s taxed at a maximum rate of 25% as unrecaptured Section 1250 gain — higher than the long-term capital gains rates that apply to the rest of the gain, though not at ordinary income rates. Home office depreciation counts. Rental-period depreciation counts. Recapture happens first; the Section 121 exclusion applies to whatever gain remains, so you don’t get both a deduction going in and tax-free treatment going out.

If You’re a Service Member

Members of the uniformed services, the Foreign Service, and the intelligence community can elect to suspend the five-year lookback for up to 10 years while on qualified official extended duty, meaning stationed at least 50 miles from the home or living in government quarters under orders.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence With the suspension, the tests can be measured over a window as long as 15 years. The election applies to one property at a time. A service member who buys a home, lives in it two years, deploys for eight, and sells still qualifies for the full exclusion because the deployment years don’t count against the five-year clock.

If Your Spouse Has Died

A surviving spouse can claim the full $500,000 exclusion, rather than the $250,000 single-filer amount, if all of these hold:

  • The sale happens within two years of the spouse’s death.
  • The surviving spouse has not remarried by the sale date.
  • Neither spouse used the exclusion on another home within two years before this sale.
  • The ownership and use requirements are met, counting the deceased spouse’s time.4Internal Revenue Service. Publication 523 (2025), Selling Your Home

Miss the two-year window and the cap drops to $250,000. The deceased spouse’s share of the property typically receives a stepped-up basis to fair market value at death, which often reduces or eliminates the taxable gain on its own.

The 3.8% Surtax on Gain Above the Cap

Any gain that stays inside the Section 121 exclusion is also outside the 3.8% Net Investment Income Tax. Gain above the cap is investment income, and if your modified adjusted gross income clears the threshold for your filing status, the surtax applies on top of regular capital gains tax.5Internal Revenue Service. Net Investment Income Tax

The thresholds are $200,000 for single filers, $250,000 for married couples filing jointly, and $125,000 for married filing separately, and they’re not adjusted for inflation.5Internal Revenue Service. Net Investment Income Tax In a strong appreciation market, the combined rate on the excess gain can reach 23.8% (20% long-term capital gains plus 3.8% NIIT). Nothing in your closing paperwork will flag it.

Reporting the Sale

If your entire gain falls inside the exclusion and you meet the requirements, you generally don’t have to report the sale. The closing agent normally issues Form 1099-S, but can skip it when you give written certification that the full gain is excludable.6IRS. Instructions for Form 1099-S (Rev. April 2025)

You do need to report the sale when:

  • Your gain exceeds $250,000 or $500,000.
  • You have depreciation recapture from business or rental use.
  • You received a Form 1099-S.
  • You’re electing the partial exclusion after an early sale.
  • You choose to report even though you don’t have to, which some advisors recommend for documentation.

Reporting is done on Form 8949 and carried to Schedule D, with the Section 121 exclusion entered as an adjustment that reduces the reportable gain.

Keeping Records

Keep purchase closing documents, receipts for improvements, and depreciation records for at least three years after you file the return for the year of sale.7Internal Revenue Service. How Long Should I Keep Records? Digital storage is free, and those records are what prove your adjusted basis if the IRS ever questions the return.