There is compensation costs involved with breaking a mortgage and it is not always in the best interests of the borrower to do so, despite recent media attention around all time lows for interest rates.
Compensation equals the greater of 3 months interest or interest rate differential.
This means that if you are currently 2 years into a 5 year mortgage with an interest rate of 6% and you want to switch because rates are now 4% the lender is entitled to the 2% differential for the 3 years remaining in the mortgage.
Compensation is usually adjusted if renewing with your existing lender rather than switching to another financial institution but not significantly.
Another option is to "blend and extend". In the example above this would not give the 4% rate but it would lower the 6%.