What Is Section 121 of the Internal Revenue Code?

Section 121 of the Internal Revenue Code lets you exclude up to $250,000 of capital gain from the sale of your principal residence, or up to $500,000 if you’re married filing jointly, as long as you owned and lived in the home for at least two of the five years ending on the sale date. The exclusion is automatic — no election form, no application — and you can use it again every two years for the rest of your life. For most people, this is the biggest tax break they will ever claim.

The Two-Year Ownership and Use Tests

Qualifying comes down to two tests measured against the five-year window that ends on the date you sell. You must have owned the home for at least two of those five years, and you must have used it as your principal residence for at least two of those five years.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

The 24 months of ownership and the 24 months of use don’t have to be consecutive, and they don’t have to overlap. You could rent a house for three years, buy it, live in it for two more, and still qualify: two years of ownership and two years of use, both inside the same five-year lookback.

Short absences count as use. A two-week vacation or a few months of work travel does not break your residence period as long as the home remained your base.2eCFR. 26 CFR 1.121-1 – Exclusion of Gain From Sale or Exchange of a Principal Residence

One hard limit: you can only claim the exclusion once in any two-year span. If you excluded gain on a different home sale within the previous two years, you are locked out of Section 121 entirely on this one.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

If you own more than one home, the IRS decides which is your principal residence by looking at the whole picture: where you work, where your family lives, the address on your tax returns and driver’s license, where you bank, and where you spend most of your time.2eCFR. 26 CFR 1.121-1 – Exclusion of Gain From Sale or Exchange of a Principal Residence

How Much Gain You Can Exclude

The ceiling depends on filing status:

  • Single filers can exclude up to $250,000 of gain.
  • Married couples filing jointly can exclude up to $500,000, but only if at least one spouse meets the ownership test, both spouses meet the use test, and neither spouse used the exclusion on another sale in the prior two years.
  • If a joint-filing couple has one spouse who meets both tests and one who doesn’t meet the use test, the exclusion drops to $250,000.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

Your gain is the sale price (less selling costs) minus your adjusted basis. The adjusted basis starts with what you paid for the home and grows with the cost of capital improvements such as a new roof, a kitchen renovation, or an addition. Routine maintenance and repairs don’t add to basis. Any gain above the exclusion limit is taxed at long-term capital gains rates.

The $250,000 and $500,000 figures are written into the statute and are not adjusted for inflation. They have not moved since 1997.

Reduced Exclusion When You Sell Early

If you sell before meeting the full two-year ownership or use requirement, you can still claim a partial exclusion, but only if the sale was driven by one of three qualifying reasons: a change in employment, a health condition, or unforeseen circumstances.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

Treasury regulations spell out safe harbors for each category. For a change in employment, your new workplace must be at least 50 miles farther from the home you sold than your old workplace was. For health, a doctor must recommend the move, or you must sell to obtain or provide care for a family member with an illness or injury. Unforeseen circumstances include involuntary conversion (destruction or condemnation), natural or man-made disasters, death, divorce, job loss qualifying for unemployment benefits, an inability to pay basic housing costs due to changed employment, and multiple births from the same pregnancy.3eCFR. 26 CFR 1.121-3 – Reduced Maximum Exclusion for Taxpayers

The reduced exclusion is prorated. You multiply the full $250,000 or $500,000 by a fraction: months of ownership or use (whichever is shorter) divided by 24. A single taxpayer who lived in the home for 15 months before a qualifying job relocation could exclude up to $156,250, which is $250,000 times 15/24.

Gain That Can Still Be Taxed When You Qualify

Meeting the ownership and use tests doesn’t automatically shield every dollar of gain. Three rules can carve out taxable amounts even for a qualifying seller.

Nonqualified Use

If the home served a non-residential purpose before you moved in — as a rental, vacation home, or business property — part of the gain may be permanently ineligible. “Nonqualified use” covers any period after December 31, 2008, when the property was not the principal residence of you, your spouse, or your former spouse.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

