Taxes · United States
Capital Gains Tax on a Home Sale
Work out how much of your gain is actually taxable, after your adjusted cost basis and the Section 121 exclusion.
The short answer
Your gain is the sale price, less selling costs, less your adjusted cost basis. Most sellers then owe nothing: Section 121 excludes up to $250,000 of gain, or $500,000 married filing jointly, if the home was your principal residence for two of the last five years. Your mortgage is irrelevant to this — gain is not net proceeds.
Your figures
- Amount realized
- —
- Adjusted cost basis
- —
- Capital gain
- —
- Section 121 exclusion
- —
- Depreciation recapture
- —
This is the gain that remains taxable — not the tax you owe. What is owed on it depends on your bracket and your state.
Share this scenario
Send these figures to your accountant — this is the one calculation on the site worth taking to a professional.
Your figures travel in the link itself — they are never sent to us or stored anywhere.
This is an estimate, and tax is not our field
This calculates a taxable gain, not tax owed. What is owed depends on your bracket, your state, the net investment income tax and the rest of your return. Inherited basis, a rental period, non-qualified use and a partial exclusion all change the answer in ways no calculator should pretend to settle. Take the number below to a tax professional. Nothing here is tax, financial or legal advice.
The detail
Gain is not the cash you received
The most expensive misunderstanding in a home sale is treating these as the same number. Your net proceeds is cash: what lands in your account once the costs are paid and the loan is cleared. Your gain is a measurement against what the home cost you, years ago.
They move independently. Pay a mortgage down to nothing and your proceeds rise while your gain does not move at all. Borrow against the home repeatedly and your proceeds collapse while your gain stays exactly where it was. Two neighbours can sell identical homes on the same day for the same price, receive wildly different checks, and owe identical tax.
This is why a calculator that labels its output "profit" is doing you harm rather than a favour. It knows your sale price and your costs. It does not know what you paid, what you improved, or what you depreciated — so whatever it is showing you, it is not a gain.
Three worked examples
What is actually taxable, in dollars
Three sales, run through the same arithmetic as the Tool above. A large gain and a taxable gain are not the same thing — the first row clears $490,000 and owes tax on nothing, while the third owes tax despite the smallest gain of the three.
| Scenario | Amount realized | Adjusted basis | Gain | Exclusion used | Taxable gain |
|---|---|---|---|---|---|
| Married couple, long tenureBought $300,000, sold $880,000, $40,000 improvements, filing jointly | $830,000 | $340,000 | $490,000 | $490,000 | $0 |
| Single filer, gain past the capBought $250,000, sold $700,000, $25,000 improvements, filing single | $658,000 | $275,000 | $383,000 | $250,000 | $133,000 |
| Let for a period, depreciation claimedBought $320,000, sold $650,000, $30,000 depreciation claimed | $611,000 | $310,000 | $301,000 | $271,000 | $30,000 |
The third row is the case most calculators get wrong: depreciation claimed during a letting period is unrecaptured Section 1250 gain, and Section 121 cannot exclude it no matter how large your remaining exclusion is. Taxable gain is the amount that gets taxed, not the tax — the rate depends on your bracket and your state. Your own figures belong in the calculator above; see how we calculate this.
Line by line
What decides how much is taxable
What is the capital gains exclusion on a home sale?
Section 121 of the tax code lets most people exclude up to $250,000 of gain on a principal residence, or up to $500,000 for a married couple filing jointly. The general test is ownership and use: you must have owned the home and lived in it as your principal residence for at least two of the five years before the sale. The two years do not have to be continuous, and the exclusion can generally be used once every two years.
How do you calculate the gain on a home sale?
Start with the amount realized — the sale price less every cost of selling. Then subtract your adjusted cost basis, which is what you paid plus capital improvements minus any depreciation you claimed. The difference is your gain. Note what is absent from that arithmetic: your mortgage. Debt has no effect whatsoever on gain, which is why a seller who has borrowed heavily can receive almost no cash and still face a substantial taxable gain.
What counts as a capital improvement?
An improvement adds value, prolongs the home’s life, or adapts it to a new use — a new roof, an addition, a finished basement, a replaced HVAC system, new windows. Repairs and maintenance do not count: repainting, fixing a leak, servicing a boiler. The distinction matters because improvements raise your basis and therefore lower your gain, sometimes by tens of thousands of dollars. Receipts are the only proof, and the single most valuable piece of record-keeping a homeowner can do is the one almost nobody does.
How does depreciation affect the gain?
If you ever claimed a home-office deduction or let the home out, you claimed depreciation — and depreciation does two things at once. It lowers your basis, which raises the gain, and it is itself never excludable under Section 121. That portion is unrecaptured Section 1250 gain, taxed at a rate of its own of up to 25%. Most home-sale calculators ignore depreciation completely and will tell you that you owe nothing when you do. The calculator above takes recapture off the top before applying the exclusion, which is the order the rules actually require.
What if you sell your home at a loss?
You get nothing for it. A loss on a personal residence is not deductible, does not offset other capital gains, and does not carry forward. This is the asymmetry that catches people who assume tax treatment cuts both ways: gains above the exclusion are taxable, losses are simply absorbed. The rules differ for a property held as an investment, which is one of several reasons the distinction between a residence and a rental is worth being precise about.
Do you have to report the sale if you owe nothing?
Sometimes. If you receive a Form 1099-S for the sale, report it, even when the exclusion covers the entire gain. Whether you receive one depends on the closing agent and on whether you certified that the sale qualifies for full exclusion. Reporting a sale you owe nothing on costs you nothing; failing to report one the IRS has a 1099-S for is how a letter arrives.
Also asked
Common questions about capital gains on a home
Do you pay capital gains tax if you buy another home?
Not as a rule, no. The old rollover provision — where you deferred gain by buying a more expensive home — was repealed in 1997 and replaced by the Section 121 exclusion. What you do with the money afterwards is now irrelevant to the tax. You could buy nothing, rent, or buy something twice the price, and the calculation is identical. The 1031 like-kind exchange, which does allow deferral, applies to investment property and not to the home you live in.
How long do you have to live in a home to avoid capital gains?
Two years out of the five preceding the sale, as your principal residence. They need not be consecutive — twenty-four months in total across that five-year window is the test. Partial exclusions are available when a sale is forced early by a change in place of employment, by health, or by certain unforeseen circumstances, and the partial amount is prorated by how much of the two years you completed.
What is the capital gains rate on a home sale?
For a home owned more than a year, the taxable portion is a long-term capital gain, taxed federally at 0%, 15% or 20% depending on your total taxable income. Recaptured depreciation is taxed separately at up to 25%. High earners may also owe the 3.8% net investment income tax, and your state may tax the gain as well. This calculator does not compute any of that on purpose — too much of it depends on the rest of your return.
Does a surviving spouse get the $500,000 exclusion?
Generally yes, if the home is sold within two years of the spouse’s death and the couple would have qualified for the full exclusion immediately before it. There is a second, often larger effect: the inherited portion of the home usually receives a stepped-up basis at the date of death, which can eliminate most of the gain by itself. This is exactly the territory where a professional earns their fee.
Keep going
Other numbers worth knowing
- Seller Net ProceedsWhat you keep at closing after commission, taxes, fees and payoff.Open →
- Buyer Cash to CloseWhat you actually wire on closing day, and how much of it is not a cost.Open →
- Extra Mortgage PaymentsWhat paying more each month does to your payoff date — and what waiting a year costs.Open →
- Mortgage RecastWhat a lump sum does to your monthly payment — and what it costs you.Open →
- RemodelAI: see a room redesignedImprovements raise your basis, and they are easier to decide on when you can see them. Upload a photo and see the room redesigned first.First render free →
- GlossaryEvery term on this page, defined — including the ones that get mistaken for each other.Open →
- How we calculateThe arithmetic behind this number, written out so you can check it.Open →