Skip to content
CalculatorZilo Logo
  • Home
  • CalculatorsExpand
    • Browse all calculators
    • Education
    • Real Estate
    • Chemistry
  • Finance
  • Math
  • Health & Fitness
  • Science
  • About
  • Contact
CalculatorZilo Logo
Home / Home Sale Cost Basis Calculator
Tax Calculators

Home Sale Cost Basis Calculator

Published onOctober 1, 2025 Updated onOctober 25, 2026 7:34 am
Home Sale Cost Basis Calculator

Build your adjusted cost basis line by line, apply the Section 121 exclusion for your filing status, and see the taxable gain left over, or run it in reverse to find the highest sale price that stays within a target taxable gain.

What you paid for the home itself, before closing costs. For an inherited home, enter the stepped-up fair market value at the date of death instead.
Settlement costs from when you bought that count toward basis: title insurance, transfer taxes, recording fees and purchase legal fees. Mortgage points are interest, not basis, so leave them out.
Improvements that add value, prolong the home’s life or adapt it to a new use: additions, a new roof, a kitchen remodel, new systems. Repairs and maintenance do not count. Leave blank and it counts as 0.
Insurance or casualty payouts you received for damage to the home. Money already paid back to you reduces your basis, so it is subtracted here. Leave blank and it counts as 0.
Total depreciation you claimed, or were allowed to claim, for a home office or rental period. It reduces your basis. Most pure primary residences enter 0. Note the limit explained below: the gain equal to this amount cannot be excluded.
The price the home sold for, or the price you are testing. In reverse mode this field is not used in the math and is not required.
What the sale itself cost you: agent commissions, seller-paid closing costs, transfer taxes at sale, staging and advertising. These reduce your net proceeds rather than your basis. Leave blank and it counts as 0.
Sets the Section 121 exclusion ceiling: $250,000 single, $500,000 married filing jointly, and $250,000 for a spouse filing separately on their own interest in the home.
These are the IRS ownership test, use test and once-every-two-years rule for the Section 121 exclusion. Unchecking a box only triggers the warning below: the calculator still applies the full exclusion, so read the result as a best case and confirm your position with a tax professional.
Ownership test: you owned the home for at least two years in the five years before the sale.
Use test: you lived in it as your main home for at least two years in that same five-year window.
Frequency rule: you did not claim the exclusion on another home in the prior two years.
The most taxable gain you are willing to show. Zero gives the highest fully tax-free price. The reverse price is your adjusted basis plus your exclusion plus this target plus your selling expenses.

Reverse mode uses your basis figures above, your filing status, your selling expenses and your target taxable gain. It does not use the sale price field.

Adjusted cost basis
Net sale proceeds
Capital gain
Exclusion used
Taxable gain
Illustrative tax at a flat 15% only
Gain covered by the exclusion
Your adjusted basis
Exclusion available
Selling expenses assumed
Target taxable gain
Heads up: with a box unchecked, the $250K/$500K exclusion may not apply to this sale. The math above assumes it does, so treat the taxable gain as a best case and confirm with a tax professional.
Depreciation note: the gain equal to depreciation claimed after May 6, 1997 cannot be excluded, so your real taxable gain can be higher than this headline by up to the depreciation amount. Confirm with a tax professional.

Selling a home is not taxed on the sale price. It is taxed on the gain, and the gain is your net sale proceeds minus your adjusted cost basis: what you paid, plus purchase closing costs and real improvements, minus insurance payouts and depreciation. This calculator builds that basis line by line, applies the Section 121 primary-residence exclusion for your filing status, and shows the taxable gain that is left, or runs in reverse to find the highest sale price that keeps your taxable gain at a target you set.

If you only need the quick exclusion check, the same tool does that too: enter the sale price, the purchase price, improvements, selling costs and filing status, leave the extra basis lines at zero, and the sale analysis mode walks the same chain. The full build is there when your sale needs it, and the quick check costs nothing extra.

Quick Answer

