Compound interest is the mathematical phenomenon where you earn interest not only on your initial investment but also on the interest that has already accumulated. It is often referred to as "interest on interest," and it is the primary engine behind long-term wealth building.
The Compound Interest Formula
This calculator uses the standard formula for compound interest with regular monthly additions:
n: Number of times interest is compounded per year
t: Number of years the money is invested
PMT: Monthly contribution amount
Example Calculation
Imagine you start with $10,000 in a high-yield account. You contribute $500 every month for 20 years. If your average annual return is 8%, compounded monthly:
Total Principal: $130,000 ($10k initial + $120k contributions)
Total Interest Earned: $214,482
Total Final Balance: $344,482
In this scenario, your interest actually earned more than you physically saved, demonstrating the exponential growth curve that occurs in later years.
Why Compounding Frequency Matters
The more frequently interest is calculated (compounded), the faster your wealth grows. Daily compounding yields slightly more than monthly compounding, which in turn yields more than annual compounding. While the difference might seem small in the first year, it becomes significant over decades.
function calculateCompoundInterest() {
var p = parseFloat(document.getElementById('initialDeposit').value);
var pmt = parseFloat(document.getElementById('monthlyContribution').value);
var r = parseFloat(document.getElementById('annualRate').value) / 100;
var t = parseFloat(document.getElementById('investmentYears').value);
var n = parseInt(document.getElementById('compoundFrequency').value);
if (isNaN(p) || isNaN(pmt) || isNaN(r) || isNaN(t)) {
alert("Please enter valid numerical values.");
return;
}
// Amount from Principal: A = P(1 + r/n)^(nt)
var compoundPrincipal = p * Math.pow((1 + (r / n)), (n * t));
// Amount from Monthly Contributions
// Note: If n is not 12, we adjust the PMT formula to match the compounding frequency for simplicity
// A_pmt = PMT * [((1 + r/n)^(nt) – 1) / (r/12)] assuming monthly deposits
var r_monthly = r / 12;
var total_months = t * 12;
var compoundSeries = 0;
if (r_monthly === 0) {
compoundSeries = pmt * total_months;
} else {
// Correct formula for monthly contributions with n compounding per year
// We use the effective monthly rate based on the annual nominal rate
compoundSeries = pmt * (Math.pow(1 + r/n, n*t) – 1) / ( (Math.pow(1 + r/n, n/12)) – 1 );
}
var totalBalance = compoundPrincipal + compoundSeries;
var totalInvested = p + (pmt * 12 * t);
var totalInterest = totalBalance – totalInvested;
document.getElementById('totalBalance').innerText = '$' + totalBalance.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('totalPrincipal').innerText = '$' + totalInvested.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('totalInterest').innerText = '$' + (totalInterest > 0 ? totalInterest : 0).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('compoundResult').style.display = 'block';
}