Core Amortisation Formula
Where M = monthly principal & interest payment, P = loan principal ($), r = monthly interest rate (annual rate ÷ 12 ÷ 100), and n = total number of payments (term in years × 12).
This is the standard US fixed-rate mortgage annuity formula used by CFPB tools, Freddie Mac, and all major lenders. It produces the constant monthly payment that fully amortises the loan over the stated term at a fixed interest rate.
Remaining Balance (Closed-Form)
This closed-form expression calculates the remaining principal balance after any number of payments n without iterating through each payment individually. It is algebraically equivalent to a month-by-month loop and is used throughout this calculator for instant, zero-latency balance lookups.
Break-Even Calculation
Monthly savings = Old monthly P&I − New monthly P&I. Break-even is only calculated when closing costs are paid out-of-pocket. When closing costs are financed into the loan, no upfront cash is required — the calculator instead shows the incremental lifetime interest cost of financing those closing dollars.
True Total Cost Comparison (Exit Decision)
This nominal cash-flow comparison includes the remaining loan balance because it is repaid in full from sale proceeds — a real dollar outflow. Including it creates an apples-to-apples comparison between a shorter-term Path A and a longer-term Path B, regardless of their differing amortisation schedules. This is the same methodology used by CFPB consumer tools and leading mortgage rate comparison platforms.
Indicative Net Proceeds Ledger
Agent commission is applied to sale price (post-NAR settlement default: 3.0% listing-agent only). Loan discharge fee: flat $300 estimate (range $75–$500+ by state). Per diem interest: balance × (annual rate ÷ 365) × 15 days. Prepayment penalty (conventional only): max 2% of balance in loan years 1–2, max 1% in year 3, $0 thereafter per Dodd-Frank §1026.43(g). FHA, VA, USDA, and physician loans: $0 penalty by law or program design. All figures are pre-tax estimates.
Performance: All calculations execute as pure client-side JavaScript functions with no network requests. DOM updates are synchronous and target fewer than 40 element writes per interaction, keeping Interaction to Next Paint (INP) comfortably below Google's 200ms threshold on all modern devices. No frameworks, no build step, no external data dependencies beyond the Chart.js rendering library.