When you open a Certificate of Deposit (CD), banks often provide a "Nominal Annual Percentage" or "Stated Rate." However, the actual amount you earn over a year depends on how often the institution compounds the returns. This true earning rate is known as the Annual Percentage Yield (APY).
The APY Formula for CDs
APY = (1 + r/n)n – 1
r = The stated nominal annual percentage (as a decimal).
n = The number of compounding periods per year.
How Compounding Frequency Affects Your Return
The more frequently your returns are compounded, the higher your actual yield will be. For example, a 5.00% nominal percentage will yield different results depending on the frequency:
Compounding Type
APY (at 5.00% nominal)
Daily
5.1267%
Monthly
5.1162%
Annually
5.0000%
Why APY is Better for Comparison
Because different financial institutions use different compounding methods, comparing the nominal percentages alone is misleading. The APY provides a standardized metric that allows you to compare a CD that compounds daily with one that compounds monthly on an "apples-to-apples" basis.
function calculateCDAPY() {
var nominalInput = document.getElementById('nominalPercentage');
var compoundingInput = document.getElementById('compoundingPeriods');
var resultContainer = document.getElementById('apyResultContainer');
var finalValue = document.getElementById('finalAPYValue');
var analysisText = document.getElementById('apyAnalysis');
var r = parseFloat(nominalInput.value);
var n = parseInt(compoundingInput.value);
if (isNaN(r) || r <= 0) {
alert("Please enter a valid nominal percentage greater than 0.");
return;
}
// Convert percentage to decimal
var decimalRate = r / 100;
// APY Formula: (1 + r/n)^n – 1
var base = 1 + (decimalRate / n);
var apyDecimal = Math.pow(base, n) – 1;
var apyPercentage = apyDecimal * 100;
// Display results
resultContainer.style.display = 'block';
finalValue.innerHTML = apyPercentage.toFixed(4) + "%";
var diff = (apyPercentage – r).toFixed(4);
var frequencyWord = "annually";
if (n === 365) frequencyWord = "daily";
else if (n === 12) frequencyWord = "monthly";
else if (n === 4) frequencyWord = "quarterly";
else if (n === 2) frequencyWord = "semi-annually";
analysisText.innerHTML = "By compounding " + frequencyWord + ", your effective yield increases by " + diff + "% over the stated nominal rate. This is the figure you should use to compare this CD against other savings options.";
// Smooth scroll to result
resultContainer.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}