Understanding Certificates of Deposit (CDs) and How This Calculator Works
A Certificate of Deposit (CD) is a savings product offered by banks and credit unions that provides a fixed interest rate for a specified term. Unlike regular savings accounts, your money is locked in for the duration of the term, but in return, you typically earn a higher interest rate. CDs are considered a safe investment because they are insured by the FDIC (up to certain limits) in the United States.
This CD calculator helps you estimate the potential earnings and the final balance of your investment based on the initial deposit, the annual interest rate, the term length, and how frequently the interest is compounded.
How the Calculation Works
The core of CD interest calculation involves compound interest. Compound interest is interest calculated on the initial principal, which also includes all of the accumulated interest from previous periods. This means your money grows at an accelerated rate over time.
The formula used is the compound interest formula:
$A = P(1 + \frac{r}{n})^{nt}$
Where:
A = the future value of the investment/loan, including interest
P = the principal investment amount (the initial deposit)
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 for
Steps in the Calculator:
Principal Amount (P): This is the initial sum you deposit into the CD.
Annual Interest Rate (r): The stated yearly rate of return on your deposit, entered as a percentage and converted to a decimal for calculation (e.g., 4.5% becomes 0.045).
CD Term (in Months): The duration for which your money will be held in the CD. This is converted into years by dividing by 12 ($t = \frac{\text{Term in Months}}{12}$).
Compounding Frequency (n): This is how often the interest earned is added to the principal, affecting how quickly your money grows.
Annually: n = 1
Semiannually: n = 2
Quarterly: n = 4
Monthly: n = 12
Daily: n = 365
The calculator then applies the compound interest formula to find the final balance (A).
Total Earnings are calculated by subtracting the initial principal from the final balance ($Earnings = A – P$).
When to Use a CD Calculator
Use this calculator to:
Compare potential returns from different CDs with varying rates and terms.
Determine how much interest you can expect to earn over a specific period.
Plan your savings goals by seeing how much your initial deposit could grow into.
Understand the impact of compounding frequency on your overall earnings.
Remember that the rates shown are estimates. Actual returns may vary slightly due to specific bank calculations or if additional deposits/withdrawals are made (though this calculator assumes a single deposit and no withdrawals).
function calculateCdEarnings() {
var principalAmount = parseFloat(document.getElementById("principalAmount").value);
var annualInterestRate = parseFloat(document.getElementById("annualInterestRate").value);
var cdTermMonths = parseFloat(document.getElementById("cdTermMonths").value);
var compoundingFrequencySelect = document.getElementById("compoundingFrequency");
var compoundingFrequencyText = compoundingFrequencySelect.options[compoundingFrequencySelect.selectedIndex].value;
var resultTotalEarnings = document.getElementById("totalEarnings");
var resultFinalBalance = document.getElementById("finalBalance");
// Clear previous results
resultTotalEarnings.textContent = "$0.00";
resultFinalBalance.textContent = "$0.00";
// Input validation
if (isNaN(principalAmount) || principalAmount <= 0) {
alert("Please enter a valid positive initial deposit amount.");
return;
}
if (isNaN(annualInterestRate) || annualInterestRate < 0) {
alert("Please enter a valid annual interest rate.");
return;
}
if (isNaN(cdTermMonths) || cdTermMonths <= 0) {
alert("Please enter a valid positive CD term in months.");
return;
}
var rate = annualInterestRate / 100; // Convert percentage to decimal
var termYears = cdTermMonths / 12; // Convert months to years
var n = 0; // Number of times interest is compounded per year
switch (compoundingFrequencyText) {
case "annually":
n = 1;
break;
case "semiannually":
n = 2;
break;
case "quarterly":
n = 4;
break;
case "monthly":
n = 12;
break;
case "daily":
n = 365;
break;
default:
alert("Invalid compounding frequency selected.");
return;
}
// Calculate the future value using the compound interest formula
// A = P(1 + r/n)^(nt)
var finalBalance = principalAmount * Math.pow(1 + rate / n, n * termYears);
var totalEarnings = finalBalance – principalAmount;
// Format results to two decimal places and add currency symbol
resultTotalEarnings.textContent = "$" + totalEarnings.toFixed(2);
resultFinalBalance.textContent = "$" + finalBalance.toFixed(2);
}