On the pre-filled example, a home bought for $350,000 with $8,000 of purchase closing costs and $45,000 of improvements has an adjusted basis of $403,000. Sold for $525,000 with $31,500 of selling expenses, the gain is $90,500, and a married couple filing jointly excludes all of it under the $500,000 Section 121 exclusion, so the taxable gain is $0. The reverse mode prices the ceiling: the same home could sell for up to $934,500 before the first taxable dollar appears.

The quick exclusion check gives the same kind of answer from fewer inputs. Bought for $320,000, added $45,000 of improvements, sold for $650,000 with $39,000 in selling costs: the adjusted basis is $365,000, the amount realized is $611,000, and the gain is $246,000. A single filer's $250,000 exclusion covers it entirely, so the taxable gain is $0. A married couple with a $400,000 gain would likewise owe nothing under the $500,000 exclusion.

Key takeaways: the exclusion applies to gain, not price. A $650,000 sale with a $246,000 gain fits under the $250,000 single exclusion. Your basis is a build-up, not a single number: purchase price, plus purchase closing costs, plus capital improvements, minus insurance reimbursements and depreciation claimed. Selling expenses do not raise your basis. They reduce your net proceeds, which is a different step of the same subtraction and the spot where most do-it-yourself estimates go wrong. The exclusion checklist warns, it does not gate. With any box unchecked the tool still applies the full $250,000 or $500,000 exclusion, so treat that result as a best case.

On this page
  • Quick Answer
  • How to use this calculator
  • The cost basis formula, step by step
  • Worked example A: the quick exclusion check
  • Worked example B: the full basis build
  • What raises your basis, and what does not
  • What this calculator does not model
  • What competing calculators miss
  • Frequently asked questions
  • Add This Calculator to Your Website
  • References

How to use this calculator

Enter what you paid and what the purchase cost you, add improvements, insurance payouts and any depreciation, then enter the sale price, the selling expenses and your filing status, and click Calculate. Sale analysis mode returns the adjusted cost basis, net sale proceeds, capital gain, how much of your exclusion the gain uses, and the taxable gain left over, with a status label: Capital Loss, Tax-Free Sale, Low Taxable Gain (up to $50,000) or High Taxable Gain (above $50,000). The illustrative tax line beside it is a flat 15% illustration only, carried over from the simpler exclusion tool. It is not your tax bill: actual long-term rates are 0%, 15%, or 20%, high earners may owe the extra 3.8% net investment income tax, and most states tax the gain separately.

Tick the three exclusion boxes honestly. They encode the IRS ownership test, use test and once-every-two-years rule. If any box is unchecked, a warning appears and the exclusion is still applied in full, so the taxable gain is a best case rather than a promise.

Reverse mode starts from the tax outcome instead of the price. Keep your basis figures in place, set the taxable gain you can accept (0 means fully tax-free), and the tool returns the highest sale price that stays within it, using your selling-expense figure as the assumed cost of that sale. One improvement over the earlier basis tool: reverse mode no longer validates the sale price field at all, since the reverse math never uses it. Leave it as it is, or ignore it, when you run the reverse mode. Optional fields can stay blank. Closing costs, improvements, insurance, depreciation and selling expenses all count as 0 when left empty. Only the purchase price and, in sale analysis mode, the sale price are required, and both must be positive.

If you are still on the buying side of a transaction, the closing cost percentage calculator shows how purchase closing costs usually scale with the price, which helps you sanity-check the figure you enter here.

The cost basis formula, step by step

Four additions and subtractions, in a fixed order, produce the taxable gain. The IRS sets out the same build-up in its home-sale guidance: as IRS Topic No. 701 puts it, you may exclude up to $250,000 of gain, or $500,000 on a joint return, and the gain itself is measured against your basis.

Adjusted basis = Purchase price + Closing costs at purchase + Capital improvements - Insurance reimbursements - Depreciation claimed. Net proceeds = Sale price - Selling expenses. Capital gain = Net proceeds - Adjusted basis. Taxable gain = Capital gain - Exclusion, never below zero.

