An amortized schedule is a table that shows how a loan or debt is repaid over time. Each payment is divided into two parts: a portion that goes towards the principal (the original amount borrowed) and a portion that goes towards the interest (the cost of borrowing). As payments are made, the principal balance decreases, and consequently, the amount of interest paid in subsequent payments also decreases.
How it Works
The core of an amortization schedule lies in a formula that calculates the fixed periodic payment. This payment is designed to fully repay the loan over its term. The formula for the periodic payment (P) is:
P = [ L * r(1 + r)^n ] / [ (1 + r)^n – 1]
Where:
L = Loan Principal Amount
r = Periodic Interest Rate (Annual Rate / Payments Per Year)
n = Total Number of Payments (Loan Term in Years * Payments Per Year)
Principal Paid = Total Periodic Payment – Interest Paid
New Balance = Remaining Balance – Principal Paid
This process repeats until the balance reaches zero.
Key Components of the Schedule:
Payment #: The sequential number of the payment made.
Date: The expected date of the payment. (Note: This calculator assumes a starting date and increments by payment periods).
Payment: The fixed total amount paid each period.
Principal: The portion of the payment applied to reduce the outstanding loan balance.
Interest: The portion of the payment applied to the interest accrued since the last payment.
Balance: The remaining amount owed after the payment is applied.
Use Cases:
Amortization schedules are crucial for understanding the cost of borrowing for:
Mortgages
Auto loans
Personal loans
Student loans
Business loans
They help borrowers visualize how their debt is being paid down, how much interest they will pay over the life of the loan, and how to plan their finances accordingly.
function generateAmortizationSchedule() {
var principalAmount = parseFloat(document.getElementById("principalAmount").value);
var annualInterestRate = parseFloat(document.getElementById("annualInterestRate").value);
var loanTermYears = parseFloat(document.getElementById("loanTermYears").value);
var paymentFrequency = parseFloat(document.getElementById("paymentFrequency").value);
var errorMessageElement = document.getElementById("errorMessage");
var tableBody = document.getElementById("amortizationTable").getElementsByTagName('tbody')[0];
// Clear previous table and error messages
tableBody.innerHTML = ";
errorMessageElement.textContent = ";
// Input validation
if (isNaN(principalAmount) || principalAmount <= 0) {
errorMessageElement.textContent = 'Please enter a valid principal amount greater than zero.';
return;
}
if (isNaN(annualInterestRate) || annualInterestRate < 0) {
errorMessageElement.textContent = 'Please enter a valid annual interest rate (cannot be negative).';
return;
}
if (isNaN(loanTermYears) || loanTermYears <= 0) {
errorMessageElement.textContent = 'Please enter a valid loan term in years greater than zero.';
return;
}
if (isNaN(paymentFrequency) || paymentFrequency 0) {
monthlyPayment = principalAmount * (periodicInterestRate * Math.pow(1 + periodicInterestRate, totalNumberOfPayments)) / (Math.pow(1 + periodicInterestRate, totalNumberOfPayments) – 1);
} else {
// Handle zero interest rate case
monthlyPayment = principalAmount / totalNumberOfPayments;
}
var remainingBalance = principalAmount;
var totalInterestPaid = 0;
var totalPrincipalPaid = 0;
// Populate the amortization table
for (var i = 1; i remainingBalance) {
principalPayment = remainingBalance;
monthlyPayment = interestPayment + principalPayment;
}
remainingBalance -= principalPayment;
totalInterestPaid += interestPayment;
totalPrincipalPaid += principalPayment;
// Prevent negative balance due to minor calculation inaccuracies
if (remainingBalance -0.01) {
remainingBalance = 0;
}
var row = tableBody.insertRow();
var cellPaymentNum = row.insertCell(0);
var cellDate = row.insertCell(1);
var cellPayment = row.insertCell(2);
var cellPrincipal = row.insertCell(3);
var cellInterest = row.insertCell(4);
var cellBalance = row.insertCell(5);
cellPaymentNum.textContent = i;
// Simple date calculation for display purposes
var paymentDate = new Date(); // Assuming start date is today
paymentDate.setMonth(paymentDate.getMonth() + (i – 1));
cellDate.textContent = paymentDate.toLocaleDateString();
cellPayment.textContent = monthlyPayment.toFixed(2);
cellPrincipal.textContent = principalPayment.toFixed(2);
cellInterest.textContent = interestPayment.toFixed(2);
cellBalance.textContent = remainingBalance.toFixed(2);
}
// Update total paid and total interest
document.getElementById("result-value").textContent = (totalPrincipalPaid + totalInterestPaid).toFixed(2);
document.getElementById("result-value-interest").textContent = totalInterestPaid.toFixed(2);
// Show or hide table based on results
if (totalNumberOfPayments > 0) {
document.getElementById("amortizationTableContainer").style.display = 'block';
} else {
document.getElementById("amortizationTableContainer").style.display = 'none';
}
}