Skip to main content

Home Sale Capital Gains Calculator

The sale & what you paid

$
$
$
%
$

Your result will appear here

Fill in the fields on the left and this updates as you type.

Calculation transparency

Know what this estimate is based on

Jurisdiction
United States — state and local practice
Scope and limitations
Educational estimate only. U.S. real estate costs are local: property tax rates, transfer and recording taxes, title practice, who customarily pays which closing cost, and landlord-tenant rules all change by state and often by county or city. Agent commission is negotiable and, since the 2024 NAR settlement, buyer-agent compensation is negotiated separately rather than assumed. Only a lender's Loan Estimate, a title company's fee sheet or a signed contract binds a number.
Source links checked
Jul 30, 2026

Built and regression-tested by Smart Tools Lab. It has not been individually reviewed by a licensed financial, tax, or legal professional.

How to use

  1. 01

    Enter the sale price and what you originally paid.

  2. 02

    Enter every capital improvement you can document. Each dollar raises your basis and cuts the gain.

  3. 03

    Enter selling costs as a percentage — commission, transfer tax, title and attorney fees together.

  4. 04

    Set the exclusion: $250,000 filing single, $500,000 filing jointly. The field steps in $250,000 increments so it is one click.

  5. 05

    Read whether the exclusion covers you. If it does not, the waterfall below shows exactly where the taxable gain comes from.

Formula

The adjusted basis is what you paid, plus the closing costs when you bought, plus every capital improvement since. Selling costs are a percentage of the sale price, and the amount realized is the sale price minus them. The gain is the amount realized minus the adjusted basis, floored at zero — a loss on a personal residence is not deductible, so a negative result is reported as a loss with no tax rather than as a deduction. The section 121 exclusion shelters the lesser of the gain and the exclusion limit, and only the remainder is taxable. Federal capital gains tax, the net investment income tax and state tax all apply to that taxable remainder rather than to the whole gain, which is why the exclusion protects you from all three. Proceeds after tax are the amount realized less the total tax, before any mortgage is repaid.

Example

Selling for $620,000 a home bought for $180,000, with $4,000 of closing costs at purchase, $45,000 of documented improvements, 7% selling costs, and the $250,000 single-filer exclusion. Step 1 — Adjusted basis: $180,000 + $4,000 + $45,000 = $229,000. Step 2 — Selling costs: $620,000 x 7% = $43,400. Amount realized: $576,600. Step 3 — Total gain: $576,600 − $229,000 = $347,600. Step 4 — The exclusion covers $250,000, leaving $97,600 taxable. Step 5 — Tax: 15% federal ($14,640) + 3.8% NIIT ($3,709) + 5% state ($4,880) = $23,229. Proceeds after tax: $553,371. Two things are worth pulling out. First, the $45,000 of improvements saved about $10,700 of tax on their own — the receipts were worth roughly a quarter of what the work cost. Second, filing jointly would raise the exclusion to $500,000 and eliminate the tax entirely. Between a single and a joint filer with identical facts, this sale is a $23,229 difference.

Definitions

Section 121 exclusion
The rule sheltering up to $250,000 of home-sale gain for single filers and $500,000 for joint filers.
Adjusted basis
Purchase price plus buying closing costs plus capital improvements. What the gain is measured against.
Amount realized
Sale price minus selling costs. The top of the gain calculation.
Capital improvement
Work that adds value or prolongs life. Raises basis; unlike a repair, which does not.
Two-of-five rule
The ownership and residence test: two of the five years before the sale, not necessarily continuous.
Partial exclusion
A prorated exclusion available when a qualifying change in work, health or circumstances forces an early sale.
Long-term capital gain
Gain on an asset held over a year, taxed federally at 0%, 15% or 20%.
Net investment income tax
A 3.8% surtax on investment income above $200,000 single or $250,000 joint.
Form 1099-S
The information return reporting a real estate sale to the IRS. Report the sale if you receive one, even with no tax due.
Non-qualified use
Periods the home was not your main residence, which can reduce the exclusion proportionally.
Selling costs
Commission, transfer taxes, title and attorney fees. They reduce the amount realized and therefore the gain.
Stepped-up basis
The reset to market value at death, which eliminates the gain for heirs entirely.

Good to know

The exclusion that makes most home sales tax-free

Section 121 lets a single filer exclude $250,000 of gain on a primary residence and a married couple filing jointly exclude $500,000. It is the reason the large majority of US home sales produce no federal tax at all, and it is available repeatedly — once every two years, for as many houses as you own over a lifetime. The test has two parts and both are measured over the five years before the sale: you must have owned the home for at least two of them, and lived in it as your main home for at least two of them. The two-year periods do not have to be continuous and they do not have to be the same two years. Here a $347,600 gain less the $250,000 exclusion leaves $97,600 taxable — a large sale, and still a tax bill of $23,229 rather than one computed on the whole gain.

Basis is where the money is, and receipts are the proof

The gain is the amount realized less the adjusted basis, so every dollar added to basis is a dollar of gain removed. Basis starts at the purchase price and adds the closing costs you paid when buying — title, recording, survey, legal, transfer tax — and every capital improvement since. A new roof, an HVAC system, a kitchen renovation, an addition, new windows, a fence, landscaping that is permanent rather than maintenance: all of it counts, and $45,000 of improvements here removes $45,000 of gain. Repairs and maintenance do not count, and neither does anything you were reimbursed for. The practical difficulty is documentary rather than legal — this arithmetic runs over decades, and the receipts have to survive it. A folder, physical or scanned, kept from the day you buy is worth your capital gains rate on every dollar in it.