The exclusion ceiling comes from Section 121 of the Internal Revenue Code and depends on how you file. Single filers use $250,000. Married filing jointly uses $500,000, where at least one spouse must meet the ownership test, both must meet the use test, and neither may have used the exclusion in the prior two years. Married filing separately uses $250,000 per spouse, on the gain attributable to that spouse's own interest in the home, under Treasury Regulation 1.121-2. Those ceilings have not moved since 1997 and are not indexed for inflation, which is why long-held homes in expensive markets now produce taxable gains that would have been unthinkable when the amounts were set.

The two tests that unlock the exclusion sit behind the checklist. The ownership test: you owned the home for at least two years (24 months) in the five years before the sale. The use test: you lived in it as your main home for at least two years in that same window. The frequency test: you did not claim the exclusion on another home in the prior two years. For the $500,000 married exclusion, at least one spouse must meet the ownership test, both must meet the use test, and neither may have used the exclusion in the prior two years. The two years do not have to be consecutive or the most recent two: live there 14 months, move away a year, return for 10 months, and you still qualify if the sale falls inside the five-year window. IRS Publication 523 is the definitive worksheet, and the statute itself is 26 U.S.C. 121.

Worked example A: the quick exclusion check

This is the simpler exclusion tool's own example, run through the merged tool with the extra basis lines at zero. Every figure below reproduces exactly in the calculator above.

Step 1: Purchase price $320,000, the starting basis. Step 2: Add improvements +$45,000 for the remodel. Basis is now $365,000. Step 3: Amount realized: $650,000 sale minus $39,000 selling costs = $611,000. Step 4: Gain: $611,000 minus $365,000 basis = $246,000 of gain. Step 5: Exclusion: the $250,000 single exclusion covers the gain, so taxable gain is $0 and the gain covered is 100%.

When the gain beats the cap, only the excess is taxed. The table below carries the simpler tool's scenarios, with the 15% column kept strictly as an illustration.

Single, worked example: gain $246,000, exclusion $250,000, taxable $0, illustrative tax at 15% $0. Married, $400,000 gain: gain $400,000, exclusion $500,000, taxable $0, illustrative tax at 15% $0. Single, $320,000 gain: gain $320,000, exclusion $250,000, taxable $70,000, illustrative tax at 15% $10,500. Married, $620,000 gain: gain $620,000, exclusion $500,000, taxable $120,000, illustrative tax at 15% $18,000.

If your gain exceeds the cap, the old rollover trick will not save you: deferring gain by buying a pricier home was repealed in 1997 and replaced by this exclusion, and what you do with the proceeds is now irrelevant. If you fall short of the 24 months for a job move, a health reason, or an unforeseen event such as divorce or a natural disaster, you may still claim a reduced exclusion: multiply the full cap by your qualifying months divided by 24. Twelve qualifying months as a single filer gives $125,000 (12/24 of $250,000). This calculator applies the full exclusion only and does not prorate a partial one, so for a partial exclusion, run the gain here and apply the prorated cap by hand. If you are selling to buy again, the house loan affordability calculator sizes the next purchase, and the mortgage payment calculator prices the mortgage on whatever you buy next.

Worked example B: the full basis build

The pre-filled run is a married couple filing jointly who bought for $350,000, paid $8,000 in purchase closing costs, and later spent $45,000 on a kitchen remodel, with no insurance payouts and no depreciation. Step 1: Purchase price $350,000 + closing costs $8,000 + improvements $45,000 = adjusted basis $403,000. Step 2: Sale price $525,000 - selling expenses $31,500 = net proceeds $493,500. Step 3: Net proceeds - adjusted basis = capital gain $90,500. Step 4: Gain - $500,000 joint exclusion (only $90,500 of it needed) = taxable gain $0, Tax-Free Sale.

The basis build-up is where the money hides. Skipping the $45,000 remodel alone would have overstated the gain by $45,000. Three more runs of the same tool, each verified against the code: worked example filed single instead (same numbers): gain $90,500, taxable $0, Tax-Free Sale, with $90,500 of the $250,000 exclusion used. Bought $200,000 + $5,000 closing + $20,000 improvements, sold $900,000 less $54,000 expenses, single: gain $621,000, taxable $371,000, High Taxable Gain. Bought $500,000, sold $400,000 less $10,000 expenses, married filing jointly: gain -$110,000, taxable $0, Capital Loss.

