Home Sale Calculator: Cost Basis & Taxable Gain

Estimate your adjusted basis, home-sale gain, and potential Section 121 exclusion—without a fake flat-rate tax answer.

Use our Home Sale Calculator to calculate the Capital Gains Tax on The Sale of Real Estate & Investment Properties
Capital Gains Tax on The Sale of Real Estate & Investment Properties

A home sale calculator should answer one question before anything else: what is your actual gain? Your mortgage payoff and home equity do not determine taxable gain. The core calculation starts with your amount realized from the sale, subtracts your adjusted cost basis, and then tests whether some or all of the gain may qualify for the federal home-sale exclusion.

That sounds simple. It is also where a lot of bad estimates begin. In financial-planning conversations, I have seen homeowners focus on the sale price and what they still owe the bank while overlooking the number that actually drives the tax calculation: adjusted basis.

So I rebuilt this tool around the calculation the IRS actually cares about. It estimates your amount realized, adjusted basis, gain, and—when the standard Section 121 screen is clean—a potential full exclusion. It deliberately does not pretend to know your exact tax bill from a handful of inputs.

Quick Answer

Your estimated home-sale gain is generally your amount realized from the sale minus your adjusted basis. Amount realized starts with the sale price and is reduced by qualifying selling expenses. Adjusted basis generally starts with what you paid for the home, increases for qualifying basis additions and capital improvements, and decreases for items the IRS requires you to subtract, such as certain depreciation. If the home qualifies under Section 121, you may then be able to exclude up to $250,000 of gain, or up to $500,000 on a qualifying joint return.

How This Home Sale Calculator Works

The cleanest way to think about a home sale is as a four-layer calculation:

  1. Amount realized: start with the sale price and subtract qualifying selling expenses.
  2. Adjusted basis: start with your purchase price or other starting basis, add qualifying basis increases and capital improvements, then subtract required basis reductions.
  3. Gain or loss: subtract adjusted basis from amount realized.
  4. Potential Section 121 exclusion: if the sale meets the applicable main-home rules, determine how much of the gain may be excluded.

The IRS home-sale basis guidance makes an important point that is easy to miss: what you still owe on the mortgage is not the number used to calculate your gain. A buyer paying off your mortgage at closing does not turn the mortgage balance into your cost basis.

Watch Out: Equity Is Not Taxable Gain

If you sell a $1 million home and owe $450,000 on the mortgage, you do not automatically have a $550,000 capital gain. The mortgage affects how much cash reaches you at closing. Your tax gain depends on amount realized minus adjusted basis.

This is also why two online calculators can give very different answers. One may treat every improvement as a basis increase. Another may ignore depreciation. Another may assume the full $250,000 or $500,000 exclusion from a single checkbox. And a calculator that multiplies the remaining gain by 15% is skipping the fact that federal long-term capital-gain rates depend on your broader taxable-income picture and other taxes may apply.

Use the Home Sale Cost Basis Calculator

Enter the numbers you can support from your closing records, purchase documents and improvement records. The calculator shows each layer separately so you can see exactly which number is driving the result.

Estimate your home-sale gain in layers: amount realized, adjusted basis, gain, and—when the standard Section 121 screen is clean—a potential full exclusion. This tool does not estimate your final federal or state tax bill.

1. Sale numbers



Examples can include commissions and other qualifying costs of sale. Enter only amounts you can support.

2. Adjusted basis



Use the IRS basis rules; not every closing cost or receipt increases basis.


Use qualifying improvements, not ordinary repairs or maintenance unless the IRS rules treat the cost as part of an eligible improvement.


Examples may include depreciation allowed or allowable and certain other IRS-required decreases to basis.

3. Standard Section 121 full-exclusion screen


4. Complexity check

Check any item that applies. The calculator will still estimate gain, but it will stop before estimating an exclusion because these facts can materially change the tax treatment.

What the result means: the final “potential gain remaining after exclusion” is not the same thing as your final tax bill. It is the amount that may still need federal capital-gain-rate analysis after this simplified home-sale screen. State tax, Net Investment Income Tax, depreciation-related gain and other rules can change what you ultimately owe.

Michael’s Take

A calculator is most useful when it tells you where its confidence ends. I would rather have a tool stop and say “this needs a closer look” than produce a beautifully formatted wrong answer to the dollar.

Keep the home-sale tax pieces straight

If this calculator helped you separate equity, basis and taxable gain, my weekly email keeps doing the same thing with the financial rules that are easiest to get almost right—and expensive to get wrong.

  • Plain-English explanations of tax and retirement rules.
  • Practical checks before a large financial move.
  • New calculators and planning tools when they are actually useful.

Get Michael Ryan Money in your inbox.

Michael Ryan
Join Tens of Thousands Learning Real-World Financial Strategies
No jargon. No sales pitch. Just clarity — in one weekly money email.
Trusted by tens of thousands of readers.
As featured in The Wall Street Journal, The New York Times, Forbes, Business Insider, Yahoo Finance, Newsweek & more.

What Counts Toward Your Adjusted Cost Basis?

Your adjusted basis is not simply “what I paid plus every receipt I kept.” The IRS generally starts with your cost in acquiring the property, adds qualifying increases to basis, and subtracts required decreases. IRS Publication 523 contains the detailed worksheets and categories.

Capital improvements can increase basis

A capital improvement generally adds value to the home, prolongs its useful life, or adapts it to new uses. A room addition, a new roof, a major kitchen renovation or a new central-air system may fit. Ordinary maintenance and repairs generally do not increase basis by themselves.

