Compound Annual Growth Rate (CAGR) Calculator
What is Compound Annual Growth Rate (CAGR)?
The Compound Annual Growth Rate (CAGR) is a metric that represents the mean annual growth rate of an investment over a specified period of time longer than one year. It smooths out volatility and provides a more representative figure for growth compared to simple average growth rates. CAGR is particularly useful for comparing the performance of different investments, understanding the historical performance of a business, or forecasting future growth based on past trends.
The formula for CAGR is:
CAGR = (Ending Value / Beginning Value)^(1 / Number of Years) – 1
In this calculator:
- Beginning Value: The initial value of your investment or metric at the start of the period.
- Ending Value: The final value of your investment or metric at the end of the period.
- Number of Years: The total number of years over which the growth occurred.
The result is expressed as a percentage, indicating the annualized rate at which your investment grew.
Example Calculation:
Let's say you invested $10,000 (Beginning Value) in a stock. After 5 years (Number of Years), its value has grown to $25,000 (Ending Value).
Using the CAGR 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 annual rate of 20.11% over the 5-year period.
function calculateCAGR() {
var beginningValue = parseFloat(document.getElementById("beginningValue").value);
var endingValue = parseFloat(document.getElementById("endingValue").value);
var numberOfYears = parseFloat(document.getElementById("numberOfYears").value);
var resultDiv = document.getElementById("result");
if (isNaN(beginningValue) || isNaN(endingValue) || isNaN(numberOfYears) || beginningValue <= 0 || endingValue < 0 || numberOfYears <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields. Beginning value must be greater than zero, and ending value must be non-negative.";
return;
}
var cagr = Math.pow((endingValue / beginningValue), (1 / numberOfYears)) – 1;
var formattedCAGR = (cagr * 100).toFixed(2);
resultDiv.innerHTML = "The Compound Annual Growth Rate (CAGR) is:
" + formattedCAGR + "%";
}
.calculator-container {
font-family: sans-serif;
max-width: 600px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ddd;
border-radius: 8px;
background-color: #f9f9f9;
}
.calculator-container h2 {
text-align: center;
color: #333;
margin-bottom: 20px;
}
.calculator-inputs {
display: flex;
flex-direction: column;
gap: 15px;
margin-bottom: 20px;
}
.input-group {
display: flex;
flex-direction: column;
}
.input-group label {
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
.input-group input[type="number"] {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1rem;
}
.calculator-inputs button {
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 1.1rem;
cursor: pointer;
transition: background-color 0.3s ease;
}
.calculator-inputs button:hover {
background-color: #0056b3;
}
#result {
margin-top: 20px;
padding: 15px;
border: 1px solid #e0e0e0;
border-radius: 4px;
background-color: #fff;
text-align: center;
font-size: 1.1rem;
color: #333;
}
.calculator-explanation {
margin-top: 30px;
border-top: 1px solid #eee;
padding-top: 20px;
color: #666;
line-height: 1.6;
}
.calculator-explanation h3 {
color: #444;
margin-bottom: 10px;
}
.calculator-explanation p, .calculator-explanation ul {
margin-bottom: 15px;
}
.calculator-explanation ul {
padding-left: 20px;
}
.calculator-explanation li {
margin-bottom: 5px;
}