The Compound Annual Growth Rate (CAGR) is one of the most accurate ways to calculate and determine returns for anything that can rise or fall in value over time. Unlike a simple average, CAGR provides a "smoothed" annual rate of return, representing the rate at which an investment would have grown if it had grown at a steady rate of return each year.
How the CAGR Formula Works
The calculation uses the following mathematical formula:
CAGR = [(Ending Value / Beginning Value) ^ (1 / Number of Years)] – 1
Example Calculation
Imagine you invested 10,000 in a stock portfolio. After 5 years, the portfolio is worth 16,105. To find the CAGR:
Step 1: Divide Ending Value by Initial Value (16,105 / 10,000 = 1.6105)
Step 2: Raise that result to the power of 1/n (1.6105 ^ (1/5) = 1.10)
Step 3: Subtract 1 (1.10 – 1 = 0.10 or 10%)
The CAGR for this investment is 10% per year.
Why Use CAGR?
Investors use CAGR to compare two different investments. For example, you can compare the growth rate of a high-yield savings account against a stock market index. It removes the "noise" of volatility and shows you the effective geometric progression of your wealth.
function calculateCAGR() {
var startValue = parseFloat(document.getElementById('initialValue').value);
var endValue = parseFloat(document.getElementById('finalValue').value);
var years = parseFloat(document.getElementById('durationYears').value);
var resultArea = document.getElementById('resultArea');
var cagrOutput = document.getElementById('cagrOutput');
var totalReturn = document.getElementById('totalReturn');
if (isNaN(startValue) || isNaN(endValue) || isNaN(years) || startValue <= 0 || years <= 0) {
alert("Please enter valid positive numbers. The initial value and years must be greater than zero.");
return;
}
// CAGR Formula: ((Ending Value / Beginning Value) ^ (1 / Years)) – 1
var growthFactor = endValue / startValue;
var exponent = 1 / years;
var cagrResult = (Math.pow(growthFactor, exponent) – 1) * 100;
// Total Return Calculation: ((End – Start) / Start) * 100
var totalGrowth = (growthFactor – 1) * 100;
cagrOutput.innerHTML = cagrResult.toFixed(2) + "%";
totalReturn.innerHTML = "Total absolute return over " + years + " years: " + totalGrowth.toFixed(2) + "%";
resultArea.style.display = 'block';
// Scroll result into view
resultArea.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}