Calculate the Compound Annual Growth Rate (CAGR) for your investments.
(Value at the beginning of the period)
(Value at the end of the period)
(Duration of the investment period)
What is CAGR?
CAGR stands for Compound Annual Growth Rate. It represents the mean annual growth rate of an investment over a specified period of time longer than one year, assuming that profits were reinvested at the end of each year. CAGR smooths out volatility and provides a single, representative growth rate for an investment over time. It's a powerful tool for understanding historical performance and making comparisons between different investments.
Why Use CAGR?
Performance Measurement: It accurately reflects how an investment has grown over multiple years, accounting for compounding.
Comparisons: CAGR allows for easy comparison between different investments or assets, even if they have different growth patterns over time.
Forecasting: While primarily a historical measure, CAGR can be used as a basis for future projections, assuming past growth trends continue.
Simplicity: It distills complex, fluctuating growth into a single, understandable annual percentage.
How to Calculate CAGR (The Formula)
The CAGR formula is as follows:
CAGR = [ (Ending Value / Starting Value) ^ (1 / Number of Years) ] – 1
Or in terms of the inputs for this calculator:
CAGR = [ (Ending Value / Starting Value) ^ (1 / Number of Years) ] – 1
In an Excel formula, this would look like:
=RATE(number_of_years, 0, -starting_value, ending_value) or more directly:
=((ending_value/starting_value)^(1/number_of_years))-1
Example Calculation
Let's say you invested $10,000 (Starting Value) in a mutual fund. After 5 years (Number of Years), the investment is worth $25,000 (Ending Value).
Starting Value = $10,000
Ending Value = $25,000
Number of Years = 5
Using the formula:
CAGR = [ ($25,000 / $10,000) ^ (1 / 5) ] – 1
CAGR = [ (2.5) ^ (0.2) ] – 1
CAGR = [ 1.2011 ] – 1
CAGR = 0.2011 or 20.11%
This means your investment grew at an average rate of 20.11% per year over those 5 years.
function calculateCAGR() {
var startValueInput = document.getElementById("startValue");
var endValueInput = document.getElementById("endValue");
var numberOfYearsInput = document.getElementById("numberOfYears");
var resultDiv = document.getElementById("result");
var errorMessageDiv = document.getElementById("errorMessage");
errorMessageDiv.style.display = 'none'; // Hide error message initially
var startValue = parseFloat(startValueInput.value);
var endValue = parseFloat(endValueInput.value);
var numberOfYears = parseFloat(numberOfYearsInput.value);
// Input validation
if (isNaN(startValue) || isNaN(endValue) || isNaN(numberOfYears)) {
errorMessageDiv.textContent = "Please enter valid numbers for all fields.";
errorMessageDiv.style.display = 'block';
resultDiv.style.display = 'none';
return;
}
if (startValue <= 0) {
errorMessageDiv.textContent = "Starting Value must be greater than zero.";
errorMessageDiv.style.display = 'block';
resultDiv.style.display = 'none';
return;
}
if (numberOfYears <= 0) {
errorMessageDiv.textContent = "Number of Years must be greater than zero.";
errorMessageDiv.style.display = 'block';
resultDiv.style.display = 'none';
return;
}
if (endValue < 0) {
errorMessageDiv.textContent = "Ending Value cannot be negative.";
errorMessageDiv.style.display = 'block';
resultDiv.style.display = 'none';
return;
}
// CAGR Calculation
var cagr = Math.pow((endValue / startValue), (1 / numberOfYears)) – 1;
// Handle potential floating point inaccuracies or very small/large numbers
if (isNaN(cagr) || !isFinite(cagr)) {
errorMessageDiv.textContent = "Calculation resulted in an invalid number. Please check your inputs.";
errorMessageDiv.style.display = 'block';
resultDiv.style.display = 'none';
return;
}
var formattedCAGR = (cagr * 100).toFixed(2); // Format to 2 decimal places and convert to percentage
resultDiv.innerHTML = formattedCAGR + "% CAGR";
resultDiv.style.display = 'block';
}