Partial exclusions for a sale you did not plan

Failing the two-year test does not automatically forfeit the exclusion. If the sale is driven by a change in place of employment, a health condition, or an unforeseeable circumstance the regulations recognise, a partial exclusion applies in proportion to the time you did qualify. Eighteen months of a required twenty-four gives 75% of the limit — $187,500 for a single filer. The safe harbours are specific: an employment move of at least fifty miles further from the home than the old job was, a physician-recommended move for the diagnosis or care of a disease, and a listed set of unforeseeable events including death, divorce, multiple births from a single pregnancy, and job loss qualifying for unemployment. Outside the safe harbours the facts and circumstances still count, but they need to be documented at the time rather than reconstructed afterwards.

The three taxes stacked on the taxable part

The $97,600 that survives the exclusion is not taxed at one rate. Federal long-term capital gains runs at 0%, 15% or 20% depending on total taxable income, and the 0% bracket is wider than people expect — a married couple with modest other income can genuinely pay nothing on a substantial gain. Above the threshold sits the 3.8% net investment income tax, which applies to the lesser of net investment income and the amount by which modified adjusted gross income exceeds $200,000 single or $250,000 joint. Then state tax: most states tax capital gains as ordinary income with no preferential rate, a handful have no income tax at all, and a few offer partial exclusions. Here 15% federal, 3.8% NIIT and 5% state come to 23.8% on the taxable gain. The state layer is the one most sellers forget to budget for.

What the exclusion does not cover

Three gaps catch sellers. Depreciation taken after May 1997 — from a home office, or from a period when the property was rented — is never excluded, and comes back as unrecaptured section 1250 gain at up to 25%. Periods of non-qualified use since 2009, meaning time the property was not your main home, are allocated out of the exclusion proportionally, which particularly affects a rental converted to a residence rather than the other way round. And a loss on a personal residence is not deductible at all, which is why the gain here floors at zero rather than going negative. The exclusion is also not indexed for inflation: $250,000 and $500,000 have been the limits since 1997, and in high-appreciation markets that means a growing share of ordinary long-term homeowners now exceed them.

Frequently asked questions

Do I owe tax when I sell my house?

Usually not. The section 121 exclusion shelters up to $250,000 of gain for a single filer and $500,000 for a couple filing jointly, and most US home sales fall inside it. You owe tax only on the gain above that.

What do I have to do to qualify?

Own the home and live in it as your main residence for at least two of the five years before the sale, and not have used the exclusion on another sale in the previous two years. The two years of residence do not have to be continuous.

Is the gain the same as my profit?

No, and this is where people go wrong. The gain is the sale price minus selling costs minus your adjusted basis — what you paid, plus closing costs when you bought, plus every capital improvement since. It is not the difference between the two prices, and it is not the cash you walk away with after the mortgage.

What counts as a capital improvement?

Work that adds value, prolongs life or adapts the home to new uses: an addition, a new roof, a kitchen remodel, central air, a fence, landscaping. Not repairs — repainting, fixing a leak, replacing a broken pane. The distinction is worth real money, and it is why the receipts matter for decades.

Can I deduct a loss on my home?

No. A loss on a personal residence is not deductible, which is why this calculator floors the gain at zero. That asymmetry is deliberate in the tax code: gains above the exclusion are taxed, losses are simply yours.

Do the limits ever change?

They have not since 1997, and they are not indexed to inflation. A $250,000 exclusion in 1997 dollars would be well over $500,000 today, which is why sales that would once have been comfortably covered increasingly are not — particularly for long-tenured owners in appreciated markets.

What if I only lived there part of the five years?

You may qualify for a partial exclusion if the sale was due to a change in workplace, a health condition, or certain unforeseeable events. The reduced exclusion is prorated by the months you did qualify, which frequently still covers the whole gain.

What about a home I rented out for a while?

Different rules bite. Depreciation taken after May 1997 is recaptured regardless of the exclusion, and periods of non-qualified use can reduce the exclusion proportionally. If the property was ever a rental, treat this page as a starting point and get advice.

Does the mortgage affect the tax?

Not at all. The gain is measured against your basis, not against what you owe. Paying off a $300,000 mortgage does not reduce the gain by a dollar — it just means less cash reaches your account.

What is the net investment income tax?

A 3.8% surtax on investment income above $200,000 of modified adjusted gross income for single filers or $250,000 joint. It applies only to the taxable portion of the gain, so the exclusion protects you from it too.

Do I have to report the sale?

If the entire gain is excluded and you did not receive a Form 1099-S, generally no. If you did receive one, report it even when no tax is due — an unreported 1099-S generates a letter from the IRS that is easier to prevent than to answer.

How do I reduce the tax if I am over the limit?

Find more basis. Every documented improvement over the whole ownership period counts, and most sellers underestimate this badly — a new roof, two bathrooms, the HVAC, the deck and the driveway together frequently run six figures. Selling costs also reduce the gain, so negotiate the commission before, not after.