Dear Tax Talk,

If I have a home equity line of credit and pay it off at the sale of the house, will the amount used to pay it off be taxed as a capital gain?
— Judith

Jacek Kadaj/Getty Images

Dear Judith,
The short answer to your question is that the home equity line of credit is unrelated to the potential capital gain or loss on the sale of your home.

To calculate the gain or loss on the sale of your property, you take the gross sales price less your selling expenses to calculate the total amount realized. The next step is to subtract your “adjusted basis” to determine the gain or loss on the sale.

How to figure capital gains on home sale

To put some numbers to the basic formula, say that you sell your home for $400,000 and your selling expenses are $24,000 (real estate commissions, advertising, legal fees, etc.). Your total amount realized is $376,000. You then reduce this amount by the “adjusted basis” of your home, which is the original purchase price plus any improvements that you made to the home over the years — think new windows, floors, kitchen and the like. To further the example, say your original purchase price was $250,000 for simplicity’s sake, and no improvements were made. You would take the $376,000 amount realized and then subtract the $250,000 adjusted basis to come up with a gain of $126,000 on the sale of your home.

Notice that the amount of your primary mortgage or any other home equity line of credit was not a factor in the above calculation whatsoever.

You may qualify for capital gains exclusion

There is some good news: If you have owned and occupied the property as a principal residence for 2 of the 5 years immediately before the sale, you may qualify for an exclusion of the gain: $500,000 for taxpayers married filing jointly, and $250,000 for single taxpayers.

The tax code is currently geared to be favorable to homeownership, as evidenced by the substantial provisions to reduce the gain as much as possible on your primary home. Hopefully you qualify for the exclusion and your gain may be little or nothing at all.

Thanks for the great question and all the best to you in selling your home!

RATE SEARCH: Find the best mortgage rates today at Bankrate.com.