Compound interest is the interest calculated on the initial principal, which also includes all of the accumulated interest from previous periods on a deposit or loan. It is the "interest on interest" effect. This makes it a powerful tool for wealth accumulation over time.
The Formula
The formula for compound interest is:
A = P (1 + r/n)^(nt)
Where:
A = the future value of the investment/loan, including interest
P = the principal investment amount (the initial deposit or loan amount)
r = the annual interest rate (as a decimal)
n = the number of times that interest is compounded per year
t = the number of years the money is invested or borrowed for
How it Works
When interest is compounded, it's added to the principal, and then the next interest calculation is based on the new, larger total. This exponential growth is why starting early and investing consistently can have such a significant impact on your long-term financial goals.
Example Calculation
Let's say you invest $10,000 (Principal) at an annual interest rate of 7% (Annual Interest Rate), compounded monthly, for 15 years.
Principal (P) = $10,000
Annual Interest Rate (r) = 7% or 0.07
Number of Years (t) = 15
Compounding Frequency (n) = 12 (monthly)
Using the formula:
A = 10000 * (1 + 0.07/12)^(12*15)
A = 10000 * (1 + 0.0058333)^180
A = 10000 * (1.0058333)^180
A ≈ 10000 * 2.8335
A ≈ $28,335
Your initial investment of $10,000 would grow to approximately $28,335 after 15 years, with about $18,335 being the accumulated compound interest.
function calculateCompoundInterest() {
var principal = parseFloat(document.getElementById("principal").value);
var annualRate = parseFloat(document.getElementById("annualRate").value);
var time = parseFloat(document.getElementById("time").value);
var compoundingFrequency = parseInt(document.getElementById("compoundingFrequency").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
if (isNaN(principal) || isNaN(annualRate) || isNaN(time) || isNaN(compoundingFrequency)) {
resultDiv.innerHTML = "Please enter valid numbers for all fields.";
return;
}
if (principal <= 0 || annualRate < 0 || time <= 0 || compoundingFrequency <= 0) {
resultDiv.innerHTML = "Please enter positive values for principal, time, and compounding frequency, and a non-negative rate.";
return;
}
var ratePerPeriod = annualRate / 100 / compoundingFrequency;
var numberOfPeriods = compoundingFrequency * time;
var futureValue = principal * Math.pow((1 + ratePerPeriod), numberOfPeriods);
var totalInterestEarned = futureValue – principal;
resultDiv.innerHTML = "Future Value: $" + futureValue.toFixed(2) + "" +
"Total Interest Earned: $" + totalInterestEarned.toFixed(2);
}