Login Create Free Account

Selling Your Home: The Section 121 Exclusion

By Eric Etu, Founder, AlwaysOnTax.com · Last updated

Why This Matters

When you sell your home, any gain — the difference between what you paid and what you sold it for, minus selling costs — is potentially taxable as a capital gain. In appreciated real estate markets, that gain can be substantial: hundreds of thousands of dollars, or in some cases, millions.

Fortunately, the tax code provides one of the most generous exclusions available to individual taxpayers: Section 121 of the Internal Revenue Code, often called the “home sale exclusion.” If you meet the requirements, you can exclude up to $250,000 of gain (single filers) or $500,000 (married filing jointly) from federal taxation entirely.

For high earners — many of whom buy in expensive markets, hold their homes for years, and may move multiple times in their careers — understanding the Section 121 rules is essential to avoiding unexpected tax bills.

Calculating Your Gain: Adjusted Basis and Selling Costs

Before applying the Section 121 exclusion, you first need to calculate your gain. The formula is straightforward:

Gain = Sale Price − Selling Costs − Adjusted Basis

Both selling costs and improvements you’ve made to the home reduce your gain — meaning more of your sale proceeds get sheltered from tax, even before the Section 121 exclusion is applied. For homeowners with significant gains, careful tracking of these items can be the difference between a fully sheltered sale and a substantial tax bill.

Selling Costs

Selling costs are expenses directly related to the sale of the home. Common examples include:

  • Real estate agent commissions (typically the largest selling cost — often 5–6% of the sale price)
  • Title insurance fees paid by the seller
  • Transfer taxes and recording fees
  • Legal fees related to the sale
  • Advertising and marketing costs

These are subtracted directly from the sale price to determine your “amount realized” — the starting point for calculating gain.

Improvements That Add to Basis

Capital improvements — permanent additions or upgrades that add value to your home, prolong its useful life, or adapt it to new uses — increase your cost basis. Examples include:

  • New roof, HVAC system, or water heater
  • Kitchen or bathroom remodels
  • Room additions or finished basements
  • New flooring or windows
  • Landscaping that adds permanent value (driveways, retaining walls)
  • Installation of central air conditioning, security systems, or solar panels

To qualify as an improvement that adds to basis, the work must have an expected useful life of more than one year and result in a lasting benefit to the property.

What Does NOT Count

Routine maintenance and repairs do not add to basis. The distinction matters: maintenance keeps the property in working condition; improvements upgrade or extend it. Examples that do NOT add to basis:

  • Painting (interior or exterior) as routine maintenance
  • Fixing leaks, replacing broken fixtures, or repairing damage
  • Lawn care and routine landscaping
  • Cleaning, gutter clearing, or pest control
  • Replacing worn-out appliances with similar models (rather than upgrading)

There’s a useful exception: if repair work is done as part of a larger remodeling or restoration project, the repair costs can be included in the basis along with the broader project costs.

Example

You bought a home for $700,000. Over the years, you spent $80,000 on capital improvements: a kitchen remodel ($45,000), a new roof ($20,000), and a finished basement ($15,000). When you sell, you pay $50,000 in real estate commissions and $5,000 in other closing costs.

Your sale price is $1,300,000. Your gain calculation:

  • Amount realized: $1,300,000 − $55,000 selling costs = $1,245,000
  • Adjusted basis: $700,000 + $80,000 improvements = $780,000
  • Gain: $1,245,000 − $780,000 = $465,000

Without tracking the improvements and selling costs, your “gain” would have appeared to be $600,000 ($1,300,000 − $700,000). By properly accounting for them, you reduce the gain by $135,000 — which, depending on your filing status, may mean the difference between owing tax on the sale or not.

This is why record-keeping matters. Save receipts and contracts for every improvement you make to the home. When you eventually sell — possibly decades later — you’ll need that documentation to support your adjusted basis.

The Basic Rule: $250,000 / $500,000

The exclusion amount depends on your filing status:

  • Single filers: exclude up to $250,000 of gain
  • Married filing jointly: exclude up to $500,000 of gain

The exclusion applies to the gain, not the sale price. If you bought your home for $800,000 and sold it for $1,200,000, your gain is $400,000 (before considering selling costs and improvements). A married couple would exclude all of it; a single filer would exclude $250,000 and pay capital gains tax on the remaining $150,000.

Gain above the exclusion is taxed at long-term capital gains rates (15% or 20% depending on income), and may also be subject to the Net Investment Income Tax (NIIT) of 3.8% for high earners.

The Two Tests: Ownership and Use (the “2 of 5” Rule)

To qualify for the exclusion, you must satisfy two tests during the 5 years immediately preceding the sale:

  1. Ownership test: You must have owned the home for at least 24 months (2 years) during the 5-year period.
  2. Use test: You must have used the home as your primary residence for at least 24 months during the same 5-year period.

Important nuances:

  • The 24 months don’t need to be contiguous. You can aggregate non-consecutive periods to meet the threshold.
  • The ownership and use periods don’t need to overlap. You could have owned the home for 3 years (as a rental, say) and then lived in it for 2 years, and meet both tests.
  • Both tests must be met for the same property.

