The Internal Revenue Service doesn't let you deduct mortgages or liens when figuring the tax on capital gains from property sales, even though you must pay them off in order to sell with clear title. A mortgage is both contracted for and paid off during the buy-and-sell process, so it all evens out. This doesn't mean you'll get hit with a huge tax bill when you sell, however. In fact, you probably won't, thanks to IRS exclusions that apply to homeowners.
TL;DR (Too Long; Didn't Read)
If you have sold your house for a profit, you may be liable for capital gains taxation. However, given the number of credits and deductions offered to homeowners, there is also a possibility that you will not owe any capital gains taxes.
Figuring Your Tax Basis
The IRS doesn't care how you paid for your home when you purchased it. Your property's basis for capital gains tax begins with the purchase price regardless of how you financed the transaction. For example, if you paid $300,000 for the home, your tax basis is $300,000, even if you took out a mortgage for $270,000. You can add to the $300,000 figure, however, if you made any home improvements. If you added a sun room and it cost you $60,000, your tax basis becomes $360,000. The higher your basis, the less capital gains you'll typically realize.
Calculating Your Gain
After you determine your basis, you can deduct it from the sales price when you sold your house to determine your capital gain. For example, if you sell your home for $400,000 and its basis is $360,000, you have a $40,000 capital gain. You can whittle away from this a little more, however, by deducting costs incident to the buy-and-sell process. For example, you can subtract mortgage points or prepaid interest you paid at closing when you purchased the property, and you can deduct expenses such as your broker's commission and legal fees that you paid as part of the sale. You can also deduct anything you spent to spruce the place up to sell it, provided you made the repairs and cosmetic improvements within three months of the sale date. If these additional costs add up to $16,000, your capital gain becomes only $24,000.
Qualifying For an Exclusion
The IRS allows you to exclude capital gains of up to $250,000, or $500,000 if you're married filing jointly, from tax. You can only use this exclusion once every two years, however, and you must qualify by having lived in your home for two out of the five years preceding the sale. In addition, the house must have been your primary residence. More details about exclusions are available in IRS Publication 523. If you don't qualify, the IRS taxes capital gains for most taxpayers at a rate of 15 percent as of 2018. This increases to 20 percent if your adjusted gross income exceeds $418,400 if single or $470,700 if married and filing a joint return.
Suspension of Residency Tests for Exclusion
If unforeseen circumstances prevent you from qualifying for the full exclusion because you don't meet the residency requirements, you might still qualify for a partial exclusion, which is typically a percentage equal to the amount of time you did reside in your home. For example, if you only lived there for a year instead of the two typically required, you could exclude $125,000 if you're single, or half the exclusion amount. This rules applies if a job change forces you to relocate, or if you become seriously ill so you can no longer afford the mortgage payments and must sell. The two-year residency rule is waived for members of the military who must relocate due to service requirements. If you sell because your spouse has died, you can still take the $500,000 exclusion reserved for married couples if you do so within two years.