Welcome to JustAnswer! I am here to help resolve your legal issue. Tackling legal issues can sometimes get cumbersome or confusing. Should you need to chat on the phone or document help, I am happy to for an additional cost. Let me know at any time during our question and answer session if you are interested in these – I am happy to give you more details!
Capital Gains Tax is calculated AFTER the mortgage and other expenses are dedcuted from the sale price. If after deducting the mortgage the balance falls below the CGT limit then no CGT is payable.
Here is very helpful calculator from HMRC: http://www.hmrc.gov.uk/cgt/property/calc-cgt.htm