Debt Payoff Calculator Formula

Understand the math behind the debt payoff calculator. Each variable explained with a worked example.

Formulas Used

Months to Pay Off

months_to_payoff = monthly_rate > 0 ? ceil(-log(1 - monthly_rate * debt_amount / monthly_payment) / log(1 + monthly_rate)) : ceil(debt_amount / monthly_payment)

Total Paid

total_paid = months_to_payoff * monthly_payment

Total Interest

total_interest = total_paid - debt_amount

Variables

VariableDescriptionDefault
debt_amountTotal Debt(USD)15000
annual_rateInterest Rate(%)12
monthly_paymentMonthly Payment(USD)400
monthly_rateDerived value= annual_rate / 12 / 100calculated

How It Works

Debt Payoff Formula

Months = -log(1 - r × D / P) / log(1 + r)

Where D = debt, P = monthly payment, r = monthly rate. Payment must exceed monthly interest (D × r) for the debt to decrease.

Worked Example

$15,000 debt at 12% APR with $400 monthly payments.

debt_amount = 15000annual_rate = 12monthly_payment = 400
  1. 01Monthly rate = 12% / 12 = 1%
  2. 02Months = -log(1 - 0.01 × 15000 / 400) / log(1.01)
  3. 03= -log(0.625) / 0.00995 = 47.2 → 48 months (4 years)
  4. 04Total paid = 48 × $400 = $19,200
  5. 05Total interest = $19,200 - $15,000 = $4,200

Ready to run the numbers?

Open Debt Payoff Calculator