Millionaire Advisor Match

Home Sale Capital Gains Tax Calculator 2026

In high-cost housing markets, a $1M–$5M household can easily have $400K–$900K of gain embedded in a primary residence. The primary residence exclusion under IRC §121 shields the first $250K (single) or $500K (married) from federal tax — but anything above that threshold faces long-term capital gains rates plus potentially 3.8% NIIT. If you ever rented the property or took home office deductions, depreciation recapture adds another layer. Understanding all three before you list avoids a surprise six-figure tax bill at closing.

Home Sale Capital Gains Calculator

Estimates federal tax only. Assumes you held the property long-term (more than one year). State income tax varies — see notes below.

The §121 Primary Residence Exclusion

The most important rule in home sale taxation is IRC §121, which allows you to exclude up to $250,000 (single filers) or $500,000 (married filing jointly) of capital gain from the sale of your primary residence — completely federal-tax-free.1 This exclusion is not a one-time lifetime benefit; you can use it repeatedly, as long as you haven't used it within the prior 2 years.

The 2-of-5-Year Ownership and Use Test

To claim the full exclusion you must have both owned and used the home as your principal residence for at least 2 of the 5 years immediately before the sale date. The two years don't need to be consecutive. You can count any 24 months (in aggregate) within the 5-year window. Vacations and temporary absences generally count as periods of use.2

For married couples filing jointly, both spouses must meet the use test (2 years each), but only one spouse needs to meet the ownership test. If only one spouse qualifies, the exclusion ceiling drops to $250K.

Partial Exclusion for Qualifying Hardship

If you sell before completing 2 years because of a job change (relocation 50+ miles), a health necessity, divorce, or another IRS-recognized unforeseen circumstance, you can claim a partial exclusion: (qualifying months as primary residence ÷ 24) × the full exclusion ceiling. For example, a single filer who lived there 18 months for a job relocation qualifies for 18/24 × $250K = $187,500 in exclusion — not zero.

What Goes Into Your Cost Basis

Your adjusted cost basis reduces the taxable gain. It starts with the original purchase price and then adjusts for:

Ordinary repairs and maintenance — painting, replacing appliances, fixing a leaky faucet — do not add to your basis. Only improvements that extend useful life or add value count.

When the Exclusion Isn't Enough: NIIT and the 15% / 20% LTCG Rates

For most $1M–$5M households, gains above the §121 exclusion fall into the 15% long-term capital gains bracket — not 20%. The 20% rate only applies when the combination of ordinary income plus taxable gain exceeds $545,500 (single) or $613,700 (MFJ).3

But there's a second overlay: the 3.8% Net Investment Income Tax (NIIT) applies to capital gains — including home sale gain above the §121 exclusion — when your MAGI exceeds $200,000 (single) or $250,000 (MFJ).4 Home sales often spike MAGI well above those thresholds, making NIIT effectively unavoidable for this audience.

Scenario (MFJ couple) Taxable Gain Federal Tax Rate on Taxable Gain
$700K gain, §121 covers $500K$200K~$37,600~18.8%
$1.2M gain, §121 covers $500K$700K~$131,600~18.8%
$500K gain, <2 yr — no exclusion$500K~$94,000~18.8%

Depreciation Recapture: The Rental and Home Office Trap

If you ever rented out your home (or a portion of it) or deducted a home office, you likely claimed depreciation on your tax returns. That depreciation must be recaptured at the time of sale — taxed as "unrecaptured §1250 gain" at a maximum federal rate of 25%, regardless of your regular bracket.5

How it works: Say you rented your home for 3 years and took $45,000 in depreciation deductions. When you sell, $45,000 of the gain is pulled out and taxed at 25% ($11,250) before the remaining gain gets the favorable LTCG treatment. NIIT also applies to the recapture amount if your MAGI is above the threshold.

Two traps to know:

Inherited Homes: Step-Up Eliminates Almost Everything

If you inherit a home, you receive a stepped-up cost basis to the fair market value at the date of death under IRC §1014. This nearly always eliminates the embedded gain: if a parent paid $200,000 for a home now worth $900,000, your basis is $900,000. Sell it for $950,000 and you have only $50,000 of gain — far below the §121 exclusion if you move in and meet the use test, or a small LTCG if you sell immediately.6