The “Once Every Two Years” Rule

You can only claim the full Section 121 exclusion once every two years. If you claimed it on a home sale less than two years ago, you cannot claim it again on a new sale — even if you otherwise qualify.

This rule prevents serial home flippers from repeatedly excluding gains. For taxpayers who move frequently, this becomes a planning constraint.

Strategy: Planning Around Timing for Frequent Movers

If you anticipate moving multiple times in a short period — for job changes, family circumstances, or other reasons — the Section 121 rules create planning opportunities:

Spacing out home sales. If you plan to sell your current home and buy another, plan for at least two years between sales if you want to claim the exclusion on both. Selling two homes within 24 months of each other means you can only exclude gain on one.

Partial exclusions for unforeseen circumstances. The IRS allows a prorated exclusion if you don’t meet the 2-of-5 test due to:

  • A change in employment (typically requiring a move of 50+ miles)
  • Health reasons
  • Other “unforeseen circumstances” (divorce, death in family, multiple births from one pregnancy, etc.)

The partial exclusion is calculated as a fraction of the full exclusion — for example, if you owned/used the home for 12 months instead of 24, you’d be entitled to half the exclusion ($125,000 single / $250,000 MFJ). This can substantially soften the tax impact for taxpayers who must move unexpectedly.

Strategy: Converting a Rental Back to a Primary Residence — With a Critical Caveat

A popular strategy is to take a property you’ve been renting out, move back into it as your primary residence for 2 years, and then sell — using Section 121 to shelter the gain.

This strategy works, but with significant limitations.

In 2008, Congress added Section 121(b)(5), which introduced the concept of “nonqualified use.” For property converted from rental to primary residence after January 1, 2009, the period during which the home was used as a rental counts as nonqualified use. Gain allocable to that nonqualified use period cannot be excluded under Section 121, even if you satisfy the 2-of-5 test.

Example. You buy a rental property in 2018 and rent it out for 6 years. In 2024, you move into the property as your primary residence and live there for 2 years. You sell in 2026.

You technically satisfy the 2-of-5 test. But the 6 years of rental use is nonqualified use. The IRS allocates gain proportionally:

  • 6 years rental / 8 years total = 75% nonqualified use
  • 2 years primary residence / 8 years total = 25% qualified use

Only 25% of your gain qualifies for the Section 121 exclusion. The remaining 75% is taxable.

If your total gain is $400,000, only $100,000 (25%) is eligible for the exclusion. The other $300,000 is taxed as long-term capital gain, regardless of how long you’ve now been using it as a primary residence.

The strategy of converting rentals to primary residences still works to some extent — but the tax benefit is far smaller than many people assume.

The Trailing Period Exception (the Reverse Scenario)

The nonqualified use rule does NOT apply in the opposite direction. If you lived in your home as your primary residence first, then converted it to a rental, then sold within the 5-year window, the period of rental use AFTER your last primary residence use is not counted as nonqualified use.

Example. You buy and live in your home from 2020–2023 (3 years). In 2024, you move out for a job and rent the property to tenants. You sell in 2026.

  • 2020–2023: primary residence (qualifies for ownership and use)
  • 2024–2026: rental, but this is a “trailing period” — not nonqualified use because it’s after your last primary use

You satisfy the 2-of-5 test (you lived there 3 years in the 5-year lookback), and the rental period is not penalized. Your full gain (up to the exclusion limit) is excluded.

This is an important protection for “accidental landlords” — homeowners who moved for work or other reasons and rented their former home before selling.

Other Important Considerations

Depreciation recapture. If you ever rented the home or used it for business, you owe tax on the depreciation you claimed (or were entitled to claim), regardless of the Section 121 exclusion. This is recaptured at a maximum rate of 25%. The Section 121 exclusion does not eliminate depreciation recapture.

Death of a spouse. If your spouse dies, you can claim the full $500,000 exclusion if you sell within 2 years of the death (assuming you otherwise qualify). After 2 years, you’d be limited to the single filer’s $250,000 exclusion.

The Takeaway

The Section 121 home sale exclusion is one of the most generous tax breaks available to individual taxpayers — $250,000 single / $500,000 married filing jointly in tax-free gain on the sale of your primary residence. Before applying the exclusion, careful tracking of capital improvements and selling costs can significantly reduce your gain, sheltering even more of your sale proceeds from tax. To qualify, you must have owned and used the home as your primary residence for at least 2 years out of the 5 preceding the sale, and you can only claim the exclusion once every 2 years. Partial exclusions are available for unforeseen circumstances like job changes or health issues. The popular strategy of converting a rental property to a primary residence to claim the exclusion has serious limitations under the nonqualified use rules — much of the gain may still be taxable. However, the reverse scenario (living in the home first, then renting) is much more favorable because of the trailing period exception. For homeowners considering a sale, understanding these rules in advance can prevent costly surprises.

This guide is for educational purposes only and does not constitute tax, legal, or investment advice. Tax outcomes depend on your individual circumstances and may change based on future legislation or IRS guidance. AlwaysOnTax does not address state or local tax planning. Consult a qualified tax professional before acting on any strategy discussed here.