Skip to main content
RealCostIQ

IRC §121 · US home sale · federal · free

Capital Gains Tax Calculator for a US Home Sale

Most sellers of a primary residence owe nothing, because Section 121 excludes $250,000 of gain — $500,000 on a joint return. This works out whether you are one of them: the two tests that gate the exclusion, the basis that decides the gain, the depreciation that can never be excluded, and the rate band your gain actually lands in once it stacks on your other income.

Educational calculators — always consult a licensed professional before making financial decisions.

What will the home sell for?

Your contract price, before any costs come out.

Tap to edit
500005000000
What did you originally pay for it?

The purchase price on the day you bought.

Tap to edit
05000000
Capital improvements since you bought ($)?

Additions, a new roof, a kitchen, new windows. Not repairs.

Tap to edit
01000000
Selling costs (%)?

Commission plus seller-paid closing costs, as a share of price.

Tap to edit
015
Months you OWNED it, in the last 5 years?

Out of 60. You need 24 for the full exclusion.

Tap to edit
mo
060
Months you LIVED in it, in the last 5 years?

Out of 60. You need 24 for the full exclusion.

Tap to edit
mo
060
How do you file?

It sets both your exclusion cap and your rate bands.

$250,000 exclusion cap.

Your other taxable income this year ($)?

Everything except this sale. It decides your rate.

Tap to edit
02000000
Settlement costs when you BOUGHT ($)?

Title, recording, survey, transfer taxes you paid at purchase.

Tap to edit
0100000
Depreciation claimed since May 1997 ($)?

Only if the home was ever rented or used for business. Usually $0.

Tap to edit
0500000
Did you exclude gain on another home in the last 2 years?

One §121 exclusion per two years.

The look-back rule does not bite.

If you fall short, what caused the sale?

A qualifying reason converts 'no exclusion' into a prorated one.

No reduced exclusion.

Estimated federal tax on the sale

$42,080

8.6% of your $490,000 gain · federal only, before state tax

Total gain$490,000
§121 exclusion applied−$250,000
Taxable long-term gain$240,000

How the gain is built

Sale price$900,000
Less selling costs−$54,000
Amount realized$846,000
Adjusted basis−$356,000
Total gain$490,000

Adjusted basis is what you paid, plus the settlement costs you paid at purchase, plus every capital improvement, minus any depreciation claimed. Selling costs come off the sale price before the gain is measured.

The §121 exclusion

Full exclusion

Gain eligible for exclusion$490,000
Your exclusion cap$250,000
Exclusion applied$250,000
Taxable long-term gain$240,000

You owned the home for 60 months and lived in it for 60 of the last 60, and you have not excluded gain on another home in the last 24 months. The full $250,000 exclusion applies.

Caps of $250,000 and $500,000 are statutory and have not been indexed for inflation since 1997. IRS — Topic no. 701, Sale of your home (read 2026-08-26).

What rate applies, and to how much

0% band$0 of gain lands here$0
15% band$240,000 of gain lands here$36,000
20% band$0 of gain lands here$0
Net investment income tax3.8% on $160,000$6,080
Total federal tax$42,080

Rate bands are the tax year 2026 thresholds. IRS — Rev. Proc. 2025-32, §4.03 (tax year 2026 inflation adjustments) (read 2026-08-26). Your gain is stacked on top of the other taxable income you entered, which is what decides the band.

Before accepting a taxable gain, rebuild your basis. Every capital improvement since purchase raises it — a roof, an addition, a kitchen, new windows, a permanent landscaping change — as do the settlement costs you paid when you bought. Routine repairs do not count. People routinely understate basis because the receipts are long gone, and then pay tax on a gain that was never that large.

The 3.8% net investment income tax adds $6,080 on top of the capital gains rate. Its thresholds are statutory and, like the §121 exclusion amounts, have never been indexed for inflation — so it reaches steadily further down the income scale every year.

Federal only. Most states tax capital gains too, and none of that is included above. Add your state's treatment before treating any figure here as the bill.

Educational estimate only — not tax, legal or financial advice. Federal only: state and local capital gains tax is not included. The §121(b)(5) non-qualified-use allocation, suspended passive losses, installment sales and the special rules for military service, surviving spouses, divorce and §1031-acquired property are named on the page and are not modelled. Confirm anything tax-related with a licensed tax professional before acting on it.

Your Saved Scenarios

