How to Calculate Capital Gains Sale of Investment Property on Which Mortgage Is Owed?

Loans don't affect gains on investment property sales.

Hemera Technologies/AbleStock.com/Getty Images

When you sell investment property, all of your profits are subject to either capital gains tax or depreciation recapture tax, which is a special type of capital gains tax. Your tax gets calculated on the difference between your cost basis and your selling price. Any debt that you owe, such as the balance on your mortgage, will not affect your capital gains liability.

Your Cost Basis

Your cost basis isn't just the purchase price of your investment property. The initial cost is what you actually paid at the closing, including your closing costs.

For example, if you bought a small apartment building for $1 million and paid $1,500 in title fees, $5,000 in attorney's fees, $2,000 in miscellaneous fees and $8,000 in inspection fees, your actual cost would be $1.0165 million.

To that cost, add the cost of any improvements you made to the property. Improvements are anything that changes your property's use, increases its value or extends its useful life. Taking the apartment building as an example, a $50,000 roof and $115,000 in kitchen and bathroom renovations would count as improvements and increase your cost basis to $1.1815 million.

Depreciation and Basis

While you own your investment property, the tax code lets you claim a small portion of its cost basis every year as a depreciation write-off. Depreciation is an accounting tool that simulates the decline in value that accompanies the gradual deterioration of buildings (although in recent years, almost all property has actually gained value over time).

When you sell it for more than the depreciated value, the IRS will want you to return a portion of the money that you saved by claiming depreciation. To properly calculate your capital gains liability, you will need to total all of the depreciation that you were legally entitled to claim, whether or not you actually claimed it.

Calculating Tax Liability

You owe capital gains taxes on the difference between your adjusted cost basis and your net selling price. If you, for example, sell your apartment building for $1.95 million and pay $105,000 in commission and $8,700 in closing costs, your net selling price is $1.8363 million. Subtracting your $1.1815 million cost basis gives you a taxable capital gain of $654,800.

In addition, if you sell for a profit, you will have to pay depreciation recapture taxes on all of your accumulated depreciation. If you claimed $320,000 in depreciation while you owned your building, you need to pay depreciation recapture tax on the all of the $320,000.

If you sell for a loss, you will pay recapture tax on the difference between your net selling price and your depreciated basis. For example, if you sold the building for $925,000, you would have a capital loss, but since your depreciated basis would be $861,500 ($1.1815 million minus $320,000), you would pay recapture tax on the $63,500 difference.

Federal Tax Rates

Capital gains on assets that you hold for at least one year are considered long-term gains. For tax year 2019:

  • Taxpayers filing single pay 0 percent capital gains tax (income up to $39,375), 15 percent capital gains tax (income $39,376 to $434,550) and 20 percent capital gains tax (income more than $434,550).
  • Taxpayers filing married filing jointly pay 0 percent capital gains tax (income up to $78,750), 15 percent capital gains tax (income $78,751 to $488,850) and 20 percent capital gains tax (income more than $488,850). 
  • Taxpayers filing head of household pay 0 percent capital gains tax (income up to $52,750), 15 percent capital gains tax (income $52,751 to $461,700) and 20 percent capital gains tax (income more than $461,700). 
  • Taxpayers filing married filing separately pay 0 percent capital gains tax (income up to $39,375), 15 percent capital gains tax (income $39,376 to $244,425) and 20 percent capital gains tax (income more than $244,425). 

Short-term gains are taxed at your marginal income tax rate. In addition, depreciation recapture is taxed at 25 percent.

You may also be subject to a 3.8 percent Medicare surtax if your income exceeds $200,000 if you are single or $250,000 if you are married. These rates went into effect for the 2013 tax year and will not change without new laws being passed. It's always a good idea to verify these rates with the IRS or your accountant.

Loans and Gains

What you pay off on your loan isn't tax deductible. However, you can amortize many of the costs of getting your loan over its life.

For example, if you pay $12,000 to take out a mortgage with a 10-year term, you can write off $1,200 per year. If you were to sell your property after only three years, you'd have $8,400 in remaining loan fees that you hadn't claimed. You would be able to add those remaining fees to your cost basis, reducing your gain when you sold your property.