The timing matters. Nonqualified use that happens after you stop living in the home doesn’t count against you. So if you move out and rent the property for a period before selling, that post-residence rental time is not nonqualified use. When the rule does apply, you prorate: the fraction of gain you cannot exclude equals total months of nonqualified use divided by total months of ownership. This provision shuts down the strategy of buying a rental, holding it for years, moving in for two, and walking away with the entire gain tax-free.

Depreciation Recapture

Any depreciation you claimed, or were entitled to claim, on the property after May 6, 1997, must be recaptured. This “unrecaptured Section 1250 gain” is taxed at a maximum rate of 25% and cannot be excluded under Section 121 under any circumstances.4Internal Revenue Service. Property (Basis, Sale of Home, Etc.) 5 If you deducted $30,000 of depreciation over the years for a home office or a prior rental period, that $30,000 comes back as taxable income when you sell, even if your total gain sits well below $250,000.

The 3.8% Net Investment Income Tax

Gain that falls inside the Section 121 exclusion is fully shielded from the 3.8% Net Investment Income Tax. Gain above the exclusion, however, can trigger NIIT if your modified adjusted gross income exceeds $250,000 (married filing jointly), $200,000 (single), or $125,000 (married filing separately).5Internal Revenue Service. Questions and Answers on the Net Investment Income Tax These thresholds are not indexed for inflation. Combined with the top 20% long-term capital gains rate, the federal rate on the excess gain can reach 23.8%, before any depreciation recapture or state tax.

Special Situations

Surviving Spouses

A widow or widower who sells within two years of a spouse’s death can still claim the full $500,000 exclusion as a single filer, provided the ownership and use requirements for the joint exclusion were met as of the date the spouse died.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence The two-year window is strict. Sell on day one past the second anniversary and the limit drops to $250,000. The surviving spouse also receives a stepped-up basis on the decedent’s share of the home, set to fair market value as of the date of death.6Office of the Law Revision Counsel. 26 USC 1014 – Basis of Property Acquired From a Decedent

Divorce

When a home is transferred between spouses or former spouses as part of a divorce, the receiving spouse inherits the other’s ownership period. If your ex-spouse owned the home for three years before transferring it to you, you get credit for those three years. Each spouse can independently claim a $250,000 exclusion on a later sale, provided each one personally meets the use test. The spouse who moved out can lose use qualification if they’ve been gone too long before the sale.

Military, Foreign Service, and Intelligence Personnel

Members of the uniformed services, the Foreign Service, and the intelligence community can elect to suspend the five-year lookback for up to 10 additional years while on qualified official extended duty, stretching the window to as long as 15 years.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence Qualified official extended duty means serving at a duty station at least 50 miles from the home, or living in government quarters under orders, for more than 90 days or an indefinite period. The suspension covers the spouse as well, applies to only one property at a time, and must be affirmatively elected.

Homes Acquired in a 1031 Exchange

If you got the home through a like-kind exchange under Section 1031, converting a former investment property into your residence, you must own it for at least five years before Section 121 is available, not the usual two. The five-year clock runs from the date you acquired the property through the exchange. The nonqualified use rules still apply to the pre-residence rental period, so a portion of the gain remains ineligible even after you clear the five-year hurdle.

Whether You Have to Report the Sale

If your entire gain is covered by the exclusion and you did not receive a Form 1099-S from the closing agent, you generally don’t need to report the sale on your tax return. You must report it if:

  • Your gain exceeds the exclusion amount.
  • You received a Form 1099-S, even if all of the gain is excludable.
  • You choose to treat the gain as taxable, for example to preserve the exclusion for an expected sale in the next two years.7Internal Revenue Service. Publication 523 (2025), Selling Your Home

When reporting is required, you use Form 8949 to show the sale details and carry the totals to Schedule D of Form 1040.8Internal Revenue Service. About Form 8949, Sales and Other Dispositions of Capital Assets