No saved scenarios yet

Two worked examples, same statute

The gap between these two is the whole argument for doing this properly. Both are real §121 sales. One pays 2.8% of the gain; the other pays 18.9%.

1. A long-held family home, gain above the cap

Sold for $1,200,000 with 7% selling costs. Bought for $400,000 with $8,000 of settlement costs and $120,000 of improvements since. Never rented. Joint return, both spouses lived there the whole time, $250,000 of other taxable income.

  • Amount realized $1,116,000 less adjusted basis $528,000 = a gain of $588,000.
  • Both tests met, so the full $500,000 exclusion applies, leaving $88,000 taxable.
  • Stacked on $250,000 of income the whole remainder falls in the 15% band: $13,200. The 3.8% net investment income tax adds $3,344.
  • Total $16,544 2.81% of the gain.

2. Edge case — a converted rental, sold early, by a high earner

Same statute, every gate against the seller. Sold for $900,000 after only 18 months of ownership and 12 months of residence, on a qualifying work relocation. $60,000 of depreciation was claimed while it was rented. Single filer with $520,000 of other taxable income.

  • Depreciation cut basis to $296,000, enlarging the gain to $550,000.
  • $60,000 of that is unrecaptured §1250 gain and is carved out before the exclusion is even considered — $15,000 of tax at 25%.
  • The tests fail, but the work relocation earns a §121(c) reduced exclusion of 50% of the cap = $125,000, not nothing.
  • $365,000 remains, and stacked on $520,000 of income it lands entirely in the 20% band: $73,000, plus $16,150 of net investment income tax.
  • Total $104,150 18.94% of the gain.

A model that carries a single yes/no exclusion flag and asks you to supply your own rate cannot produce the second number. That is the reason this page exists separately from the cost-to-sell net sheet, which flags the exclusion as one line on the way to your proceeds rather than working the tax out.

What this calculator does not model

Each of these can change your answer, and none of them is applied above. They are listed rather than quietly dropped, because a tax estimate that hides its own gaps is worse than no estimate.

State and local capital gains tax

Federal only. Most states tax capital gains as ordinary income, a handful do not tax them at all, and Washington levies a standalone excise on certain gains — but real property sold in-state is generally exempt from it. There are more than fifty distinct regimes and no defensible national figure, so none is applied. Add your state's treatment to every number this page produces.

The §121(b)(5) non-qualified-use allocation

If the home was used as something other than a principal residence during periods after 31 December 2008 — a rental, a second home — §121(b)(5) allocates part of the gain to that non-qualified use and denies exclusion on it, separately from the depreciation rule. That allocation depends on a full month-by-month use history that a calculator cannot honestly reconstruct from a handful of inputs. If your home was ever rented out after 2008, treat the exclusion shown here as an upper bound and consult Publication 523 or a tax professional.

Ordinary-income recapture under §1250(b)

Only unrecaptured section 1250 gain at the 25% maximum rate is modelled. Depreciation taken in excess of straight-line is recaptured as ordinary income instead. Residential rental property is depreciated straight-line over 27.5 years, so for almost every home sale this figure is zero — but it is not modelled, and if you claimed accelerated depreciation it is not zero.

Suspended passive activity losses

Disposing of a rental property in a fully taxable sale generally frees any suspended passive losses, which offset other income and can materially reduce the bill this page shows. That is a benefit, not a cost, so the figure here is conservative — but it is not calculated.

The special §121 rules for particular circumstances

Suspension of the five-year period for qualified official extended duty in the uniformed services, the Foreign Service or the intelligence community (§121(d)(9)); the surviving-spouse window that preserves the $500,000 amount for a sale within two years of a spouse's death; transfers incident to divorce; sales of vacant land adjacent to the residence; and the five-year ownership requirement that applies when the home was acquired in a §1031 exchange. Each is named because each can change the answer, and none is modelled.

Installment sales and seller financing

Gain reported over several years under the installment method spreads the tax across those years and can hold you in a lower rate band throughout. This page prices the whole gain as recognised in the year of sale.

Modified AGI is approximated by your other taxable income

The rate bands are tested against taxable income and the net investment income tax against modified adjusted gross income. These are different statutory measures — modified AGI sits above taxable income, before deductions. One input stands in for both here, which makes the net investment income tax figure approximate and, for most filers who take a deduction, understated.

The full Schedule D rate ordering

