Debt Payoff Calculator
Debt Information
Summary
Initial Balance
$10,000
APR
21.0%
Monthly Payment
$300
Payoff Time
-
Total Interest Paid
$0
Payoff Rating
-
Debt Payoff Progress Chart
Enter debt information to see payoff chart
+ (minPayment * 1.05).toFixed(2)); return []; } } while (balance > 0.01 && month < 600) { // 50 year maximum month++; const interestPayment = balance * monthlyRate; const principalPayment = Math.min(monthlyPayment - interestPayment, balance); const actualPayment = interestPayment + principalPayment; balance -= principalPayment; totalInterestPaid += interestPayment; schedule.push({ month: month, paymentAmount: actualPayment, interestPaid: interestPayment, principalPaid: principalPayment, remainingBalance: Math.max(0, balance), totalInterest: totalInterestPaid }); if (balance <= 0.01) break; } return schedule; } function updateDisplay() { const initialBalance = parseFloat(document.getElementById('initialBalance').value) || 0; const apr = parseFloat(document.getElementById('apr').value) || 0; const monthlyPayment = parseFloat(document.getElementById('monthlyPayment').value) || 0; const schedule = calculateSchedule(); // Update summary document.getElementById('summaryBalance').textContent = '$' + initialBalance.toLocaleString(); document.getElementById('summaryAPR').textContent = apr.toFixed(1) + '%'; document.getElementById('summaryPayment').textContent = '$' + monthlyPayment.toLocaleString(); if (schedule.length > 0) { const months = schedule.length; const years = Math.floor(months / 12); const remainingMonths = months % 12; let timeText = months + ' months'; if (years > 0) { timeText += ` (${years} year${years > 1 ? 's' : ''}`; if (remainingMonths > 0) { timeText += ` ${remainingMonths} month${remainingMonths > 1 ? 's' : ''}`; } timeText += ')'; } document.getElementById('payoffTime').textContent = timeText; document.getElementById('totalInterest').textContent = '$' + Math.round(schedule[schedule.length - 1].totalInterest).toLocaleString(); // Update rating updatePayoffRating(initialBalance, schedule[schedule.length - 1].totalInterest, months); } else { document.getElementById('payoffTime').textContent = '-'; document.getElementById('totalInterest').textContent = '$0'; document.getElementById('payoffRating').textContent = '-'; const ratingCard = document.getElementById('ratingCard'); ratingCard.className = 'stat-card'; } // Update chart updateChart(schedule, initialBalance); } function updatePayoffRating(initialBalance, totalInterest, months) { const interestRatio = totalInterest / initialBalance; const ratingCard = document.getElementById('ratingCard'); let rating, ratingClass; if (interestRatio < 0.15 && months <= 24) { rating = 'Excellent 🌟'; ratingClass = 'rating-excellent'; } else if (interestRatio < 0.30 && months <= 36) { rating = 'Good 👍'; ratingClass = 'rating-good'; } else if (interestRatio < 0.50 && months <= 60) { rating = 'Fair ⚠️'; ratingClass = 'rating-fair'; } else { rating = 'Poor 😟'; ratingClass = 'rating-poor'; } document.getElementById('payoffRating').textContent = rating; ratingCard.className = `stat-card ${ratingClass}`; } function updateChart(schedule, initialBalance) { const chartContainer = document.getElementById('chartContainer'); if (schedule.length === 0 || initialBalance <= 0) { chartContainer.innerHTML = '
Enter debt information to see payoff chart
'; return; } // Create chart HTML let chartHTML = '
Remaining Balance Over Time
'; // Y-axis labels chartHTML += '
'; for (let i = 0; i <= 5; i++) { const value = initialBalance * (1 - i / 5); chartHTML += `
${Math.round(value).toLocaleString()}
`; } chartHTML += '
'; // Chart content container chartHTML += '
'; // Create bars - sample the data for better visualization const maxBars = 50; const step = Math.max(1, Math.ceil(schedule.length / maxBars)); for (let i = 0; i < schedule.length; i += step) { const point = schedule[i]; const heightPercent = (point.remainingBalance / initialBalance) * 100; chartHTML += `
`; } chartHTML += '
'; // Close chart-content // X-axis labels chartHTML += '
'; chartHTML += '
Start
'; chartHTML += `
${Math.floor(schedule.length/2)} months
`; chartHTML += `
${schedule.length} months
`; chartHTML += '
'; chartContainer.innerHTML = chartHTML; } function exportToCSV() { const schedule = calculateSchedule(); if (schedule.length === 0) { alert('Please enter valid debt information to export schedule'); return; } const initialBalance = parseFloat(document.getElementById('initialBalance').value); const apr = parseFloat(document.getElementById('apr').value); let csv = 'Initial Balance,APR,Month,Payment Amount,Interest Paid,Principal Paid,Remaining Balance,Total Interest Paid\n'; schedule.forEach((row, index) => { const initialBal = index === 0 ? initialBalance : ''; const aprVal = index === 0 ? apr + '%' : ''; csv += `${initialBal},${aprVal},${row.month},$${row.paymentAmount.toFixed(2)},$${row.interestPaid.toFixed(2)},$${row.principalPaid.toFixed(2)},$${row.remainingBalance.toFixed(2)},$${row.totalInterest.toFixed(2)}\n`; }); const blob = new Blob([csv], { type: 'text/csv' }); const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'debt-payoff-schedule.csv'; a.click(); window.URL.revokeObjectURL(url); } // Event listeners document.getElementById('initialBalance').addEventListener('input', updateDisplay); document.getElementById('apr').addEventListener('input', updateDisplay); document.getElementById('monthlyPayment').addEventListener('input', updateDisplay); // Initial calculation updateDisplay();
Debt Payoff Calculator
Debt Information
Summary
Initial Balance
$10,000
APR
21.0%
Monthly Payment
$300
Payoff Time
-
Total Interest Paid
$0
Payoff Rating
-
Debt Payoff Progress Chart
Enter debt information to see payoff chart

Hello, World!