← All guides

Capital gains tax on a home sale: the Section 121 exclusion and recapture

Most home sellers owe zero tax thanks to Section 121. But for high-appreciation homes the bill can hit six figures. Here’s how it works and how to reduce it.

Last updated April 2026

General information, not advice. It may contain errors or be out of date, so verify anything you plan to act on. Disclaimer

On this page

Most home sellers owe zero capital gains tax thanks to the Section 121 exclusion. But for high-appreciation homes (especially in coastal markets), or for properties that were ever rented, the tax can easily hit six figures. There are specific moves to reduce it, and most of them require planning before you list, not after.

This is a guide, not tax advice. For a high-gain sale, hire a CPA.

The Section 121 exclusion

If you sold your primary residence at a gain, the IRS lets you exclude a chunk of it from taxation entirely:

  • Single filer: first $250,000 of gain excluded
  • Married filing jointly: first $500,000 excluded

To qualify, you need to pass three tests:

  • Ownership test. Owned the home at least 2 of the last 5 years (counted from the closing date of the sale).
  • Use test. Lived in it as your primary residence at least 2 of the last 5 years (24 months total, doesn’t need to be consecutive). For married couples filing jointly to claim the full $500k, both spouses must pass the use test, but only one needs to pass the ownership test. Neither spouse can have used 121 in the prior 2 years.
  • Look-back test. Haven’t used the Section 121 exclusion on another home sale in the last 2 years.

Pass all three, and the first $250k/$500k of gain disappears for tax purposes.

Surviving spouse rule. If your spouse died, you can still claim the full $500k MFJ exclusion if you sell within 2 years of the date of death and you haven’t remarried, assuming the ownership/use tests were met immediately before death. After that 2-year window the limit drops to $250k.

Nonqualified use (post-2008 rule). Most generalist guides miss this one. If the home was used as something other than your primary residence after January 1, 2009 (a rental, a vacation home), the portion of gain attributable to that nonqualified period is not excludable, even if you later move in and pass the 2-of-5 tests. The exception: any rental period after you last used it as primary doesn’t count as nonqualified use (so the “move out and rent it” play still works inside the 5-year window). Rental before you ever moved in does count and reduces the exclusion pro-rata.

Calculating the gain

The taxable number is adjusted gain, not raw appreciation. Two calculations:

Amount realized:

  • Selling price
  • Minus selling costs (agent commission, transfer tax, title insurance, recording fees, attorney fees)
  • = Net proceeds the IRS considers you “received”

Adjusted basis:

  • Original purchase price
  • Plus capital improvements (additions, kitchen remodel, new roof, new HVAC, finished basement, but not routine maintenance)
  • Minus any depreciation taken or that you should have taken (if the property was ever rented)
  • = Your “investment” for tax purposes

Gain = Amount realized − Adjusted basis.

Then apply Section 121 to get your taxable gain.

Example 1: no tax owed

You bought your home in 2014 for $300,000. You’re selling in 2026 for $700,000. Selling costs (commission, transfer tax, title): $50,000. Over the years you put in $30,000 of capital improvements (new roof, new HVAC, kitchen reno). You’re married, filing jointly.

  • Amount realized: $700,000 − $50,000 = $650,000
  • Adjusted basis: $300,000 + $30,000 = $330,000
  • Gain: $650,000 − $330,000 = $320,000
  • Section 121 exclusion (MFJ): $500,000

Your $320k gain is fully covered by the $500k exclusion. Tax owed: $0. But because the $700k price is above the $500k limit for the 1099-S certification exception (MFJ), the title company will issue a Form 1099-S, so report the sale and the exclusion on Form 8949 / Schedule D.

Example 2: a large tax bill

You bought a home in coastal CA in 2009 for $400,000. You’re selling in 2026 for $1,600,000. Selling costs: $120,000. You never documented capital improvements (oof). Married, filing jointly.

  • Amount realized: $1,600,000 − $120,000 = $1,480,000
  • Adjusted basis: $400,000 (no improvements claimed)
  • Gain: $1,080,000
  • Section 121 exclusion (MFJ): $500,000
  • Taxable gain: $580,000