Run the reverse mode on the worked example with a target of $0 and you get $403,000 + $500,000 + $31,500 = $934,500: the couple could accept an offer up to that price before a dollar of taxable gain appears. File the same home as a single seller with a $25,000 target instead and the ceiling drops to $709,500, because the exclusion halves while the basis stays the same. If you are weighing a sale against refinancing to tap equity instead, the home refinance rates calculator models that alternative's cost.

What raises your basis, and what does not

Improvements raise your basis; repairs do not. The IRS line is whether the work adds value, prolongs the home's useful life, or adapts it to a new use, and the distinction is worth real money because every documented improvement dollar subtracts a dollar from your gain.

What raises basis (capital improvement): room addition, deck, garage, pool; new roof, siding, or windows; new HVAC, electrical, or plumbing system; kitchen or bathroom remodel; solar panels, insulation upgrades. What does not raise basis (repair or maintenance): repainting rooms; fixing a leaky faucet; patching drywall; replacing cabinet hardware; lawn care and landscaping upkeep.

Purchase closing costs split the same way: title insurance, transfer taxes, recording fees and purchase legal fees count toward basis, while mortgage points are interest and do not, a split IRS Publication 551, Basis of Assets, works through in detail. Going the other direction, your basis falls when you receive insurance payouts for damage, claim depreciation, or receive energy or easement payments tied to the property. Keep receipts for every improvement for as long as you own the home plus the years you may need to support the return: in an audit, the improvement you cannot document is the improvement you do not have.

What this calculator does not model

The tool runs the standard Section 121 path cleanly, and four real-world wrinkles sit outside it. Knowing they exist is the difference between an estimate and a surprise.

Depreciation recapture. Depreciation you enter reduces your basis here, which matches the IRS rule. But the part of your gain equal to depreciation claimed after May 6, 1997 cannot be excluded at all: it is taxed as unrecaptured Section 1250 gain at up to 25%. This tool lets the exclusion cover it, so if you entered depreciation, your real taxable gain can be higher than the headline by up to the depreciation amount. The tool shows a depreciation note whenever you enter depreciation, so the limit is visible at the result, not buried here.

Partial exclusions. If you sold early because of a job relocation, a health move or an unforeseen circumstance, the IRS prorates the exclusion instead of removing it. The tool applies the full amount for your filing status alone, so an early seller who qualifies for a partial exclusion will see a taxable gain that is too high. Apply the prorated cap by hand as described above.

Nonqualified use. Periods after 2008 when the home was rented out or otherwise not used as your main home can carve a slice of the gain out of the exclusion even when you pass the 2-of-5 tests. Mixed-use histories need the Publication 523 worksheets, not a single-form calculator.

The tax itself, state tax and the NIIT. The output is a taxable gain, not a tax bill. Federal long-term rates run 0%, 15% or 20% depending on your income, high earners can owe the extra 3.8% net investment income tax, and most states tax the gain on top. The flat 15% line in the result is an illustration carried over from the simpler tool, not a rate the tool recommends. If the sale lands at a loss, note the asymmetry: a loss on a personal residence is never deductible, while the separate capital loss deduction calculator covers how losses on investment property are treated. None of this makes the headline number useless. It makes it a first pass: right for the large majority of straightforward main-home sales, and a starting figure to take to a tax professional when any of the four wrinkles applies to you. Still house-hunting for the next place after this sale? The buy a home calculator works the affordability side of that move.

What competing calculators miss

