{
  "schemaVersion": 1,
  "slug": "debt-payoff-calculator",
  "category": "finance",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "4c7c88f2b81d6783ed761eef8254da556c0c5138ca37078cf66b1f0b260baaa3",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/debt-payoff-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": "i = APR ÷ 1200; B_{k+1} = B_k(1 + i) − P",
    "vars": [
      [
        "APR",
        "Annual percentage rate"
      ],
      [
        "i",
        "Monthly rate"
      ],
      [
        "P",
        "Monthly payment"
      ],
      [
        "B_k",
        "Balance in month k"
      ],
      [
        "n",
        "Months to payoff"
      ]
    ],
    "note": "Iterate from B₀ = total debt until B_k ≤ 0.01 (max 1200 months). If P ≤ B_k×i the balance never falls — payment too small; totals accumulate interest and amounts paid."
  },
  "externalEvidence": {
    "reviewedAt": "2026-09-28",
    "sources": [
      {
        "name": "CFPB — Paying more than the minimum on credit cards",
        "url": "https://files.consumerfinance.gov/f/documents/cfpb_adult-fin-ed_paying-more-than-minimum_bookmark.pdf"
      }
    ]
  },
  "contract": {
    "compute": "if(![totalDebt,apr,monthlyPayment].every(Number.isFinite)||totalDebt<0||apr<0||apr>100||monthlyPayment<1)return {months:null,years:null,totalInterest:null,totalPaid:null,__error:'inputError'};const i=apr/100/12; let bal=totalDebt, months=0, interest=0, paid=0; while(bal>0.01 && months<1200){ const int=bal*i; if(monthlyPayment<=int) return { months:null, years:null, totalInterest:null, totalPaid:null, __error:'paymentTooLow' }; interest+=int; bal+=int; const pay=Math.min(monthlyPayment,bal); paid+=pay; bal-=pay; months++; } if(bal>0.01) return { months:null, years:null, totalInterest:null, totalPaid:null, __error:'payoffHorizon' }; return { months, years:months/12, totalInterest:interest, totalPaid:paid };",
    "inputs": [
      {
        "name": "totalDebt",
        "type": "number",
        "default": 15000,
        "min": 0,
        "max": 100000000,
        "step": 100
      },
      {
        "name": "apr",
        "type": "number",
        "default": 18,
        "min": 0,
        "max": 100,
        "step": 0.01
      },
      {
        "name": "monthlyPayment",
        "type": "number",
        "default": 400,
        "min": 1,
        "max": 10000000,
        "step": 10
      }
    ],
    "outputs": [
      {
        "name": "months",
        "precision": 0,
        "unit": "months"
      },
      {
        "name": "years",
        "precision": 2,
        "unit": "years"
      },
      {
        "name": "totalInterest",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "totalPaid",
        "precision": 2,
        "unit": "$"
      }
    ],
    "interpret": null
  }
}
