How the monthly payment formula works

Every calculator on this site that prints a monthly payment — the Mortgage Calculator, the Loan Calculator among them — gets that figure from one function. It takes a loan amount, an annual rate and a term in years, and returns the fixed monthly amount that retires the loan exactly at the last payment. This guide sets out the formula as the engine evaluates it, how the result moves with the rate and the term, and where it stops. It is part of the guides collection; the methodology page states the conventions it rests on.

Every figure below is computed when this page is built, by the same engine that runs in your browser on the calculator pages, from inputs invented for the example: a fictional $250,000 loan at 6.75% over 30 years. No rate or amount on this page is a market figure or a quote. If the prose and the engine ever disagreed, the site would fail to build.

What the formula takes in

The payment function reads a loan amount in dollars, a rate as an annual percentage and a term in years, and validates all three before any arithmetic runs: the amount must be greater than zero, the rate cannot be negative, the term must be positive, and each must sit inside the engine's supported range. A value that fails comes back as an explicit, human-readable error rather than a number; the engine never returns NaN or infinity. The methodology page states the convention in one sentence: payments use the standard amortized-loan (PMT) formula with monthly compounding, the convention behind US mortgages and most consumer loans. Monthly compounding means the annual rate is divided by twelve to give a monthly rate — 6.75% ÷ 12, or 0.005625 as a decimal. The term is handled as the methodology page's list of constants and limits puts it: years × 12, rounded to a whole number of months before anything else runs — 360 payments here.

The formula, as the engine evaluates it

payment = loan amount × [ r × (1 + r)n ] ÷ [ (1 + r)n − 1 ]
where r = annual rate ÷ 100 ÷ 12 and n = years × 12

The bracketed part is the payment factor: the monthly payment owed per dollar borrowed at this rate and term. The engine computes it once and multiplies by the loan amount, which is why the payment is exactly proportional to the principal. Evaluated step by step for the example:

  1. Monthly rate. r = 6.75 ÷ 100 ÷ 12 = 0.005625.
  2. Growth over the term. (1 + r)n = (1 + 0.005625)360 = 7.5332 — one dollar compounded monthly at the loan's rate for the whole term.
  3. Payment factor. r × 7.5332 ÷ (7.5332 − 1) = 0.006486 per dollar, or $6.49 per $1,000 borrowed.
  4. Payment. $250,000 × 0.006486 = $1,621.50.

This page re-checks the last step when it is built: the loan amount times the factor above equals the engine's own payment to the cent. Over the term the 360 payments sum to $583,738, of which $250,000 is the loan and $333,738 is interest — the two totals the calculators print beneath the payment, taken from the month-by-month schedule and checked here against the multiplication.

Month one, and why no other payment works

The payment is fixed, but what it does changes every month, by the rule the methodology page states: a fixed monthly payment covers the interest accrued on the balance that month, and the remainder reduces the principal. In month one the balance is the entire $250,000, so interest is $250,000 × 0.005625 = $1,406.25, and the remaining $215.25 of the $1,621.50 payment brings the balance to $249,784.75; 86.7% of the first payment is interest. In month two the same payment arrives, but interest on the smaller balance is $1,405.04, so $216.46 reaches principal — $1.21 more than the month before. Repeated 360 times, that drift carries the balance to zero in the final month. The formula is the one value of the payment for which it does so exactly: a smaller payment would leave a balance at month 360, a larger one would clear it early. The engine computes the schedule one month at a time so extra payments and payoff dates are exact; How Mortgage Amortization Actually Works follows it year by year, and the Amortization Calculator prints it for any inputs.

What changes with the term

Holding the loan and the rate fixed, a longer term spreads the principal over more payments, but every added month is another month of interest on a balance that falls more slowly. The table runs the example loan at 6.75% over the five terms the Mortgage Calculator offers; every cell is an engine output.

The example loan by term (fictional inputs)
Term Payments Monthly payment Total interest Total of payments
10 years 120 $2,870.60 $94,472 $344,472
15 years 180 $2,212.27 $148,209 $398,209
20 years 240 $1,900.91 $206,218 $456,218
25 years 300 $1,727.28 $268,184 $518,184
30 years 360 $1,621.50 $333,738 $583,738

Doubling the term from 15 to 30 years does not halve the payment: it falls from $2,212.27 to $1,621.50, a reduction of 26.7%, while total interest rises from $148,209 to $333,738. The engine reports the figures; whether a higher payment for fewer years fits a household's budget is not a question the arithmetic answers.

What changes with the rate

The rate enters the formula only through r, and it enters non-linearly. The grid holds the example loan fixed: the rates are fictional, one percentage point either side of the example's 6.75%, and the terms are the same five.

Monthly payment on the example loan by rate and term (fictional inputs)
Rate 10 years15 years20 years25 years30 years
5.75% $2,744.23$2,076.03$1,755.21$1,572.77$1,458.93
6.75% $2,870.60$2,212.27$1,900.91$1,727.28$1,621.50
7.75% $3,000.27$2,353.19$2,052.37$1,888.32$1,791.03

At 30 years, one percentage point moves the example payment from $1,621.50 up to $1,791.03 or down to $1,458.93 — $169.54 a month one way, $162.56 the other. The two steps are not equal; that is the non-linearity. Doubling the rate to a fictional 13.5% returns $2,863.53, not twice $1,621.50. Doubling the loan, by contrast, is exact: $500,000 at the same rate and term returns $3,242.99, precisely twice the example, and this page checks that identity at build time.