Unrecaptured section 1250 gain is taxed here at a flat 25% and is stacked beneath the remaining long-term gain when the rate bands are applied. The Schedule D Tax Worksheet's ordering is more intricate and the 25% figure is a statutory maximum rather than a flat rate, so a seller in a low ordinary bracket may pay less than shown.

Investment property being sold rather than a residence has its own route — a §1031 like-kind exchange defers the gain into a replacement property instead of excluding it, and is not available on a principal residence. If you cannot find the depreciation figure the recapture line needs, the rental depreciation calculator reconstructs it. Several of the situations above — divorce, a surviving spouse, an inherited home, a former rental, or military orders — have their own governing rule rather than a single yes/no flag; our guide to capital gains tax on a home sale walks through each one, sourced separately.

What you'll need

  • ·Sale price, and roughly what selling costs will run
  • ·What you paid, and the settlement costs you paid at purchase
  • ·Capital improvements since — dig out the receipts, this one is worth money
  • ·Months you owned it and months you lived in it, out of the last 60
  • ·Any depreciation claimed if it was ever rented or used for business
  • ·Your filing status and roughly your other taxable income this year

What you'll get

  • Your gainAmount realized against a properly built adjusted basis
  • Exclusion statusFull, reduced and prorated, or none — and exactly why
  • RecaptureThe depreciation slice that can never be excluded
  • Rate band by bandHow much of the gain falls at 0%, 15% and 20%
  • Total federal taxIncluding net investment income tax, as a share of the gain

How it works

1

Build the gain, not the profit

Sale price less selling costs gives the amount realized. Purchase price plus the settlement costs you paid at purchase plus every capital improvement, less any depreciation claimed, gives adjusted basis. The difference is the gain — and it is usually smaller than the number sellers have in their head, because improvements get forgotten.

2

Test the exclusion, in three parts

The ownership leg and the use leg each need 24 months out of the last 60, and they fail independently. A third gate bars the exclusion if you excluded gain on another home in the prior 24 months. Fall short for a qualifying work, health or unforeseeable reason and §121(c) gives you a prorated share rather than nothing.

3

Carve out depreciation before the exclusion applies

Gain equal to depreciation claimed after 1997-05-06 on any rental or business use is never excludable, however well you meet the tests. It is taxed separately at up to 25%. Leaving it inside the exclusion is the most common way a home-sale tax estimate comes out too low.

4

Derive the rate instead of guessing it

What is left is stacked on top of your other taxable income and split across the 2026 0%, 15% and 20% bands. A gain can straddle two of them. The 3.8% net investment income tax is applied on top where modified AGI passes the threshold.

The federal rules this calculator applies, and where each comes from

RuleFigurePrimary source
§121 maximum exclusion$250,000 single · $500,000 joint returnIRS — Topic no. 701, Sale of your home (read 2026-08-26)
Ownership and use tests24 months each, within the last 60IRS — Topic no. 701, Sale of your home (read 2026-08-26)
Joint-return use testEither spouse owns; BOTH must useIRS — Topic no. 701, Sale of your home (read 2026-08-26)
Prior-sale look-back24 monthsIRS — Topic no. 701, Sale of your home (read 2026-08-26)
§121(c) reduced exclusionShortest qualifying period ÷ 24 monthsIRS — Publication 523, Selling Your Home (read 2026-08-26)
Depreciation recapturePost-1997-05-06 depreciation, never excludable, taxed at up to 25%IRS — Publication 523, Selling Your Home; IRS — Topic no. 409, Capital gains and losses (read 2026-08-26)
Long-term rate bands (2026)Single 0% ≤ $49,450, 15% ≤ $545,500 · Joint 0% ≤ $98,900, 15% ≤ $613,700IRS — Rev. Proc. 2025-32, §4.03 (tax year 2026 inflation adjustments) (read 2026-08-26)
Net investment income tax3.8% above $200,000 single / $250,000 joint modified AGIIRS — Net Investment Income Tax (read 2026-08-26)

Every figure above is statutory or IRS-published, read on the date shown. The rate bands are the tax year 2026 inflation-adjusted amounts from Rev. Proc. 2025-32 §4.03. The §121 exclusion amounts and the net investment income tax thresholds are NOT inflation-indexed and have never moved. Rules version 2026-08-26. Federal only — state capital gains tax is not modelled.

About this calculator

How much capital gains tax do I pay when I sell my house?+

