Compound Annual Growth Rate (CAGR) Calculator
What is Compound Annual Growth Rate (CAGR)?
The Compound Annual Growth Rate (CAGR) is a measure of the average annual rate of return of an investment over a specified period of time, assuming that profits are reinvested at the end of each year of the investment's lifespan. It represents the "smoothed" rate of return, meaning it's a hypothetical growth rate that would have resulted in the same ending value if the investment had grown at a steady rate each year.
CAGR is a useful metric for understanding the performance of investments over multiple periods. It's particularly helpful for comparing the growth of different investments or for forecasting future growth based on historical performance. Unlike simple average growth rates, CAGR accounts for the effect of compounding, providing a more accurate picture of investment performance.
How to Calculate CAGR
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 duration of the investment period in years.
The result will be expressed as a percentage, representing the average annual growth rate.
Example:
Let's say you invested $10,000 in a stock (Beginning Value) which grew to $15,000 after 5 years (Ending Value and Number of Years).
Using the calculator:
- Beginning Value: $10,000
- Ending Value: $15,000
- Number of Years: 5
The CAGR would be calculated as:
CAGR = ( ($15,000 / $10,000) ^ (1 / 5) ) – 1
CAGR = ( 1.5 ^ 0.2 ) – 1
CAGR = 1.08447 – 1
CAGR = 0.08447 or 8.45%
This means your investment grew at an average annual rate of approximately 8.45% 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 resultElement = document.getElementById("result");
if (isNaN(beginningValue) || isNaN(endingValue) || isNaN(numberOfYears) || beginningValue <= 0 || numberOfYears <= 0) {
resultElement.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
var cagr = Math.pow((endingValue / beginningValue), (1 / numberOfYears)) – 1;
var formattedCAGR = (cagr * 100).toFixed(2);
resultElement.innerHTML = "
Result:
Your Compound Annual Growth Rate (CAGR) is:
" + formattedCAGR + "%";
}
.calculator-container {
font-family: sans-serif;
max-width: 800px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
background-color: #f9f9f9;
}
.calculator-inputs {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
margin-bottom: 20px;
padding: 15px;
border: 1px solid #eee;
border-radius: 5px;
background-color: #fff;
}
.input-group {
display: flex;
flex-direction: column;
}
.input-group label {
margin-bottom: 5px;
font-weight: bold;
color: #333;
}
.input-group input[type="number"] {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
}
.calculator-inputs button {
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
justify-self: start; /* Aligns the button to the start of its grid area */
align-self: center; /* Vertically centers the button if needed */
}
.calculator-inputs button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 20px;
padding: 15px;
border: 1px solid #d4edda;
border-radius: 5px;
background-color: #e9f7ec;
color: #155724;
font-size: 18px;
text-align: center;
}
.calculator-result strong {
font-weight: bold;
}
.calculator-explanation {
margin-top: 30px;
padding: 20px;
border-top: 1px solid #eee;
background-color: #fff;
border-radius: 5px;
}
.calculator-explanation h3 {
color: #007bff;
margin-bottom: 15px;
}
.calculator-explanation h4 {
color: #333;
margin-top: 20px;
margin-bottom: 10px;
}
.calculator-explanation p,
.calculator-explanation ul {
line-height: 1.6;
color: #555;
}
.calculator-explanation ul {
margin-left: 20px;
margin-bottom: 15px;
}
.calculator-explanation li {
margin-bottom: 8px;
}