{
  "schemaVersion": 1,
  "slug": "amortization-calculator",
  "category": "finance",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "7b7746066d39c6e82ad226b70dee6bdeafda152e5abaf05529e2474cb5ad1d0d",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/amortization-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "M = P × r × (1 + r)^n ÷ ((1 + r)^n − 1)",
    "vars": [
      [
        "M",
        "monthly payment"
      ],
      [
        "P",
        "loan principal"
      ],
      [
        "r",
        "monthly interest rate"
      ],
      [
        "n",
        "number of payments"
      ]
    ],
    "note": "r = annual % ÷ 100 ÷ 12; n = years × 12."
  },
  "externalEvidence": {
    "reviewedAt": "2026-09-28",
    "sources": [
      {
        "name": "CFPB — How mortgage lenders calculate monthly payments",
        "url": "https://www.consumerfinance.gov/ask-cfpb/how-do-mortgage-lenders-calculate-monthly-payments-en-1965/"
      }
    ]
  },
  "contract": {
    "compute": "const r=rate/100/12, n=years*12; const m = r && n ? principal*r*Math.pow(1+r,n)/(Math.pow(1+r,n)-1) : (n?principal/n:0); return { monthly:m, total:m*n, interest:m*n-principal, payments:n };",
    "inputs": [
      {
        "name": "principal",
        "type": "number",
        "default": 200000,
        "min": 0,
        "max": 100000000,
        "step": 1000
      },
      {
        "name": "rate",
        "type": "number",
        "default": 5,
        "min": 0,
        "max": 100,
        "step": 0.01
      },
      {
        "name": "years",
        "type": "number",
        "default": 30,
        "min": 1,
        "max": 50,
        "step": 1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "monthly",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "total",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "interest",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "payments",
        "precision": 0,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
