“Code for interest payment” can mean a formula or a calculator expression. For a fixed-rate loan with equal monthly payments, use the standard amortizing-payment formula below: enter the loan amount, annual percentage rate (APR), and term to calculate the monthly payment and total interest.
Formula
The monthly payment formula is:
PMT = round(P × r / (1 − (1 + r)−n), 2)
Here, P is the starting loan principal in dollars, r is the monthly interest rate as a decimal, and n is the number of monthly payments. Convert an APR quoted as a percentage per year to a monthly decimal by dividing by 1,200: r = APR / 1200. For a term in years, n = years × 12. The calculator rounds each monthly payment to cents.
Total interest over the full scheduled term is calculated as Interest = PMT × n − P. This subtracts the amount originally borrowed from the sum of the rounded scheduled payments. It assumes every payment is made as scheduled and does not include separate charges.
Worked Example
Using the calculator’s defaults, the principal is $20,000, APR is 8%, and the term is 5 years.
- Convert the APR to a monthly rate:
r = 8 / 1200 = 0.0066667. - Convert the term to payments:
n = 5 × 12 = 60. - Substitute into the payment formula:
PMT = round(20000 × 0.0066667 / (1 − (1.0066667)−60), 2). - The monthly payment is $405.53.
- Total interest is
$405.53 × 60 − $20,000 = $4,331.80.
Both outputs use the payment rounded to the cent, so the total reflects 60 payments of $405.53 rather than an unrounded theoretical payment.
Assumptions
- The interest rate stays fixed throughout the term.
- Payments are equal and made monthly, at the end of each monthly period.
- Interest accrues monthly using the APR divided by 12; the APR is treated as a nominal annual rate.
- Fees, taxes, insurance, PMI, escrow, late charges, and optional extra payments are not included.
What the Interest Payment Formula Means
A loan payment is usually made up of both interest and principal. Early in an amortizing loan, the balance is larger, so more of a level payment goes toward interest. As principal is repaid, the interest portion generally falls and the principal portion rises. The payment itself stays level under the assumptions above.
The formula solves for a payment that brings the balance to zero after the selected number of periods, assuming the stated rate and payment timing. It is different from simple interest, which may be calculated as principal multiplied by rate and time. Simple interest alone does not determine the equal payment on a loan that is repaid gradually, because the outstanding balance changes as payments are made.
When to Use This Calculator
Use this calculation to estimate the scheduled payment and interest for a fixed-rate loan with regular monthly payments. It can also help you understand how the principal, rate, and term enter the calculation. The APR and term are inputs: obtain the figures that apply to a particular loan from its lender or disclosure rather than treating the example values as a quote.
- Enter the amount borrowed, not a monthly payment or a total repayment amount.
- Enter APR as a percentage, such as
8for 8%, not as0.08. - Enter the term in years. The formula converts it to months.
- Read the first result as the estimated scheduled monthly payment and the second as total interest across all scheduled payments.
The calculator accepts APR values from 0.01% to 100% and terms from 0.0833 to 50 years, within its stated input limits. A real loan may use a different payment schedule or include costs that the calculation does not model.
Common Misunderstandings and Limits
A payment estimate is not necessarily the full amount due each month. If a loan has fees, insurance, taxes, or other charges, those may be billed separately or handled differently. This calculator does not estimate those items. It also does not calculate a changing-rate payment, irregular payment dates, a balloon balance, or the effect of additional payments.
Rounding matters. The formula rounds the monthly payment to cents, then uses that rounded figure to calculate total interest. A lender may adjust the final payment slightly to clear a small remaining balance created by rounding or actual transaction timing. The displayed total is therefore a formula-based estimate, not a loan payoff statement.
Another common misconception is that APR divided by 12 always reproduces every detail of a lender’s interest calculation. This page uses that monthly-rate convention for a standard fixed-rate estimate. Contract terms, day-count methods, fees included in APR, and payment processing can make an actual schedule differ. For a balance or payoff figure on a specific date, the loan’s payment history and lender calculation are also needed.
Frequently Asked Questions
What is the code for calculating a monthly interest payment?
The standard fixed-payment expression is P × r / (1 − (1 + r)−n), where r is the monthly rate and n is the number of monthly payments. Round the result to cents for a payment estimate.
How do I convert APR to a monthly interest rate?
For this formula, divide the APR percentage by 1,200. For example, an APR of 8% gives a monthly decimal rate of about 0.006667.
Does the monthly payment include all interest?
It includes the scheduled principal and interest under the formula’s assumptions. It does not include separate fees, taxes, insurance, or other charges.
Why is the total interest not exactly the payment before rounding times the term?
This calculator rounds the monthly payment to cents first, then multiplies that amount by the number of payments and subtracts the principal. Rounding can produce a small difference from calculations that retain extra decimal places.
Can I use this for a variable-rate loan?
Not as a complete schedule. The calculation assumes one fixed rate for the entire term; a changing rate can change the payment or the amount of interest paid.
This result is an estimate; the lender’s disclosure gives the exact figures.
Related
Formula used
in p | Loan amount | $ | 20000 | 1 | 100000000 in apr | Interest rate (APR) | % | 8 | 0.01 | 100 in yrs | Loan term | years | 5 | 0.0833 | 50 out pmt | Monthly payment | $ | round(p * (apr / 1200) / (1 - (1 + apr / 1200) ^ -(yrs * 12)), 2) | 2 out int | Total interest | $ | pmt * yrs * 12 - p | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard loan formula for this calculation, fixed rate and monthly compounding unless stated, rounded as each result states. Not financial advice; no lender, rate or product is recommended. See formulas and assumptions, the disclaimer or report an error.
More in this section
- Weekly Payment Sheet: Calculate Loan Payments$93.39
- Weekly Payment Schedule Calculator$93.39
- Weekly Loan Payment Calculator and Formula$93.39
- Weekly Payment Run: Meaning and How It Works
- DXC Weekly Payment Reimbursement Request Form
- Weekly Payment Reimbursement Request Form Explained