Whether you're considering a mortgage, a car loan, or a personal loan, the math behind monthly payments is always the same formula — and it's simpler than it looks once you understand the parts.
The monthly payment formula
M = P × [r(1 + r)^n] / [(1 + r)^n − 1]
Where:
- M = monthly payment
- P = principal (the loan amount)
- r = monthly interest rate (annual rate ÷ 12)
- n = total number of payments (years × 12)
Example: €20,000 car loan
Loan amount: €20,000
Annual interest rate: 6%
Term: 4 years (48 months)
r = 6% / 12 = 0.005
n = 48
M = 20000 × [0.005 × (1.005)^48] / [(1.005)^48 − 1]
M = 20000 × [0.005 × 1.2705] / [1.2705 − 1]
M = 20000 × 0.006352 / 0.2705
M = 20000 × 0.023485
M ≈ €469.70 per month
Total paid: 48 × €469.70 = €22,545.60
Total interest: €22,545.60 − €20,000 = €2,545.60
How amortization works
Every monthly payment is split between interest and principal reduction. Early in the loan, most of the payment is interest. As you pay down the principal, the interest portion shrinks and more of each payment goes toward the principal.
This is called amortization.
Amortization schedule (first 4 months of the example above)
| Month | Payment | Interest | Principal | Remaining Balance |
|---|---|---|---|---|
| 1 | €469.70 | €100.00 | €369.70 | €19,630.30 |
| 2 | €469.70 | €98.15 | €371.55 | €19,258.75 |
| 3 | €469.70 | €96.29 | €373.41 | €18,885.34 |
| 4 | €469.70 | €94.43 | €375.27 | €18,510.07 |
Interest = previous balance × monthly rate
Principal = payment − interest
New balance = previous balance − principal
By month 48, the entire principal is paid off and the last payment might be slightly different due to rounding.
Loan payment in code
JavaScript:
function calculateLoanPayment(principal, annualRate, years) {
const r = annualRate / 100 / 12;
const n = years * 12;
if (r === 0) return principal / n; // 0% interest edge case
const monthly = principal * (r * Math.pow(1 + r, n)) / (Math.pow(1 + r, n) - 1);
return Math.round(monthly * 100) / 100;
}
const payment = calculateLoanPayment(20000, 6, 4);
console.log(payment); // 469.70
// Generate full amortization schedule
function amortizationSchedule(principal, annualRate, years) {
const r = annualRate / 100 / 12;
const n = years * 12;
const monthly = calculateLoanPayment(principal, annualRate, years);
let balance = principal;
const schedule = [];
for (let month = 1; month <= n; month++) {
const interest = balance * r;
const principalPaid = monthly - interest;
balance -= principalPaid;
schedule.push({
month,
payment: monthly,
interest: Math.round(interest * 100) / 100,
principal: Math.round(principalPaid * 100) / 100,
balance: Math.max(0, Math.round(balance * 100) / 100),
});
}
return schedule;
}
Python:
def calculate_loan_payment(principal: float, annual_rate: float, years: int) -> float:
"""Returns the monthly payment amount."""
r = annual_rate / 100 / 12
n = years * 12
if r == 0:
return round(principal / n, 2)
monthly = principal * (r * (1 + r) ** n) / ((1 + r) ** n - 1)
return round(monthly, 2)
payment = calculate_loan_payment(20000, 6, 4)
print(f"Monthly payment: €{payment}") # €469.7
How interest rate affects total cost
The interest rate has a dramatic effect on the total amount you pay. Here's the same €20,000 loan over 4 years at different rates:
| Annual Rate | Monthly Payment | Total Interest |
|---|---|---|
| 3% | €442.88 | €1,258.24 |
| 6% | €469.70 | €2,545.60 |
| 9% | €497.70 | €3,889.60 |
| 12% | €527.00 | €5,296.00 |
| 15% | €557.00 | €6,736.00 |
Going from 3% to 15% increases the total interest paid by more than 5×. This is why shopping around for the best interest rate matters much more than negotiating small changes to the purchase price.
How loan term affects total cost
Longer loans mean lower monthly payments but more total interest:
| Term | Monthly Payment | Total Paid | Total Interest |
|---|---|---|---|
| 2 years (24 months) | €887.89 | €21,309.36 | €1,309.36 |
| 3 years (36 months) | €608.44 | €21,903.84 | €1,903.84 |
| 4 years (48 months) | €469.70 | €22,545.60 | €2,545.60 |
| 5 years (60 months) | €386.66 | €23,199.60 | €3,199.60 |
(€20,000 at 6% annual rate)
A 5-year loan has a 55% lower monthly payment than a 2-year loan but pays nearly 2.5× as much interest.
How to reduce total interest paid
1. Make extra payments toward principal. Any extra money you pay directly reduces the principal balance, which means less interest compounds going forward. Even small extra payments early in the loan can save significant interest.
2. Choose a shorter term. A 3-year loan vs. a 5-year loan saves nearly €1,300 in interest (in the example above) at the cost of higher monthly payments.
3. Refinance when rates drop. If interest rates fall significantly after you take out a loan, refinancing can reduce both your payment and your total interest — though closing costs need to be factored in.
4. Make a larger down payment. Reducing the principal (P in the formula) directly reduces both the monthly payment and total interest. A 20% down payment instead of 10% can save thousands over the life of a mortgage.
APR vs. interest rate
The interest rate is the cost of borrowing expressed as a percentage of the principal.
The APR (Annual Percentage Rate) includes the interest rate plus other fees — origination fees, closing costs, insurance — expressed as a single annual percentage. APR gives you a more complete picture of the true cost of a loan.
When comparing loans, compare APRs, not just interest rates. A loan with a 5.5% interest rate and significant fees might actually cost more than one with a 6% rate and no fees.
Calculate your loan online
Use the Loan Calculator to calculate your exact monthly payment, total interest, and full amortization schedule. Enter the loan amount, annual interest rate, and term — and see the complete breakdown instantly.
FAQ
Q: What happens if I make extra payments? Extra payments reduce your principal faster, which means every subsequent payment has less interest. You'll pay off the loan earlier and save on total interest. Many loan agreements allow this without penalty — check your terms.
Q: Is there a simple way to estimate a mortgage payment? A rough rule: for a 30-year mortgage at 7%, the monthly payment is about $6.65 per $1,000 borrowed. So a $300,000 mortgage would be approximately $300 × $6.65 = $1,995/month (principal and interest only, excluding taxes and insurance).
Q: What is an interest-only loan? In an interest-only loan, your monthly payment covers only the interest — nothing reduces the principal. After the interest-only period ends, payments jump significantly because now you're paying interest plus the full principal in fewer months. These can be risky if property values fall or if you can't handle the higher payments later.
Q: Does the formula work for mortgages? Yes, the same formula applies to fixed-rate mortgages. The complexity of mortgages comes from additional costs: property taxes, homeowner's insurance, and potentially PMI (private mortgage insurance), which are often bundled into the monthly payment but aren't part of the loan calculation itself.