M = payment amount
P = principal, meaning the amount of money borrowed
J = effective interest rate. Note that this is usually not the annual interest rate; see below for an explanation.
N = total number of payments
Calculate your effective interest J. Most loan terms mention the "nominal annual interest rate," but you probable aren't paying your loan off in annual installments. Divide the annual interest rate by 100 to put it in decimal form, then divide it by the number of payments you make each year to get the effective interest rate.
For example, if the annual interest rate is 5%, and you pay in monthly installments (12 times per year), calculate 5/100 to get 0.05, then calculate J= 0.05 / 12 = 0.004167.
In unusual cases, interest rates are calculated at a different interval than payment schedule. Most notably, Canadian mortgages are calculated twice a year, despite the borrower making payments twelve times a year. In this case, you would divide the annual interest by two.
For example, if the loan term is 5 years and you'll be paying in twelve monthly installments each year, your total number of payments will be N = 5 * 12 = 60
Calculate (1+J)-N. First add 1+J, then raise the answer to the power of "-N." Make sure to include the negative sign in front of the N. If your calculator can't handle negative exponents, instead write this as 1/((1+J)N).[2]
In our example, (1+J)-N = (1.004167)-60 = 0.7792