FREE · 501(c)(3) NONPROFIT · EDUCATION ONLY

Mortgage over basis calculator: will the tax be bigger than your check?

By , founder, Retirement Literacy Foundation · Updated
Enrolled Agent, admitted to practice before the IRS.

Refinanced and pulled cash out? Paying off the loan cuts your cash, not your gain. Enter your numbers and compare the 2026 tax with the cash at closing.

1 · What you paid

If you exchanged into this property, the price of the replacement property.
Title, escrow, recording, transfer tax you paid to buy. Not loan fees.
Roof, additions, remodels. Not repairs.

2 · What lowered your basis

Total from every year’s Form 4562 / Schedule E. Enter it even if you never claimed it, because §1016(a)(2) lowers your basis by the depreciation you were allowed. If you exchanged into this property, include depreciation from the property you gave up; it carries over.
Don’t know it? Estimate it

§1245 property. Recaptured as ordinary income, not capped at 25%. Leave 0 if unsure.
The deferred gain carries in as a lower basis.
Both reduce basis (IRS Pub 551). Leave 0 if none.

3 · The sale

Commission + closing. 6% is typical.
Every loan secured by the property, including any cash-out refinance or HELOC.

4 · You

The example is a $1,400,000 rental bought for $500,000, refinanced to a $900,000 loan. Change any number and the result updates. 2026 rules.

ESTIMATED TOTAL TAX ON THE SALE

Key figures
Adjusted basis
Total gain
Unrecaptured §1250 gain (up to 25%)
Total estimated tax
Cash at closing after loan payoff
Cash left after tax
Your adjusted basis, line by line
Purchase price
+ Purchase closing costs
+ Capital improvements
− Depreciation (allowed or allowable) §1016(a)(2)
− Gain deferred from a prior 1031
− Casualty losses / insurance reimbursements
Adjusted basis §1011
Your gain
Sale price
− Selling costs
= Amount realized the loan is NOT subtracted (Reg. 1.1001-2)
− Adjusted basis
Total gain §1001(b)
  §1245 recapture (ordinary income)
  Unrecaptured §1250 gain (taxed up to 25%)
  Remaining long-term capital gain (0/15/20%)
The tax, layer by layer (2026)
§1245 recapture at ordinary rates
Unrecaptured §1250 gain
Capital gain at 0%
Capital gain at 15%
Capital gain at 20%
Net investment income tax 3.8% §1411
State income tax
Total estimated tax
Tax vs cash
Sale price
− Selling costs
− Loan payoff
Cash at closing
− Total estimated tax
Cash left after tax

Education, not tax advice. 2026 federal brackets. The 3.8% test uses modified AGI, estimated as your “other taxable income” plus the 2026 standard deduction ($16,100 single / $32,200 married) plus the gain.

Unrecaptured §1250 gain is stacked on top of your other income and each slice taxed at the lower of its ordinary bracket or 25% (§1(h)(1)(E)); the remaining gain fills the 0/15/20% bands above that.

Assumes the property was held more than a year, straight-line depreciation on the building, and that the 3.8% NIIT applies (it may not if you qualify as a real estate professional). No §121 home-sale exclusion, passive-loss carryforwards, AMT or state depreciation differences are modelled. Have a CPA confirm before you sign anything.

Audit trail / Sources

