Capital gains are figured by subtracting the original purchase price from the recent sales price of the home. Mortgages or interest paid does not factor into this equation.
As of 2013, if the profit from the sale of the home is less than $250,000 (if single) or $500,000 (if married), you are exempt from capital gain taxes. Additionally, you must have owned and lived in the home for at least 24 months within the past 5 years.
Of course, it is always a good idea to consult with a CPA to make sure you meet all the requirements and are maximizing your deductions.