What you'll really owe when you sell your home
"Do I pay capital gains tax when I sell my house?" is one of the most-searched and most-misunderstood questions in personal finance, and the honest answer is: usually not much, sometimes nothing, occasionally a lot — and which one depends on a chain of rules that no single headline captures. The profit on your home is not simply the sale price minus what you paid. It is the sale price, minus selling costs, minus an adjusted basis that quietly grows every year you improve the property — and then that profit runs a gauntlet of exclusions, recapture, brackets, and surtaxes before any tax is actually due. This calculator walks the full chain so you get a number you can plan around, not a vague "it depends."
How to use the calculator
- Pick your filing status. It sets your exclusion cap, your bracket thresholds, and your NIIT threshold — all of which differ for single, married, and head-of-household filers.
- Enter the sale price and your selling costs. Agent commission, title fees, and transfer taxes all reduce your amount realised, so include them — they directly lower the gain.
- Build your basis. Enter your purchase price (or the stepped-up value if you inherited it), buying closing costs, every capital improvement you can document, and any depreciation you claimed for a home office or rental period.
- Add your tax picture. Your other taxable income decides which capital-gains bracket the gain falls into, and your state rate adds estimated state tax.
- Set your Section 121 eligibility — full, partial, or not a main home — and, if relevant, your non-qualified use months. The result and the plain-English verdict update instantly.
Adjusted basis: the number that quietly saves you thousands
Your adjusted basis is the tax cost of your home, and it is almost always higher than the price you paid. It starts with the purchase price, adds the closing costs you paid when buying (title insurance, recording fees, transfer tax, survey), and then climbs with every capital improvement you make over the years. A new roof, a room addition, a kitchen remodel, central air, a new deck, replaced windows, a finished basement — each adds to basis and therefore shrinks your taxable gain dollar for dollar. The catch competitors gloss over: routine repairs and maintenance — repainting, fixing a leak, replacing a broken pane — do not add to basis. The line is whether the work adds value, prolongs the home's life, or adapts it to a new use. Because every $10,000 of documented improvement can save you $1,500 to $2,500 in tax, the receipts you kept for that renovation are worth real money at sale time. Depreciation works the other way: any depreciation you deducted for a home office or while renting reduces your basis, which is why it resurfaces as taxable gain later.
The Section 121 exclusion — up to $250,000 or $500,000 tax-free
The reason most home sellers owe little or nothing is the Section 121 home-sale exclusion. If the property was your principal residence for at least two of the five years before you sell, you can exclude up to $250,000 of gain as a single filer, or up to $500,000 as a married couple filing jointly. This is not a one-time benefit — you can claim it again on a future home, generally as long as it has been at least two years since your last exclusion. For a couple who bought a home for $300,000, improved it, and sold for $700,000, the entire $400,000-ish gain can vanish from their taxable income. The exclusion is also why the order of operations matters: the calculator removes the exclusion from the qualifying portion of the gain before applying any brackets, so you see the genuinely taxable slice rather than tax on the whole profit.
The 2-of-5 test — and the partial exclusion most people miss
The full exclusion hinges on two separate tests over the five years before sale: an ownership test (you owned the home for at least 24 months) and a use test (you lived in it as your main home for at least 24 months). The months do not have to be consecutive, and for a married couple filing jointly, only one spouse needs to meet the ownership test while both must meet the use test. Here is the part many sellers — and many calculators — get wrong: if you fall short of two years but you are selling because of a change in employment location, a health reason, or an unforeseen circumstance the IRS recognises, you can still claim a partial exclusion. The cap is prorated by the months you did qualify divided by 24. Sell after 12 qualifying months as a single filer and your cap is not zero — it is $125,000, which is often more than enough to cover a short-hold gain. The calculator's Partial mode applies this proration so you do not leave the relief on the table.
Depreciation recapture — the tax that survives the exclusion
If you ever claimed depreciation on the home — running a home office, or renting it out for a stretch — that benefit is borrowed, not given. At sale, the depreciation you took (after May 1997) becomes unrecaptured Section 1250 gain, and it is taxed at a federal rate of up to 25% regardless of your Section 121 exclusion. The exclusion simply does not reach it. This is the single most common surprise for sellers who once rented their place: they assume the exclusion covers everything, then discover the depreciation comes back as a 25% line item. The calculator carves the depreciation portion out of the gain first, taxes it at the 25% ceiling, and only then applies the exclusion to what remains — exactly the order the tax rules require.
Non-qualified use — the rule almost every free tool ignores
This is where most online calculators quietly fall short, and where this one is built to be more correct. Under Section 121(b)(5), if you used the home for something other than your principal residence after 2008 — say you bought it as a rental or vacation place for a few years and only later moved in — the gain tied to that "non-qualified use" period cannot be excluded, even if you later pass the 2-of-5 test. The taxable share is calculated as the period of non-qualified use divided by the total period you owned the home, applied to the gain. Importantly, time you rented the place after it stopped being your main home, within the five-year look-back, is generally not counted against you. The interaction is fiddly, which is exactly why it gets skipped — but for anyone who converted a rental into a residence, it can mean a five- or six-figure difference. Enter your total months of ownership and your non-qualified months and the calculator prorates the exclusion the way the statute requires.
How the taxable gain is actually taxed: 0%, 15%, 20% — and 3.8% NIIT
Whatever gain remains after the exclusion is a long-term capital gain (a home is virtually always held over a year), taxed at 0%, 15%, or 20% depending on your total taxable income. The crucial mechanic is stacking: your capital gain sits on top of your ordinary income when deciding the rate. A retiree with modest income may pay 0% on part of the gain; a high earner pays 20% on the top slice; many sellers straddle two bands. The calculator stacks the taxable gain above your other income (and above the depreciation portion) and applies the right rate to each band, rather than guessing a single flat rate. On top of that, the Net Investment Income Tax adds 3.8% once your modified adjusted gross income passes $200,000 (single) or $250,000 (married filing jointly) — and a large home gain can push you over that line for one year even if you are normally below it. The tool applies the NIIT to the smaller of your net investment income or your income above the threshold, the way the law works.
State capital gains tax
Federal tax is only part of the picture. Most states tax capital gains as regular income, a few apply a special rate, and a handful — including Florida, Texas, Washington (for most sales), Nevada, and others with no broad income tax — take nothing. Because state rules vary so widely, the calculator lets you enter your own effective state rate and adds estimated state tax on the taxable portion of the gain. If your state offers its own version of a home-sale exclusion or a lower rate for long-term gains, factor that into the rate you enter. Even a 5% state rate on a $200,000 taxable gain is $10,000 — large enough that it belongs in the plan, not as an afterthought.
A full worked example
Suppose a married couple sells for $1,300,000 with $78,000 in selling costs, having bought for $400,000 with $8,000 in closing costs and $92,000 of improvements, with $200,000 of other income and a 5% state rate, fully qualifying for the exclusion. Amount realised is $1,222,000; adjusted basis is $500,000; total gain is $722,000. The $500,000 joint exclusion removes most of it, leaving $222,000 taxable. Stacked above $200,000 of income, that gain falls in the 15% band → $33,300 federal capital-gains tax. The NIIT applies to the income above $250,000 — here $172,000 of it — at 3.8%, adding $6,536. State tax at 5% on $222,000 is $11,100. Total: about $50,936, an effective rate of roughly 7% on the gain — a world away from the "20% of $722,000" a back-of-envelope guess would produce. That gap, in both directions, is the whole point of running the real numbers.
Ways to legally lower the tax
- Find every improvement. Comb through old records for capital improvements you forgot — additions, systems, landscaping that adds value. Each documented dollar raises basis and cuts the gain.
- Mind the two-year clock. If you are close to 24 months of use, waiting until you cross it can flip a partial exclusion into a full one and erase a large bill. The verdict flags when you are near the line.
- Time the sale to a lower-income year. Because the rate is stacked on your income, selling in a year when your ordinary income dips can move part of the gain into the 0% or 15% band.
- Use both spouses' exclusions. Marriage doubles the cap to $500,000 if both meet the use test — a reason some sellers wait until both qualify.
- Keep depreciation honest. You owe recapture on depreciation "allowed or allowable," so claiming it properly while renting (and tracking it) avoids a nasty surprise and lets you plan for the 25% line.
- Confirm your state's relief. Some states mirror the federal exclusion; entering a lower effective rate reflects that.
Common mistakes this prevents
Where this fits in your money decisions
Knowing your after-tax proceeds changes real choices: whether to sell now or hold, whether to pay down a mortgage with the windfall or invest it, whether to time a move around a low-income year, and how much you truly net to buy your next place. Pair this with a mortgage payoff vs invest calculator to decide what to do with the proceeds, a HELOC payoff calculator if you are clearing a line of credit at closing, and a mortgage recast calculator if you are rolling equity into a new loan. The clearer your tax number, the better every downstream decision gets.
Frequently asked questions
Do I pay capital gains tax when I sell my house?
Only on profit above your exclusion. If it was your main home for two of the last five years, the Section 121 exclusion shields up to $250,000 of gain (single) or $500,000 (married filing jointly). Most ordinary sellers owe nothing.
How is the gain calculated?
Sale price − selling costs − adjusted basis. Adjusted basis = purchase price + buying closing costs + capital improvements − depreciation claimed.
What if I lived there less than two years?
You may still get a partial exclusion if you sold for a job move, health reason, or recognised unforeseen circumstance. The cap is prorated by qualifying months ÷ 24 — use Partial mode.
Does depreciation get taxed even with the exclusion?
Yes. Depreciation claimed after May 1997 is unrecaptured Section 1250 gain, taxed at up to 25% federal. The exclusion never covers it.
What is non-qualified use?
Post-2008 periods you used the home as something other than your main residence (e.g. a rental before moving in). The matching share of gain can't be excluded; the tool prorates by non-qualified ÷ total months owned.
What are the long-term capital gains rates?
0%, 15%, or 20%, set by your total taxable income and filing status. The gain stacks on top of your other income, so different slices can be taxed at different rates.
What is the 3.8% NIIT?
An extra 3.8% on investment income, including taxable home gain, once your modified AGI tops $200,000 (single) or $250,000 (married filing jointly). It applies to the lesser of net investment income or income above the threshold.
Do I owe state tax too?
Usually — most states tax capital gains as income; a few have no income tax. Enter your effective state rate and the tool estimates state tax on the taxable gain.
How do improvements lower my tax?
Capital improvements add to basis and cut the gain dollar for dollar. Routine repairs don't count. Keep receipts — each documented dollar can save 15–25% in tax.
What if I inherited the home?
You typically get a stepped-up basis equal to the fair market value at the prior owner's death, which often erases most gain. Switch the toggle to Inherited and enter that value.
Is a loss on my home deductible?
No — a loss on a personal residence isn't deductible. The tool flags a loss and shows zero tax but the loss can't offset other gains.
Can I avoid tax by buying another house?
Not for your main home — the old rollover rule is gone, replaced by the Section 121 exclusion. The 1031 exchange that defers gain is only for investment property.
Is this a substitute for a tax advisor?
No — it's an educational estimate of the main federal rules plus a flat state rate. Confirm with a professional before filing.
Is it free and private?
Yes — free, no sign-up, and it runs entirely in your browser. Nothing you enter is uploaded or stored.