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.
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.
- 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
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.
References
- Internal Revenue Service. Publication 523, Selling Your Home. Accessed October 25, 2026.
- Internal Revenue Service. Topic No. 701, Sale of Your Home. Accessed October 25, 2026.
- Internal Revenue Service. Topic No. 409, Capital Gains and Losses. Accessed October 25, 2026.
- Internal Revenue Service. Publication 551, Basis of Assets. Accessed October 25, 2026.
- Internal Revenue Service. Topic No. 559, Net Investment Income Tax. Accessed October 25, 2026.
- 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.
- 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.
- 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.
- Cornell Law Institute, Legal Information Institute. 26 U.S. Code Section 121, Exclusion of Gain From Sale of Principal Residence. Accessed October 25, 2026.
- 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.
