Skip to content

Bullrun-Forever/debt-payment-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Debt Payment Calculator

Free, open-source loan payment estimator with amortization, affordability analysis, and support for 6 loan types.

Estimate monthly payments before borrowing — see the true total cost including all interest for mortgages, auto loans, personal loans, credit cards, student loans, and home equity loans.

Live Demo License: MIT


Try the Full Version

Use the Debt Payment Calculator on BullRun Forever Tools — includes interactive charts, affordability analysis, CSV export, and dark mode.


Features

  • Monthly payment calculation for 6 loan types
  • Total interest and true cost of borrowing
  • First-year amortization schedule
  • Credit card minimum vs. recommended payment comparison
  • Debt-to-income (DTI) affordability analysis
  • Support for zero-interest loans
  • Zero dependencies — pure JavaScript math

Supported Loan Types

Loan Type Typical APR Common Term Calculation
Personal Loan 6-15% 24-60 months Fixed amortization
Auto Loan 4-10% 60 months Fixed amortization
Mortgage 6-8% 360 months (30yr) Fixed amortization
Credit Card 15-25% Revolving Minimum + recommended
Student Loan 4-7% 120 months (10yr) Fixed amortization
Home Equity 6-9% 120-180 months Fixed amortization

Quick Start

npm install
npm run dev

Open http://localhost:5173 to use the calculator locally.


The Math

Installment Loan Payment Formula

For fixed-payment loans (mortgages, auto, personal, student, home equity):

M = P × [r(1 + r)^n] / [(1 + r)^n - 1]

Where:

  • M = Monthly payment
  • P = Principal (loan amount)
  • r = Monthly interest rate (APR / 12 / 100)
  • n = Total number of payments (term in months)

Special case — zero interest: M = P / n

Example: $30,000 Auto Loan at 6% for 60 months

Step 1: Monthly rate
  r = 6 / 12 / 100 = 0.005

Step 2: (1 + r)^n
  (1.005)^60 = 1.34885

Step 3: Monthly payment
  M = $30,000 × [0.005 × 1.34885] / [1.34885 - 1]
  M = $30,000 × 0.006744 / 0.34885
  M = $579.98

Step 4: Total cost
  Total Paid = $579.98 × 60 = $34,798.80
  Total Interest = $34,798.80 - $30,000 = $4,798.80
  Interest as % of loan = 16.0%

Credit Card Minimum Payment

Credit cards use revolving credit — no fixed term:

Minimum Payment = MAX(Balance × 2%, $25)

Example:

$5,000 balance: MAX($5,000 × 0.02, $25) = $100/month
$800 balance:   MAX($800 × 0.02, $25) = $25/month

Credit Card Payoff Time

How long it takes to pay off with a given payment:

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

Example: $5,000 at 18% APR, $100 minimum payment

r = 18 / 12 / 100 = 0.015
Months = -log(1 - (5000 × 0.015) / 100) / log(1.015)
Months = 93 months (7.75 years!)
Total Interest: ~$4,300

With a recommended $180/month payment instead:

Months = 36 months (3 years)
Total Interest: ~$1,495
Savings: $2,805!

Amortization Schedule

Each monthly payment splits between principal and interest:

Interest Payment  = Remaining Balance × Monthly Rate
Principal Payment = Total Payment - Interest Payment
New Balance       = Old Balance - Principal Payment

First year of a $200,000 mortgage at 7% (30yr):

Month Payment Principal Interest Balance
1 $1,330.60 $163.93 $1,166.67 $199,836
2 $1,330.60 $164.89 $1,165.71 $199,671
3 $1,330.60 $165.85 $1,164.75 $199,505
... ... ... ... ...
12 $1,330.60 $175.13 $1,155.47 $197,969

In year 1, 87% of payments go to interest.

Affordability (DTI Ratio)

DTI = (Monthly Payment / Monthly Income) × 100
DTI Ratio Rating Guidance
< 15% Excellent Very affordable
15-28% Good Manageable
28-36% Caution Stretched budget
> 36% Warning May be too burdensome

Key Formulas

Calculation Formula
Monthly Payment (installment) P × [r(1+r)^n] / [(1+r)^n-1]
Monthly Payment (0% interest) P / n
Credit Card Minimum MAX(balance × 0.02, $25)
Payoff Time (credit card) -log(1-(P×r)/M) / log(1+r)
Total Paid monthlyPayment × months
Total Interest totalPaid - principal
Interest % (totalInterest / principal) × 100
DTI Ratio (payment / income) × 100
Monthly Interest balance × (APR / 12 / 100)
Principal Payment totalPayment - interestPayment

Usage (JavaScript)

import {
  calculateMonthlyPayment,
  calculateCreditCardMinimum,
  calculateAmortization,
  calculateAffordability
} from './src/calculator.js';

// Auto loan
const payment = calculateMonthlyPayment(30000, 6, 60);
console.log(payment); // $579.98

// Credit card minimum
const minimum = calculateCreditCardMinimum(5000);
console.log(minimum); // $100

// Full amortization schedule (first 12 months)
const schedule = calculateAmortization(30000, 579.98, 6, 60, 12);
console.log(schedule); // Array of monthly payment breakdowns

// Affordability check
const dti = calculateAffordability(579.98, 4000);
console.log(dti); // { ratio: 14.5, rating: 'excellent', message: '...' }

Output Objects

// calculateMonthlyPayment returns a number (the monthly payment amount)

// calculateAmortization returns:
[
  {
    month: number,
    payment: number,
    principal: number,     // Principal portion
    interest: number,      // Interest portion
    balance: number        // Remaining balance
  }
]

// calculateAffordability returns:
{
  ratio: number,           // DTI percentage
  rating: string,          // 'excellent' | 'good' | 'caution' | 'warning'
  message: string          // Human-readable guidance
}

True Cost Comparison

$10,000 Personal Loan

Option Rate Term Monthly Total Interest Total Paid
A 8% 3 years $313 $1,281 $11,281
B 8% 5 years $203 $2,166 $12,166

Lower monthly payment costs $885 more in total interest.

$20,000 Auto Loan

Option Rate Term Monthly Total Interest
A 5% 48 months $460 $2,100
B 7% 60 months $396 $3,761

$64/month savings costs $1,661 more over the life of the loan.


FAQ

How is my monthly payment calculated? Using the standard amortization formula. Each payment covers that month's interest plus some principal. Early payments are mostly interest; later payments are mostly principal.

How much of my income should go to debt? Keep your total debt-to-income ratio below 36%. Individual loans should ideally be under 15% of monthly income.

Should I choose a longer term for lower payments? Lower payments = more total interest. A $25,000 loan at 7%: 5 years costs ~$5,000 interest, 7 years costs ~$8,000. Choose the shortest term you can afford.

Why do credit cards cost so much? Minimum payments (2-3% of balance) barely cover interest. A $5,000 balance at 18% takes 7+ years with minimums vs. 3 years with accelerated payments.


More Free Financial Tools

This calculator is part of the BullRun Forever Toolkit — 16 free financial calculators including:


License

MIT License — use freely in your own projects.


Disclaimer

This calculator is for educational and informational purposes only. It is not financial advice. Actual loan terms, rates, and payments may vary based on lender, credit score, and other factors. Always review loan documents carefully before borrowing.


Built by BullRun Forever
Free financial tools for everyone.

About

Free loan payment calculator with amortization schedules, DTI affordability analysis, and support for mortgages, auto loans, credit cards, and more.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors