A Certificate of Deposit (CD) is a savings vehicle offered by banks and credit unions that typically offers a higher interest rate than a standard savings account in exchange for locking your funds away for a set period. The most critical metric for comparing these rates is the Annual Percentage Yield (APY).
Unlike a simple interest rate, APY takes into account the frequency of compounding. Compounding occurs when the interest you earn begins to earn interest on itself. The higher the APY and the more frequent the compounding (often baked into the APY calculation), the faster your money grows.
How the APY Calculation Works
When you see a CD rate advertised, it is usually expressed as APY. This figure represents the total amount of interest you would earn on a $100 deposit over exactly one year. Because APY is an annualized figure, it standardizes rates across different compounding frequencies (daily, monthly, quarterly), allowing for an "apples-to-apples" comparison.
The formula used to project the future value of a CD based on APY is:
Future Value = Principal × (1 + APY)Years
Real-World Example
Let's assume you want to invest in a CD with the following parameters:
Deposit: $10,000
APY: 5.00%
Term: 3 Years
Using the logic in our calculator, the math would look like this:
$10,000 × (1 + 0.05)3 = $10,000 × 1.157625
Result: At maturity, the CD would be worth approximately $11,576.25, meaning you earned $1,576.25 in pure interest simply by letting the compound interest do the work.
Factors Influencing CD Rates
Several economic and institutional factors determine the APY offered on CD rates:
Federal Reserve Policy: When the Fed raises the federal funds rate, banks typically raise rates on savings and CDs to attract deposits.
Term Length: Generally, longer terms (e.g., 5 years) offer higher APY than shorter terms (e.g., 6 months) to compensate for the liquidity risk, though an inverted yield curve can sometimes reverse this.
Institution Type: Online banks often offer higher APY than traditional brick-and-mortar banks because they have lower overhead costs.
function calculateCD() {
// 1. Get DOM elements
var depositInput = document.getElementById('depositAmount');
var apyInput = document.getElementById('apyRate');
var termInput = document.getElementById('cdTerm');
var termUnitInput = document.getElementById('cdTermUnit');
var errorDeposit = document.getElementById('errorDeposit');
var errorApy = document.getElementById('errorApy');
var errorTerm = document.getElementById('errorTerm');
var resultsArea = document.getElementById('resultsArea');
// 2. Parse values
var deposit = parseFloat(depositInput.value);
var apy = parseFloat(apyInput.value);
var term = parseFloat(termInput.value);
var unit = termUnitInput.value;
// 3. Reset errors
errorDeposit.style.display = 'none';
errorApy.style.display = 'none';
errorTerm.style.display = 'none';
resultsArea.style.display = 'none';
var hasError = false;
// 4. Validate Inputs
if (isNaN(deposit) || deposit <= 0) {
errorDeposit.style.display = 'block';
hasError = true;
}
if (isNaN(apy) || apy < 0) {
errorApy.style.display = 'block';
hasError = true;
}
if (isNaN(term) || term <= 0) {
errorTerm.style.display = 'block';
hasError = true;
}
if (hasError) {
return;
}
// 5. Calculation Logic
// Convert term to years for the formula: Balance = P * (1 + r)^t
// APY is the effective annual rate, so 'r' is APY/100 and 't' is time in years.
var timeInYears = 0;
if (unit === 'months') {
timeInYears = term / 12;
} else {
timeInYears = term;
}
var decimalRate = apy / 100;
// Compound Interest Formula using APY
var finalBalance = deposit * Math.pow((1 + decimalRate), timeInYears);
var totalInterest = finalBalance – deposit;
// Calculate total percentage return over the full term
var totalReturnPct = (totalInterest / deposit) * 100;
// 6. Formatting Function
function formatMoney(amount) {
return '$' + amount.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
}
// 7. Display Results
document.getElementById('displayBalance').innerHTML = formatMoney(finalBalance);
document.getElementById('displayInterest').innerHTML = formatMoney(totalInterest);
document.getElementById('displayYield').innerHTML = totalReturnPct.toFixed(2) + '%';
resultsArea.style.display = 'block';
}