Student Loan Payoff Calculator
Calculate how long it will take to pay off your student loans and how much you need to pay monthly to clear your debt in a desired time.
function calculateLoan() {
const loanAmount = parseFloat(document.getElementById(“loanAmount”).value);
const interestRate = parseFloat(document.getElementById(“interestRate”).value) / 100 / 12;
const loanTerm = parseFloat(document.getElementById(“loanTerm”).value) * 12;
const extraPayment = parseFloat(document.getElementById(“extraPayment”).value);
if (isNaN(loanAmount) || isNaN(interestRate) || isNaN(loanTerm) || isNaN(extraPayment) || loanAmount <= 0 || interestRate <= 0 || loanTerm 0) {
remainingBalance = remainingBalance * (1 + interestRate) – totalMonthlyPayment;
months++;
}
const years = (months / 12).toFixed(2);
document.getElementById(“monthlyPayment”).value = totalMonthlyPayment.toFixed(2);
document.getElementById(“payoffTime”).value = years;
}
function resetLoan() {
document.querySelectorAll(“#calculator input”).forEach(el => el.value = “”);
}