The amount of the proceeds from the sale of your home that you use to pay off the mortgage isn't a factor in figuring your taxable amount for the sale. Instead, the amount you realize on the sale of your home and the adjusted basis of your home are important in determining whether you're subject to tax on the sale.
If the amount you realize, which generally includes any cash or other property you receive plus any of your indebtedness the buyer assumes or is otherwise paid off as part of the sale, less your selling expenses, is more than your adjusted basis in your home, you have a capital gain on the sale.
Your adjusted basis is generally your cost in acquiring your home plus the cost of any capital improvements you made, less casualty loss amounts and other decreases. For more information on basis and adjusted basis, refer to Publication 523, Selling Your Home. If you financed the purchase of the house by obtaining a mortgage, include the mortgage proceeds in determining your adjusted cost basis in your residence.
You may be able to exclude from income all or a portion of the gain on your home sale. If you can exclude all of the gain, you don't need to report the sale on your tax return, unless you received a Form 1099-S, Proceeds From Real Estate Transactions. To determine the amount of the gain you may exclude from income or for additional information on the tax rules that apply when you sell your home, refer to Publication 523. You must report on your return as taxable income the capital gain that you can't exclude.