Most tools for this keyword answer half the question, and a few answer it wrong. CalculatorsHub's Home Sale Cost Basis Calculator stops at the adjusted basis and never computes the gain, the exclusion or the taxable remainder, which are the numbers a seller actually files on. Sage Calculator's Capital Gains Home Sale Calculator defines adjusted basis as purchase price plus improvements plus selling costs, folding selling costs into the basis itself. Selling costs reduce the amount you realize on the sale; they are not basis, and mixing the two steps distorts any case where the figures are later reused, for example in the reverse price math this page offers. FinExplained's Home Sale Capital Gains Calculator goes further than this page in one direction, estimating the actual federal tax with income stacking and the net investment income tax, but it has no reverse solver and a thinner basis build-up: no separate lines for insurance reimbursements or depreciation. Keeper Tax's Capital Gains Tax Calculator is a general asset tool. Homes are one case inside it, handled at a summary level, with no qualification checklist and no way to see how much of the exclusion a gain actually uses. TheTaxCalc's Home Sale Tax Calculator leads with a rate table and a tax estimate. Useful for a quick liability guess, but the basis is a single lump input, so a seller who under-documents improvements gets no prompt to itemize them. Ultimate Finance Calculator's Capital Gains on Home Sale Calculator does allow a custom exclusion override, a genuinely useful touch for partial exclusions, but it takes the cost basis as one pre-computed number and offers no reverse mode and no eligibility checks.

The gap this page fills: the full basis build-up with insurance and depreciation lines, the exclusion applied by filing status with a qualification checklist and an honest best-case warning, the amount of exclusion actually used, the gain covered as a percentage, a clearly labelled 15% illustration for readers who want a rough tax sense, and a reverse solver that turns a target taxable gain into a maximum sale price.

Frequently asked questions

Up to $250,000 of gain if you file single, or $500,000 married filing jointly, provided you owned and lived in the home at least 2 of the last 5 years and have not used the exclusion in the prior 2 years. Only the gain above the cap is taxed.

You need all three tests: you owned the home for at least two of the last five years, you lived in it as your main home for at least two of the last five years, and you have not used the exclusion on another home in the last two years. The two-year periods do not have to be continuous, and the ownership and use periods do not have to overlap. The checklist inside the calculator mirrors these tests, but it only warns you: the tool applies the full exclusion either way, so an unchecked box means the taxable gain shown is a best case.

Yes. Capital improvements add to your cost basis, which directly reduces the taxable gain. A $45,000 remodel on the worked example erased $45,000 of gain. Keep receipts; repairs and maintenance do not count.

A loss on a personal residence is not deductible, but it does mean zero capital gains tax. The calculator labels any gain of zero or less as Capital Loss and sets the taxable gain to $0. Losses on investment or rental property follow different rules and can offset other gains.

Only if you claimed depreciation, typically for a home office or a period when the home was a rental. Depreciation reduces your basis in this calculator, which matches the IRS rule, but the calculator does not carve the depreciation amount out of the exclusion: under IRS rules the part of your gain equal to depreciation claimed after May 6, 1997 cannot be excluded and is taxed as unrecaptured Section 1250 gain at up to 25%. If you entered depreciation, treat the taxable gain as understated by up to that amount and confirm with a tax professional.

When you inherit a home, your basis is generally reset to the fair market value on the date of death, wiping out the deceased owner's unrealized gain. Enter that stepped-up value as the purchase price, add only improvements made after the inheritance, and the gain math works the same from there.

Possibly, if you still meet the 2-of-5-year ownership and use tests. But gain allocated to rental periods after 2008 (nonqualified use) cannot be excluded, and depreciation you claimed must be recaptured as taxable gain.

Once every two years. If you excluded gain on another home sale within the 24 months before the current sale, you generally cannot claim the full exclusion again, though partial exclusions exist for job changes, health, and unforeseen events.

No, they enter the formula at different steps. Closing costs at purchase, such as title insurance, transfer taxes and recording fees, raise your basis. Selling expenses, such as agent commissions and seller-paid closing costs, reduce your net proceeds. Both shrink the taxable gain, which is why the calculator keeps them as separate inputs.

Long-term capital gains rates of 0%, 15%, or 20% based on your taxable income, since a home held over a year is a long-term asset. High earners may also owe the 3.8% Net Investment Income Tax on the excess. The calculator shows an illustrative figure at a flat 15% only; it is not your tax bill.