Example 1 $700k sale, MFJ Basis $330k selling costs $50k Excluded $320k $180k of the exclusion unused Gain $320k Example 2 $1.6M sale, MFJ Basis $400k selling costs $120k Excluded $500k Taxable $580k Gain $1.08M
Both examples on this page, drawn to the same scale. The sale price splits into basis, selling costs, and gain, and the exclusion comes off the gain. In Example 1 the $500k exclusion covers the whole gain. In Example 2 the gain is more than twice the exclusion, so $580k is left to tax.

Now the rough bill (it depends on other income). Assume about $150k of other taxable income (W-2, after the standard deduction):

  • Federal long-term capital gains. A $580k gain straddles the 15% and 20% LTCG brackets. Stacked on top of $150k of ordinary income, $463,700 falls in the 15% band (which tops out at $613,700 MFJ for 2026) and $116,300 in the 20% band: roughly $93,000.
  • Net Investment Income Tax (NIIT) of 3.8% on the lesser of net investment income or MAGI above $250k MFJ. With MAGI around $762k, that’s 3.8% of ~$512k: ~$19,500.
  • California state tax. CA taxes cap gains as ordinary income. At this income level most of the gain is taxed at 9.3%, with the top slice at 10.3% (MFJ brackets): ~$55,000.

Total tax: roughly $165,000–$170,000. Run your specific numbers; brackets shift with your other income.

If you’d documented $80k of capital improvements over the years (easily plausible, since one kitchen reno gets you most of the way), your tax bill drops by roughly $26k. Document everything.

Depreciation recapture (the trap on rented homes)

If you ever rented out the property, you were required to take depreciation (residential rental: 27.5-year straight-line). Whether you did or didn’t, the IRS recaptures it on sale under the “allowed or allowable” rule. Skipping depreciation does not save you the recapture; it just means you missed a deduction.

For real estate, this is unrecaptured Section 1250 gain, taxed at your ordinary rate but capped at 25% federal. (Different rule than Section 1245 / personal property recapture, which is fully ordinary.) NIIT (3.8%) and state tax stack on top.

Recapture sits outside Section 121. The exclusion does not shield it.

Say you bought a property as a rental, depreciated $100,000 over the years, then converted it to your primary residence for 3+ years and sold. The $100k of recapture = up to $25,000 of federal tax plus $3,800 of NIIT plus state tax, even if Section 121 covers everything else.

Cost segregation amplifies this. If you accelerated depreciation on a rental via a cost seg study (5-, 7-, 15-year asset reclassification, bonus depreciation), the 5- and 7-year personal-property components recapture as ordinary income under §1245, and bonus taken on 15-year land improvements is recaptured at ordinary rates under §1250. Only the straight-line part of the 15-year items gets the 25% cap. Cost seg is a good deferral tool, but the recapture on exit is real. Get a CPA involved before you sell a property that’s had a cost seg study.

This catches a lot of people who house-hacked, rented out a home during a job relocation, or did the live-in-rental conversion play. It also catches anyone who claimed a home office deduction with depreciation on Form 8829. That depreciation is recaptured too.

Partial exclusion for qualifying reasons

Sold before hitting the 2-year mark? You may still get a pro-rated exclusion if the sale was driven by:

  • Job change: new job at least 50 miles farther from the home than the old job was (the safe harbor in Reg. §1.121-3(c)).
  • Health reasons (yours, your family’s, or a doctor-recommended move that needs documentation).
  • Unforeseen circumstances (divorce/legal separation, death, multiple births from one pregnancy, job loss qualifying for unemployment, change in employment leaving you unable to pay basic living expenses, condemnation, casualty loss).

The exclusion is pro-rated based on the shorter of (a) time you met the ownership test or (b) time you met the use test, divided by 24 months. If you lived there 12 of 24 months, you get 50% of the limit: $125k single, $250k MFJ. (Note: it’s 50% of the cap, not 50% of the gain. If your actual gain is $80k and you qualify for 50% partial exclusion, the full $80k is excluded because it falls below the $125k prorated cap.)

If the gain on a sub-2-year sale fits in the partial exclusion, no tax.

Ways to reduce the tax