The reference figure, recomputed

The methodology page names the figure the engine is validated against: a $200,000 loan at 6% over 30 years. Recomputed here when this page is built, the same function returns a payment of $1,199.10 and total interest of $231,676, matching the figures the methodology page and the automated tests expect. The formula above, with r = 6% ÷ 12 and n = 360, is the whole of that calculation.

Two cases the engine handles separately

A rate of zero. The general formula divides by (1 + r)n − 1, which is zero when r is zero, so the engine takes a separate branch: a 0% rate divides the principal evenly across the term. A fictional $24,000 loan at 0% over 4 years returns $500.00 a month, which is $24,000 ÷ 48.

A term that is not a whole number of years. The Loan Calculator's term field accepts decimals, and the engine rounds years × 12 to the nearest whole month before anything else. A term of 2.5 years is 30 payments; so is 2.52 years, because 2.52 × 12 rounds to the same count, and the two return the identical payment of $9,079.58. Partial months are not modelled.

Where the formula stops

Inputs outside the engine's range come back as errors in its own words. A term of 99 years is answered with "Terms are limited to 60 years." A loan amount of $0 with "The loan amount must be greater than 0." A rate of 150% with "Enter an interest rate below 100%." and a rate of -1% with "The interest rate cannot be negative." The interface displays these verbatim; it never substitutes a number of its own.

The limits the methodology page sets for every calculator apply here. The calculators model fixed-rate, fully amortizing loans; they do not model adjustable-rate mortgages, interest-only periods, balloon payments, or negative amortization. The formula holds whatever rate you enter fixed for every month of the term — the Fixed vs. Adjustable Rate guide describes the structure this engine does not price. The payment it returns is principal and interest only: property tax, insurance, PMI, and HOA are separate lines the Mortgage Calculator adds on top, and the methodology page's limitation applies to them in full: they are estimates from the rates and amounts you enter. Real figures vary by locality, reassessment, coverage, and lender, and PMI removal timing depends on your specific loan program. Fees, points and closing costs are not in this formula either — the APR Calculator and the Mortgage Points Calculator handle those comparisons separately — and the engine does not know your lender's day-count or rounding conventions.

Reading the output

Internally, every calculation keeps the full precision of IEEE-754 double-precision arithmetic — nothing is rounded between steps. On screen, money is rounded to the cent, or to whole dollars for large totals like lifetime interest. So the $1,621.50 the calculator prints is the rounded view of a more precise value, and the total of payments is the sum of 360 unrounded payments, not the displayed payment multiplied by 360. The two differ by $1.71 here — $1,621.50 × 360 is $583,740.00 against the engine's $583,738.29 — because rounding the payment to the cent moves each of the 360 payments by up to half a cent. Your lender's figure may differ by a few cents depending on their rounding and day-count conventions — the difference is presentational, not an error.

Two misreadings, and what the engine actually computed:

  • The monthly rate typed into the annual field. The rate field expects the annual percentage; the engine does the division by twelve. Typing 0.5625 — the example's monthly rate — returns $754.85, the payment on a loan at 0.5625% a year, not on the example.
  • The first payment read as mostly fees. Nothing in the formula is front-loaded: 86.7% of the first payment is interest because interest is charged on the balance, and the balance is largest at the start.

Frequently asked questions

Why does the engine divide the annual rate by twelve?

Because payments use the standard amortized-loan (PMT) formula with monthly compounding, the convention behind US mortgages and most consumer loans. Interest for any month is the balance still owed times the annual rate ÷ 12: in the worked example, $250,000 × (6.75% ÷ 12) = $1,406.25 in month one.

What does the formula return at a 0% rate?

The general formula divides by a term that is zero when the rate is zero, so the engine takes a separate branch: a 0% rate divides the principal evenly across the term. A fictional $24,000 loan over 4 years returns $500.00 a month, which is $24,000 ÷ 48.

Does the payment change over the life of a fixed-rate loan?

The principal-and-interest payment does not — it is the one value that carries the balance to zero at the final month. What changes is the split inside it, from 86.7% interest in month one of the example toward almost all principal at the end. The engine holds whatever rate you enter fixed for every month of the term.

What does the engine do with a term that is not a whole number of years?

It rounds years × 12 to the nearest whole month before anything else runs. In the example, 2.5 years and 2.52 years both become 30 payments and return the identical $9,079.58. Partial months are not modelled.

Why might my lender's payment differ from the calculator by a few cents?

Internally the engine keeps the full precision of IEEE-754 double-precision arithmetic and rounds only on screen, to the cent, or to whole dollars for large totals like lifetime interest. Your lender's figure may differ by a few cents depending on their rounding and day-count conventions — the difference is presentational, not an error.

A calculator, not advice: the calculator models the arithmetic; it does not know your lender's terms. The figures on this page are rounded views of full-precision values — your lender's figure may differ by a few cents depending on their rounding and day-count conventions, and the difference is presentational, not an error. For consequential financial decisions, verify results independently and consult a licensed mortgage professional. See the methodology page for how every calculator on this site is built and tested, and the full list of guides.