There is an important nuance: a repair performed as part of a larger qualifying improvement may be treated differently from the same repair performed by itself. That is why “every receipt counts” is too broad. The better rule is: keep the records, then classify the cost correctly.

Some purchase and settlement costs can increase basis—but not all of them

Certain settlement fees and closing costs can be added to basis, while others cannot. Do not dump the entire closing statement into one “closing costs” field and assume every dollar qualifies. Use your settlement statement and Publication 523 to separate basis items from financing costs, taxes and other charges with different treatment.

Basis reductions matter too

Adjusted basis can go down. Depreciation allowed or allowable for rental or business use is a common example. Certain casualty-loss adjustments, insurance reimbursements and other items can also reduce basis. Ignoring a required basis reduction can understate your gain.

A simple recordkeeping checklist

  • Original closing or settlement statement from the purchase.
  • Invoices and proof of payment for major improvements.
  • Records showing insurance reimbursements or other basis adjustments.
  • Depreciation records if the home ever had rental or business use.
  • Closing statement from the sale showing selling expenses.

If your main question is the legal rule rather than the arithmetic, use my separate capital gains tax on a home sale guide. That page owns the deeper Section 121 eligibility, exceptions and reporting rules; this page owns the calculator.

When the Calculator Should Stop Instead of Guessing

The standard home-sale exclusion is generous, but it is not just “I lived there two years, therefore subtract $250,000 or $500,000.” The IRS Section 121 summary says the general rule requires ownership and use tests, and it generally prevents another exclusion if you used the exclusion on a different home during the prior two years. For the $500,000 joint-return maximum, either spouse must meet the ownership test, both spouses must meet the use test, and neither spouse can have used the exclusion on another home during that two-year period.

This calculator intentionally stops before estimating the exclusion when you flag facts that can materially change the result. That includes:

  • rental or business use with depreciation;
  • periods of nonqualified use after 2008;
  • an inherited or gifted home, divorce transfer, or prior like-kind exchange;
  • a possible reduced exclusion because the full ownership or use tests are not met; or
  • other facts that make your starting basis different from a straightforward purchase price.

The IRS also notes that a reduced exclusion may be available in some sales connected to a change in employment, health or certain unforeseen circumstances. That is a good example of why a failed “full exclusion” screen should not be translated into “you get no exclusion.” Sometimes the correct answer is simply: the basic calculator has reached its boundary.

Example: Why the mortgage balance disappears from the formula

Suppose you sell a home for $900,000, pay $50,000 of qualifying selling expenses, and have an adjusted basis of $500,000. Your amount realized is $850,000 and your gain is $350,000. Whether the mortgage payoff is $100,000 or $500,000 does not change that $350,000 gain calculation. The mortgage changes the cash you walk away with—not the gain formula.

Frequently Asked Questions About Home Sale Capital Gains

Do I have to pay capital gains tax when I sell my house?

Not always. If you have a gain on the sale of your main home and meet the applicable Section 121 rules, you may be able to exclude up to $250,000 of gain, or up to $500,000 on a qualifying joint return. If you cannot exclude all of the gain, the remaining taxable gain requires a separate tax calculation based on your broader facts.

What is the difference between cost basis and adjusted basis?

Cost basis is your starting basis in the property, often based on what you paid to acquire it. Adjusted basis changes that starting number for qualifying increases such as certain capital improvements and for required decreases such as certain depreciation or other IRS adjustments.

Do home repairs count as capital improvements?

Ordinary repairs and maintenance generally do not increase basis by themselves. A qualifying capital improvement generally adds value, prolongs the home’s useful life, or adapts it to new uses. A repair performed as part of a larger improvement can require a closer look under the IRS rules.

Does my mortgage balance affect my capital gain?

Not in the way homeowners often assume. Your mortgage payoff affects the cash you receive at closing, but home-sale gain is generally based on amount realized minus adjusted basis. The IRS specifically points to amount realized and adjusted basis when determining gain.

Next Steps for Calculating Your Home Sale Cost Basis

The number worth getting right first is not your equity. It is your adjusted basis. Pull the purchase closing statement, improvement records, depreciation history if applicable, and the sale closing statement. Then run the calculator again with numbers you can document.

If the tool gives you a clean standard Section 121 estimate, you now have a useful starting point: estimated gain and the amount that may remain after a potential full exclusion. If the tool stops because your facts are more complicated, that is useful information too. It tells you exactly where a tax professional or a closer read of Publication 523 can add value.

The calculation I want you to remember is simple: sale proceeds tell you what came in; adjusted basis helps determine what was actually gained. Those are not the same thing.

We are audience supported - when you make a purchase through our site, we may earn an affiliate commission.

Michael Ryan
Michael Ryan, Retired Financial Planner & Founder of MichaelRyanMoney.com Michael Ryan is a retired financial planner and financial educator with nearly three decades of experience in financial planning, retirement planning, estate planning, insurance, and risk management. He is the founder of MichaelRyanMoney.com, where he explains Social Security, Medicare and IRMAA, retirement income, taxes, estate planning, insurance, investing, and personal finance in plain English. His commentary has been featured by outlets including The Wall Street Journal, U.S. News & World Report, Business Insider, Yahoo Finance, Forbes, Newsweek, and Nasdaq. Michael no longer sells financial products, manages investments, or provides individualized investment, tax, legal, or insurance advice through the site.