Calcist

Style

Buttons

Spacing

How much to show

Decimal places

Text size

Capital gains tax on home sale calculator

Work out the gain on selling your home, how much the $250,000 or $500,000 home sale exclusion covers, and an estimate of the federal tax on the rest.

Private: calculated on your device. Nothing you type is sent anywhere.

Estimates for planning, not financial, tax or legal advice. Figures use US rules unless the page says otherwise.

Next: Selling stocks or a rental you never lived in? Use the capital gains tax calculator. Buying the next home? Start with the mortgage calculator.

How the gain is calculated

Amount realized = sale price − selling costs
Adjusted basis = purchase price + buying costs + improvements − depreciation
Gain = amount realized − adjusted basis

Selling costs include the real estate agent's commission, advertising, legal fees, and loan charges you paid that would normally be the buyer's. Buying costs you can add to basis include abstract and title search fees, legal fees, recording and survey fees, transfer taxes and owner's title insurance (but not points or other loan costs). Improvements are work that adds value, extends the home's life or adapts it to new uses, such as a new roof or an addition. Keep the receipts: every dollar of basis is a dollar of gain you don't pay tax on.

The home sale exclusion (Section 121)

You can exclude up to $250,000 of gain, or $500,000 on a joint return, if:

  • Ownership test: you owned the home for at least 24 months in the 5 years before the sale, and
  • Use test: you lived in it as your main home for at least 24 months in those 5 years. The months don't have to be in a row.
  • You didn't exclude the gain on another home in the 2 years before this sale.

For the $500,000 joint exclusion, either spouse can meet the ownership test, but both must meet the use test. If you fall short because of a move for a new job at least 50 miles farther away, health, or an unforeseeable event, you may get a partial exclusion: the shortest of the months you owned it, lived in it, or since your last excluded sale, divided by 24, times $250,000 (or $500,000). Depreciation you took after May 6, 1997 for renting the home or a home office can't be excluded; it's taxed at up to 25%.

How the tax is estimated

The taxable gain on a home you owned more than a year is a long-term gain, taxed at 0%, 15% or 20% depending on your total taxable income. The calculator stacks the gain on top of your other taxable income using the 2026 thresholds, then adds the 3.8% net investment income tax (NIIT) where your income is over $200,000 (single or head of household), $250,000 (joint) or $125,000 (married filing separately). The excluded part of the gain isn't subject to NIIT.

Worked example

A married couple sells for $1,200,000 and pays $60,000 of selling costs. They bought for $400,000, paid $10,000 of closing costs and spent $100,000 on improvements. Basis = $510,000; amount realized = $1,140,000; gain = $630,000. They meet both tests, so $500,000 is excluded and $130,000 is taxable. With $150,000 of other taxable income, all of it falls in the 15% band: $19,500. Their income of about $280,000 is $30,000 over the NIIT threshold, adding $1,140, for $20,640 in all.

Limitations

  • An estimate, not a tax return. It doesn't include state tax, the nonqualified-use rules for time the home was rented before you lived in it, or special rules for military and other service members.
  • NIIT is based on modified AGI, which is usually higher than taxable income, so the NIIT shown may be low.
  • You can't deduct a loss on the sale of your main home.
  • For a rental or investment property that was never your home, or stocks, use the capital gains tax calculator.

Sources

How we checked this

Before every update, this calculator is run in a real browser with these known answers, and it must match all of them:

  • $209,000 gain, single, lived there 5 years: all excluded ✓
  • Married, $630,000 gain: $130,000 taxable, $20,640 tax with NIIT ✓
  • 12 months, job move: partial exclusion $125,000, $45,000 taxable ✓
  • 12 months, no qualifying reason: no exclusion, $18,082.50 tax ✓
  • $30,000 of rental depreciation can't be excluded: $24,166 total tax ✓
  • Edge case: selling below basis is a −$40,000.00 loss (not deductible) ✓

Last checked October 26, 2026. Spotted something wrong? The math is done in your browser with the formula shown on this page, so you can check any result by hand.

Add this calculator to your website (free)

Paste this code into any web page. The calculator works on your page, resizes itself, has no ads and no tracking, and nothing your visitors type is sent anywhere. More about embedding.

Questions people ask

How much capital gains tax will I pay on the sale of my house?

Often none. If you owned and lived in it for 2 of the last 5 years, up to $250,000 of gain ($500,000 for married couples filing jointly) is tax-free. Gain above that is usually taxed at 15%, or 0% or 20% depending on your income.

How do I avoid capital gains tax on a home sale legally?

Meet the 2-out-of-5-year ownership and use tests to use the $250,000/$500,000 exclusion, add every improvement and eligible closing cost to your basis, subtract selling costs, and check whether a job move, health reason or unforeseeable event gives you a partial exclusion if you sell early.

What is the 2 out of 5 year rule?

To exclude the gain you must have owned the home and lived in it as your main home for at least 24 months each during the 5 years before the sale. The months don't need to be continuous.

Do I have to report the sale of my home?

If you receive a Form 1099-S, or if any of the gain is taxable, you report the sale on Form 8949 and Schedule D, even if the gain is fully excluded.

Is capital gains tax on real estate different from stocks?

The same 0%, 15% and 20% long-term rates apply, but your main home can use the Section 121 exclusion and depreciation from renting it is taxed at up to 25%.

Related calculators