Often none. Under IRC §121 you can exclude up to $250,000 of gain, or $500,000 on a joint return, if you owned the home and used it as your principal residence for at least 24 months out of the 60 ending on the sale date. Only the gain above that is taxed. A couple selling for $1,200,000 a home they bought for $400,000 and improved by $120,000 has a $588,000 gain, excludes $500,000 of it, and owes $16,544 federally — 2.8% of the gain. Note the exclusion amounts are statutory and have not been indexed for inflation since 1997.

What is the 2-out-of-5-year rule for home sale capital gains?+

It is two separate tests, not one. You must have owned the home for at least 24 months of the last 60, and separately used it as your principal residence for at least 24 months of the same period. Neither stretch has to be continuous, and they do not have to be the same months. On a joint return either spouse can satisfy the ownership leg, but both must satisfy the use leg individually — one spouse falling short drops the couple's cap from $500,000 to $250,000. A third gate applies too: you cannot use the exclusion if you already excluded gain on another home in the two years before this sale.

Can I get a partial exclusion if I lived there less than two years?+

Yes, if a qualifying reason caused the sale. Under §121(c), a work relocation of at least 50 miles, a health matter, or an unforeseeable event such as a death, divorce, job loss or disaster converts "no exclusion" into a prorated one. Publication 523 prorates by the shortest of three periods — time owned, time lived in, and time since your last excluded sale — over 24 months. Twelve qualifying months is therefore half the cap: $125,000 for a single filer rather than nothing. Without a qualifying reason there is no partial exclusion, and the whole gain is taxable.

Do I pay capital gains tax on a rental property I used to live in?+

Partly, and the depreciation is the expensive half. Gain equal to depreciation allowed or allowable after 6 May 1997 can never be excluded under §121 no matter how well you meet the tests, and it is taxed as unrecaptured section 1250 gain at up to 25%. It bites twice: the depreciation already reduced your basis, which enlarged the gain, and the same amount is then taxed on the way out. In the worked example on this page — a home sold for $900,000 after $60,000 of depreciation, sold early on a work relocation by a high earner — the total federal bill is $104,150 on a $550,000 gain, 18.9% of it. A separate rule, the §121(b)(5) non-qualified-use allocation, can reduce the exclusion further for rental periods after 2008; it is not modelled here and is flagged on the page.

What rate is long-term capital gain on a home taxed at?+

0%, 15% or 20%, decided by your total taxable income rather than by the size of the gain alone. The gain stacks on top of your other taxable income, so it can straddle two bands. For tax year 2026 the 0% band runs to $49,450 of taxable income for a single filer and $98,900 on a joint return; the 15% band runs to $545,500 and $613,700 respectively, and 20% applies above that. A further 3.8% net investment income tax applies once modified adjusted gross income passes $200,000 single or $250,000 joint. Because the gain stacks, selling into a low-income year is a real and legal lever on the bill.

How do I reduce the capital gain on my home sale?+

Rebuild your basis before anything else — it is the largest and most commonly missed lever. Basis is what you paid, plus the settlement costs you paid at purchase, plus every capital improvement since: an addition, a roof, a remodelled kitchen, new windows, permanent landscaping. Routine repairs do not count. Selling expenses — commission, legal fees, transfer taxes, advertising — also come off the sale price before the gain is measured. Beyond that, meeting the full ownership and use tests before you sell, and timing the sale into a year with lower other income, both move the number. Investment property has a different route entirely: a §1031 like-kind exchange defers the gain rather than excluding it, and does not apply to a principal residence.

Do I have to report the home sale if the gain is excluded?+

If the closing agent issues you a Form 1099-S, yes — the sale goes on your return even when the entire gain is excludable, reported on Form 8949 and Schedule D. If no 1099-S is issued and the whole gain qualifies for exclusion, reporting is generally not required. Any depreciation recapture must be reported regardless, on Form 4797.

Want to try different numbers?

Back to the calculator ↑

Capital Gains Tax Calculator (US Home Sale) is built and maintained by the RealCostIQ editorial team. Cost ranges and rates are checked against published industry data and contractor quotes, and revised when the underlying figures move. Read our data methodology or more about who builds this. Every calculation runs in your browser — no account, and none of your inputs are stored.

Cost ranges and rates here are checked against contractor quotes and published industry data. If a number still looks off, email Support@RealCostIQ.com and we'll review and fix it.