The step-up was preserved by the OBBBA (P.L. 119-21, 2025). There is no step-up elimination; proposals to tax unrealized gains at death did not pass.

State Income Tax: Widely Overlooked

Home sale gains that exceed the federal §121 exclusion are generally also taxable at the state level — but the rules vary dramatically:

For California residents with large embedded gains, the state tax bill can easily exceed the federal bill. This makes the timing of a move to a no-tax state before a high-gain sale a significant financial decision — though California's "safe harbor" rules require physical departure and domicile change, not just a temporary relocation. See our state income tax planning guide for detail.

Planning Strategies Before You Sell

1. Maximize Your Cost Basis

Every dollar of legitimate capital improvements you document reduces your taxable gain dollar-for-dollar. Before listing, compile receipts for kitchen and bathroom renovations, additions, new roofs, HVAC systems, landscaping, and other basis-adding improvements going back to your purchase date. If you can't find records, a contractor's reconstruction of costs can support the deduction. Keep everything — this can reduce your tax by $15,000–$40,000 on a major renovation.

2. Time the Sale for a Low-Income Year

Capital gains stack on top of ordinary income. If you're planning to sell the year you retire — before Social Security, before RMDs, with lower W-2 income — your taxable gain may fall entirely in the 15% bracket rather than the 20%. Even better, a year with very low income might place some gain in the 0% LTCG bracket. Run the calculator with your expected income in different years before deciding when to list.

3. Watch the IRMAA Cascade

A large home sale can spike your MAGI above Medicare IRMAA thresholds — 2 years after the sale year (Medicare uses MAGI with a 2-year lookback). A $300K taxable gain in 2026 affects your 2028 Medicare premiums. If you're over 63, model the IRMAA surcharges before selling. This doesn't change whether to sell, but it affects how to manage other income in the same year.

4. Consider a Roth Conversion in the Sale Year — Carefully

The year you sell your home is often a candidate for a Roth conversion, because you may be in a transitional income year. But watch the interaction: a Roth conversion increases ordinary income, which stacks under the capital gain and pushes more of it into the 20% bracket. And the combined MAGI increase can push you past IRMAA thresholds. Model both together before executing. See our Roth conversion guide.

5. Charitable Giving in the Same Year

A large-gain sale year is ideal for charitable bunching via a Donor-Advised Fund. You can't donate the home itself and get the exclusion — the §121 exclusion applies first — but funding a DAF in the same tax year generates an itemized deduction that offsets ordinary income, potentially reducing the income that stacks under your gains. See DAF strategy guide.

6. Rental Properties: 1031 Exchange Instead

The §121 exclusion applies only to your primary residence. If you own investment property or a second home, no exclusion applies to the sale. For real estate investors, a 1031 like-kind exchange defers all the gain indefinitely — no time limit until you sell the replacement property without exchanging. The total deferred gain gets a step-up at death (IRC §1014), potentially eliminating it entirely for heirs.

  1. IRC §121 — Exclusion of Gain from Sale of Principal Residence (Cornell LII)
  2. IRS Publication 523 — Selling Your Home (2025 edition)
  3. IRS Topic No. 409 — Capital Gains and Losses — 2026 LTCG brackets per IRS Rev. Proc. 2025-67
  4. IRS — Questions and Answers on the Net Investment Income Tax (IRC §1411)
  5. IRC §1250 — Gain from Depreciable Real Property (Cornell LII)
  6. IRS Publication 559 — Survivors, Executors, and Administrators (IRC §1014 step-up)

Tax values verified for 2026: §121 exclusion $250K/$500K (IRC §121, statutory); LTCG brackets per IRS Rev. Proc. 2025-67; NIIT thresholds per IRC §1411 (not inflation-indexed); unrecaptured §1250 gain rate 25% per IRC §1(h). Step-up in basis per IRC §1014 preserved by OBBBA P.L. 119-21.

Get matched with a fee-only advisor

Home sale year is often the single highest-tax year of your life. A fee-only advisor who understands tax planning can model the interaction of your gain, Roth conversions, IRMAA, charitable giving, and state taxes — and help you time and structure the sale optimally.

Fee-only · No commissions · Free match · No obligation