Capital Gains Tax on a Home Sale (2026)
Sell your primary home and the first $250,000 of gain ($500,000 married filing jointly) can be tax-free under IRC §121. This page shows exactly what is taxed, and a calculator that runs the math on your numbers.
Reviewed & updated · 2026 tax-year figures · Federal §121 exclusion & §1250 recapture
If you owned and lived in your home for at least 2 of the last 5 years, you can exclude up to $250,000 of gain if single, or $500,000 if married filing jointly, under IRC §121. Only gain above that exclusion is taxed — at long-term rates of 0%, 15%, or 20% (IRC §1(h)), plus the 3.8% NIIT for high earners. Gain is measured from your adjusted basis: purchase price + capital improvements + selling costs. If you ever rented the home, depreciation you claimed is recaptured at up to 25% (§1250) and cannot be excluded.
Net proceeds $750,000$0
Show our work the exact math
Estimates only, for the 2026 tax year. Not tax advice. Dollar thresholds marked est. are projected 2026 figures, owner-verifiable against the final IRS release. State tax, AMT, and the 3.8% NIIT interaction with recapture can move your real number.
How does the §121 home-sale exclusion work?
When you sell your main home, IRC §121 lets you exclude a large chunk of the gain from tax entirely. A single filer excludes up to $250,000 of gain; a married couple filing jointly excludes up to $500,000. This is not a deduction you claim against income — it simply erases that slice of the gain before any capital-gains rate touches it. Only gain above the exclusion is taxed, and it is taxed at long-term rates because a home held long enough to qualify has by definition been held more than a year.
The full $500,000 joint exclusion requires that both spouses meet the use test and at least one meets the ownership test, and that neither excluded gain from another home sale in the prior two years. Details and worksheets are in IRS Publication 523 and IRS Topic No. 701.
What is the 2-out-of-5-year rule?
To claim the exclusion you must pass two tests during the five-year period ending on the sale date:
- Ownership test — you owned the home for at least 24 months (2 years).
- Use test — you lived in it as your main home for at least 24 months.
The months need not be continuous, and the ownership and use periods need not overlap — short absences (vacations, seasonal moves) still count as time lived in the home. You also generally cannot use the full exclusion if you claimed it on another home sale within the last two years. Fail the test with no qualifying reason, and no exclusion applies — the whole gain is taxable at long-term rates.
How do I calculate my adjusted basis?
Your taxable gain is measured from adjusted basis, not the raw purchase price — and a higher basis means a smaller gain. Per Pub 523:
| Component | Effect | Examples |
|---|---|---|
| Purchase price | Starting point | Contract price you originally paid |
| + Capital improvements | Increases basis | New roof, addition, kitchen remodel, HVAC, permanent landscaping |
| + Selling costs | Increases basis | Agent commission, title fees, transfer taxes, legal fees |
| − Depreciation taken | Decreases basis | Depreciation while rented (drives recapture) |
| = Adjusted basis | Used in gain | Sale price − adjusted basis = total gain |
Routine repairs — repainting, fixing a leak, patching drywall — do not add to basis. Only improvements that add value, prolong the home's life, or adapt it to new uses count.
Can I get a partial exclusion if I move early?
Yes. If you sell before hitting the full two years because of a qualifying reason, §121 grants a prorated exclusion. Qualifying reasons include a work-related move (generally 50+ miles), a health-related move, or an unforeseeable event such as divorce, death, job loss with unemployment benefits, or multiple births from one pregnancy. The partial exclusion is your maximum exclusion times the fraction of qualifying months over 24.
What about depreciation recapture on a rental?
If the home was ever a rental or had a home office you depreciated, the IRS takes back that tax benefit when you sell. Under IRC §1250, unrecaptured Section 1250 gain — the portion of gain attributable to depreciation you claimed — is taxed at a maximum federal rate of 25%. Two things make this sting:
- Recaptured depreciation is not eligible for the §121 exclusion — even on a former primary residence, you owe on it.
- Depreciation you were allowed is recaptured whether or not you actually claimed it, so skipping the deduction does not avoid the tax.
How this calculator works & where the numbers come from
No black box. The tool follows the same sequence as the IRS worksheet in Publication 523: (1) adjusted basis = purchase price + improvements + selling costs − depreciation; (2) total gain = sale price − adjusted basis; (3) apply the §121 exclusion (full, partial, or none) against the appreciation gain, but never against depreciation recapture; (4) tax any remaining long-term gain across the 0/15/20% bands per IRC §1(h) by stacking it on your other taxable income; (5) tax unrecaptured §1250 gain at up to 25%; (6) add the 3.8% NIIT where modified AGI crosses the §1411 threshold.
CHECK
Primary sources (linked, not just named)
- 26 U.S.C. §121 — home-sale exclusion
- 26 U.S.C. §1250 — depreciation recapture
- 26 U.S.C. §1(h) — capital gains rates
- 26 U.S.C. §1411 — 3.8% NIIT
- 26 U.S.C. §1014 — stepped-up basis
- IRS Publication 523 — Selling Your Home
- IRS Topic No. 701 — Sale of Your Home
- IRS Topic No. 409 — Capital Gains and Losses
Capital gains tax on a home sale, answered
How much is capital gains tax on the sale of a home?
On a primary residence you can exclude up to $250,000 of gain if single, or $500,000 if married filing jointly, under IRC §121, if you owned and lived there 2 of the last 5 years.
Only gain above the exclusion is taxed, at long-term rates of 0%, 15%, or 20% (§1(h)), plus the 3.8% NIIT for high earners. Gain is measured from adjusted basis = purchase price + improvements + selling costs.
What is the 2-out-of-5-year rule for home sales?
You must have owned the home and used it as your main home for at least 24 months during the 5-year period ending on the sale date. The ownership and use periods do not have to be continuous or overlap. You generally cannot claim the full exclusion more than once every two years.
How do I calculate the adjusted basis of my home?
Adjusted basis = original purchase price + capital improvements + selling costs, minus any depreciation taken (Pub 523). A new roof, an addition, or a remodel raise basis; routine repairs and maintenance do not. Selling costs like the agent commission and closing fees also count. A higher basis means a smaller taxable gain.
What is depreciation recapture on a rental home sale?
If you rented the home and claimed depreciation, that depreciation is recaptured when you sell. Unrecaptured Section 1250 gain is taxed at a maximum federal rate of 25% (§1250) and cannot be sheltered by the §121 exclusion, even on a former primary residence.
Can I get a partial home-sale exclusion if I move early?
Yes — if you sell before two years for a qualifying reason (work move, health, or an unforeseeable event like divorce or death), you get a prorated exclusion. It equals your maximum exclusion times the qualifying months of ownership and use divided by 24 (Pub 523).
Do I pay capital gains tax on an inherited home?
Inherited property generally gets a stepped-up basis equal to fair market value on the date of death (§1014), so selling soon after inheriting often produces little gain. The §121 exclusion applies only if you then use the home as your own main home for the required period. See how to reduce capital gains tax legally.
Why trust this over a bank calculator?
Most "home sale calculators" hand you a single scary number with no way to check it, gate the real answer behind an email, and never mention that a couple can shield a half-million dollars of gain. We flipped it. The tool loads first. It shows its arithmetic — adjusted basis, the exclusion applied, the bands your gain crosses, and any recapture. It links the actual statute. If a figure is a 2026 projection, we say so. That is the whole pitch.