A Certificate of Deposit (CD) is a type of savings account that offers a fixed interest rate for a predetermined period. You agree to leave your money in the CD for the entire term, and in return, the bank usually offers a higher interest rate than a standard savings account. This calculator helps you estimate the potential earnings on your CD investment.
Annually
Semi-Annually
Quarterly
Monthly
Daily
function calculateCDInterest() {
var principal = parseFloat(document.getElementById("principalAmount").value);
var annualRate = parseFloat(document.getElementById("annualInterestRate").value);
var term = parseFloat(document.getElementById("cdTermYears").value);
var frequency = parseFloat(document.getElementById("compoundingFrequency").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
if (isNaN(principal) || isNaN(annualRate) || isNaN(term) || isNaN(frequency) || principal <= 0 || annualRate < 0 || term <= 0 || frequency <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
var ratePerPeriod = annualRate / 100 / frequency;
var numberOfPeriods = term * frequency;
// Compound Interest Formula: A = P(1 + r/n)^(nt)
var totalAmount = principal * Math.pow((1 + ratePerPeriod), numberOfPeriods);
var totalInterestEarned = totalAmount – principal;
resultDiv.innerHTML =
"