If you’re facing a real bill, the moves that work:

  • Track every capital improvement, with receipts. The IRS test: an improvement betters the property, restores it to like-new, or adapts it to a new use (Reg. §1.263(a)-3, the “BAR” test). Examples: kitchen reno, bathroom reno, additions, new roof, new HVAC system, new windows, finished basement, deck, fence, permanent landscaping. A repair (painting, fixing a faucet, patching drywall, replacing carpet with similar carpet) is not added to basis on a personal residence and is non-deductible. Improvements add to basis dollar-for-dollar. Keep a running spreadsheet from year one.
  • All selling costs reduce amount realized. Agent commission, transfer tax, title insurance, recording fees, attorney fees, and in many interpretations staging and prep costs. Don’t miss any.
  • Time the sale across tax years. If your gain pushes you into the 20% LTCG bracket but next year you’ll be in the 15% bracket (retirement, sabbatical), defer.
  • Convert to rental, then 1031 exchange. A primary residence doesn’t qualify for §1031. You must convert to a bona fide rental first. Best practice: rent at FMV to an unrelated tenant for at least 2 years and document investment intent (Rev. Proc. 2008-16 safe harbor for the outbound side is also 2 years). The trade-off: extending the rental period eventually breaks the Section 121 use test (2 of 5 years), so you typically choose one strategy or the other. There’s a narrow window where a partial 121 + 1031 combo works (Rev. Proc. 2005-14) but it requires careful planning. See the 1031 exchange step-by-step guide.
  • Installment sale. If you seller-finance, you spread the gain over the years payments arrive. Rare; doesn’t apply to most sellers.
  • Charitable remainder trust. For very high gains ($1M+), a CRT can defer and partly eliminate tax. Talk to a tax attorney; the complexity isn’t worth it under that level.

The “moved out, still own” scenario

You moved out of your primary residence and now rent it. The Section 121 clock keeps ticking. Practically, you have just under 3 years from when you moved out to close the sale while still meeting the use test (used as primary 2 of the last 5 years).

Sell at year 2.5 of being out: still qualifies (you used it 2.5 of the last 5 years).

Sell at year 3.5 of being out: doesn’t qualify (only 1.5 of the last 5 used as primary).

Moved out Just under 3 years last chance to close Lived in it as your main home Rented out 2.5 years of use Sell 2.5 years out: qualifies 1.5 years of use Sell 3.5 years out: fails 5 years before each sale −3 −2 −1 0 +1 +2 +3 +4 years since you moved out
The 5-year look-back slides forward with the sale date. Every month you rent pushes a month of your own use out the back of the window. Once less than 2 years of use is left inside it, just under 3 years after you move out, the exclusion no longer applies.

Two things people miss:

  • Recapture still applies for the rental period, even if Section 121 covers the rest of the gain, up to 25% federal on the depreciation taken or allowable.
  • The post-2008 nonqualified use rule generally does not bite here: rental periods after your last use as primary aren’t treated as nonqualified use. So the gain (less recapture) is fully excludable up to the cap if you sell in time.

If you’re in this situation and the appreciation is meaningful, the 3-year deadline is real money.

Common mistakes

  • Not tracking capital improvements. The biggest avoidable loss. Fifteen years from now you won’t remember what you spent on the kitchen. Keep a folder, with receipts.
  • Ignoring depreciation recapture on previously-rented homes. Many sellers find out at filing.
  • Missing the partial exclusion. Sub-2-year sales for qualifying reasons get pro-rated relief.
  • Skipping a CPA on a high-gain sale. A few thousand in CPA fees routinely saves tens of thousands. On a six-figure tax bill, you cannot afford to wing this.
  • Confusing federal and state. Many states tax cap gains as ordinary income (CA, OR, MN, NJ, NY). A handful have no state income tax at all (FL, TX, NV, SD, WY, AK, TN, and NH, whose interest-and-dividends tax ended after 2024; WA taxes investment income only in limited form. WA has a 7% cap gains tax above ~$270k that does not apply to real estate, but check current law). Run the state number too.
  • Forgetting Form 8949 / Schedule D filing. Even if Section 121 fully excludes the gain, you generally must report the sale if you receive a Form 1099-S. Title companies routinely issue them.
  • Reporting on the wrong year. The taxable year is the year of closing, not the year of contract.

Tools you’ll use

Related reading: pricing your home, negotiating offers, and the 1031 exchange step-by-step.

Spot an error or something out of date? Report it

Report a problem

On

What kind of problem?