Every rule this calculator applies, and where it comes from. Rates are 2026 federal; state rates are the same table our capital gains calculator uses.

  1. IRC §1011: Adjusted basis is the starting point for gain or loss.
  2. IRC §1016(a)(2), Basis is reduced by depreciation “allowed or allowable”, claimed or not.
  3. IRC §1001(b): Gain = amount realized minus adjusted basis.
  4. Treas. Reg. §1.1001-2, Amount realized includes liabilities the seller is relieved of, debt does not reduce the gain.
  5. IRC §1(h)(1)(E) and §1(h)(6): Unrecaptured §1250 gain is taxed at no more than 25%; the 0/15/20% layers apply to the rest.
  6. IRC §1250: Recapture on depreciable real property (buildings).
  7. IRC §1245, Recapture on personal property (equipment, cost-segregation components), taxed as ordinary income.
  8. IRC §1411: 3.8% net investment income tax above $200,000 single / $250,000 joint MAGI (not indexed).
  9. IRC §453(i): In an installment sale, ordinary-income recapture (§1245 and any §1250 additional depreciation) is recognized in the year of sale.
  10. Treas. Reg. §1.453-12: Unrecaptured §1250 gain in an installment sale is taken into account as payments are received, before other long-term gain.
  11. Treas. Reg. §15a.453-1(b)(3): Qualifying debt assumed by the buyer in excess of basis is a payment in the year of sale.
  12. Treas. Reg. §1.1031(d)-2: Net debt relief in a like-kind exchange is treated as money received (mortgage boot).
  13. IRS Publication 544, Sales and Other Dispositions of Assets, recapture, installment sales, like-kind exchanges.
  14. IRS Publication 551, Basis of Assets, what increases and decreases basis (improvements, depreciation, casualty losses, insurance reimbursements).
  15. IRS Publication 946: 27.5-year residential and 39-year nonresidential recovery periods.
  16. 2026 brackets: Rev. Proc. 2025-32, which sets the 2026 ordinary brackets and the 0/15/20% capital gains breakpoints used here.
  17. California FTB rate schedules, R&TC §17041 and §17043: California taxes capital gain as ordinary income, 1% to 12.3% plus the 1% Mental Health Services Tax over $1M.

The Retirement Literacy Foundation is a 501(c)(3) public charity. This page is general education, not tax, legal or investment advice. Nothing is sold here.

Questions people ask

How does a mortgage affect capital gains tax when I sell?
It does not change the gain. Under IRC 1001(b) and Treas. Reg. 1.1001-2 the amount realized includes the debt paid off or assumed, so the gain is sale price minus selling costs minus adjusted basis, no matter what you owe. The loan changes only how much cash you receive.
Can I owe more tax than the cash I get from the sale?
Yes. If a cash-out refinance pushed the loan above your adjusted basis, your taxable gain is larger than your cash at closing by exactly that difference. The refinance cash was tax-free when you borrowed it; the sale is when the gain behind it is finally taxed.
Is cash-out refinance money taxable?
Not when you borrow it, because a loan is not income. But it does not raise your basis either (unless spent on improvements), so it increases the gap between what you owe and what your basis is when you sell.
What is mortgage boot in a 1031 exchange?
If the loan paid off on the property you sell is larger than the debt on the replacement property, and you do not add cash to make up the difference, the net debt relief is boot and it is taxable in the year of the exchange (Treas. Reg. 1.1031(d)-2).
What happens to mortgage over basis in an installment sale?
If the buyer assumes or takes the property subject to your loan, the part of that loan above your adjusted basis is treated as a payment received in the year of sale (Treas. Reg. 15a.453-1(b)(3)(i)). The ordinary-income part of depreciation recapture (Section 1245, including cost-segregation items) is taxed in the year of sale no matter how the payments are spread (IRC 453(i)); the 25% unrecaptured Section 1250 gain is spread over the payments with the rest of the gain (Treas. Reg. 1.453-12).
Hans Goldstein, founder of the Retirement Literacy Foundation
Who made this calculator
Hans Goldstein, EA, Founder and Executive Director, Retirement Literacy Foundation
Admitted to practice before the IRS

The Retirement Literacy Foundation is a 501(c)(3) public charity (EIN 41-5062266) that gives free, plain-English retirement education to Southern California retirees. Hans is its unpaid Executive Director and draws no salary from the Foundation.

What it costs: nothing. The calculator and the class are free. Nothing is sold.

If you leave a phone number: we may call you about your request. Those calls are educational, and nothing is offered or sold.

Questions: call 714-584-4921 or read about the Foundation. General education, not tax, legal or investment advice.

Free class on Zoom: Big sales and taxes. Thursday, October 22, 2026, 4:00 PM Pacific (7:00 PM Eastern). One hour on what a sale really costs in tax and the legal ways to spread it. From a 501(c)(3). Nothing is sold. Save a seat.

Hans Goldstein is an Enrolled Agent, admitted to practice before the Internal Revenue Service. Not affiliated with or endorsed by the IRS.