Realized 1031 Blog Articles

Capital Gains Tax on Sale of Property With a Mortgage: Step-by-Step Examples

Written by The Realized Team | Jun 12, 2026

Selling an investment property can bring lucrative financial benefits, but it also entails understanding the intricacies of taxes, specifically capital gains tax. When a property is sold for more than its purchase price, the profit is known as a capital gain. What complicates matters is when a property is sold with an existing mortgage.

Understanding Capital Gains Tax

Before diving into scenarios, it’s crucial to grasp what capital gains tax entails. This tax is levied on the profit from the sale of a property, calculated as the difference between the sale price and the adjusted basis (the original purchase price plus any improvements, minus depreciation).

Calculating Capital Gains with a Mortgage

Step 1: Determine the Adjusted Basis

Suppose you bought a property for $300,000 and, over the years, spent $20,000 on improvements. Meanwhile, depreciation claimed amounts to $50,000. The adjusted basis is calculated as follows:

• Original Purchase Price: $300,000

• + Improvements: $20,000

• - Depreciation: $50,000

• Adjusted Basis = $270,000

Step 2: Calculate the Capital Gains

If the property sells for $450,000 and closing costs are $30,000, calculate the capital gains:

• Sale Price: $450,000

• - Closing Costs: $30,000

• Net Selling Price = $420,000

Capital Gains are then:

• Net Selling Price: $420,000

• - Adjusted Basis: $270,000

• Total Capital Gain = $150,000

Financing and Its Role

How does a mortgage factor into this calculation? While a mortgage doesn’t directly affect the capital gains calculation, it impacts the net cash received at closing. If you've paid down your mortgage to $150,000, then the net cash from the sale, after paying off the mortgage, would be:

• Net Selling Price: $420,000

• - Mortgage Balance: $150,000

• Net Cash Received = $270,000

Tax Implications and Deferral Strategies

Capital gains tax rates depend on how long the property is held. For example, if held over a year, the gain qualifies forlong-term capital gain rates, typically lower than short-term rates. However, savvy investors often employ strategies like the 1031 Exchange to defer capital gains tax. This involves reinvesting the proceeds from the sale into another qualifying property, thereby deferring the tax liability.

Example: The Smiths’ Strategy

Consider investors, the Smiths, who decided to sell a rental property held for several years. With a purchase price of $400,000, improvements of $50,000, and depreciation of $60,000, their adjusted basis is $390,000. After selling for $600,000 with closing costs of $40,000, their capital gain is calculated as $600,000 - $40,000 - $390,000 = $170,000.

Because they plan ahead, the Smiths use a 1031 Exchange to defer taxes by purchasing another property. This decision not only defers immediate tax liabilities but also maximizes their reinvestment potential.

Conclusion

Navigating capital gains tax with an existing mortgage adds layers to property sales, but understanding these components and leveraging investment strategies can optimize financial outcomes. For property investors, strategic planning and sound financial advice are necessary to manage tax implications effectively and make informed investment decisions.