Switch to the reverse mode, keep your basis figures in place, and set the target taxable gain to 0. The tool returns your adjusted basis plus your exclusion plus your selling expenses, which is the highest sale price that keeps taxable gain at zero on those figures.

No. It stops at the taxable gain, because the tax on that gain depends on your other income: long-term capital gains are taxed at 0%, 15% or 20% federally, high earners may owe the additional 3.8% net investment income tax, and most states tax the gain separately. Two sellers with the same taxable gain can owe very different tax, so the taxable gain is the figure to take to your return or your tax professional.

Add This Calculator to Your Website

Embed this calculator on your own site. Choose a size to preview it, then copy the embed code. The preview only loads when you click a size button.

Copy this code and paste it where you want the calculator to appear:

Powered by Calculator Zilo

References

  1. Internal Revenue Service. Publication 523, Selling Your Home. Accessed October 25, 2026.
  2. Internal Revenue Service. Topic No. 701, Sale of Your Home. Accessed October 25, 2026.
  3. Internal Revenue Service. Topic No. 409, Capital Gains and Losses. Accessed October 25, 2026.
  4. Internal Revenue Service. Publication 551, Basis of Assets. Accessed October 25, 2026.
  5. Internal Revenue Service. Topic No. 559, Net Investment Income Tax. Accessed October 25, 2026.
  6. U.S. House of Representatives, Office of the Law Revision Counsel. 26 U.S.C. 121, Exclusion of Gain From Sale of Principal Residence. Accessed October 25, 2026.
  7. Cornell Law Institute, Legal Information Institute. 26 CFR 1.121-2, Limitations on the Exclusion of Gain From Sale of a Principal Residence. Accessed October 25, 2026.
  8. Cornell Law Institute, Legal Information Institute. 26 CFR 1.121-1, Exclusion of Gain From Sale or Exchange of a Principal Residence. Accessed October 25, 2026.
  9. Cornell Law Institute, Legal Information Institute. 26 U.S. Code Section 121, Exclusion of Gain From Sale of Principal Residence. Accessed October 25, 2026.
  10. Before you rely on the result for a real sale, confirm it with a tax professional, since partial exclusions for job moves, health, and unforeseen events have their own rules. This calculator is a planning estimate, not tax advice.

Related calculators

Tax CalculatorsCar Loan Interest Deduction CalculatorIf you bought an electric vehicle expecting a federal tax credit, the rules changed in 2025.Tax CalculatorsAGI Calculator: Find Your Adjusted Gross IncomeAdjusted gross income is the number your whole tax return hangs on.Tax CalculatorsBonus Take Home Pay Calculator: Your Net BonusYou were promised a $10,000 bonus and the deposit says $6,535. Nothing went wrong.Tax Calculators1040 CalculatorForm 1040 is the tax return almost every US worker files, yet the number at the bottom is a mystery to most filers until software spits it out.Tax CalculatorsFiling Deadline CalculatorPick a tax year and a filing type and this calculator returns your federal filing deadline, the automatic extension deadline beside it, and a live countdown of the days left from today.Tax CalculatorsAdjusted Income CalculatorAdjusted income is the number between what you earn and what you are taxed on: your gross income, minus a specific set of adjustments that the tax code lets you take before anything else.

We use cookies to analyze traffic. You can accept or decline cookies below. Learn more

calculatorzilo

CalculatorZilo

Free calculators for everyday life. No signup, no cost, just answers.

Categories

Finance Math Health & Fitness Education Science Real Estate Chemistry Browse all calculators

Popular tools

Mortgage Payment Calculator BMI Walking Calculator Salary Per Minute Calculator Percentage Off Calculator

Company

About Us Contact Us Privacy Policy Terms and Conditions
Disclaimer Cookie Policy DMCA Policy Affiliate Disclosure FAQ Accessibility Statement

© 2026 CalculatorZilo • Free calculators for everyone

  • Home
  • Calculators
    • Browse all calculators
    • Education
    • Real Estate
    • Chemistry
  • Finance
  • Math
  • Health & Fitness
  • Science
  • About
  • Contact
Search