The formula used in the calculation is:
Where:
A = periodic payment amount
P = amount of principal (be sure to subtract any down-payments first!)
i = periodic interest rate
n = total number of payments (for a 30-year loan with monthly payments, n = 30 years x 12 months = 360)