Compound Annual Growth Rate (CAGR) Calculator
Understanding Compound Annual Growth Rate (CAGR)
The Compound Annual Growth Rate (CAGR) is a popular metric used to measure the average annual rate of return of an investment or business over a specified period of time longer than one year. It smooths out volatility and provides a single, representative growth rate. CAGR is particularly useful for comparing the performance of different investments or for tracking the growth trajectory of a company over several years.
Unlike simple average growth rates, CAGR accounts for the effect of compounding, meaning that each year's growth is calculated on the basis of the previous year's ending value. This provides a more realistic picture of how an investment has truly grown over time.
The CAGR Formula:
The formula for calculating CAGR is as follows:
CAGR = ( (Ending Value / Starting Value) ^ (1 / Number of Years) ) – 1
Where:
- Ending Value: The value of the investment or metric at the end of the period.
- Starting Value: The value of the investment or metric at the beginning of the period.
- Number of Years: The total number of years over which the growth is measured.
When to Use CAGR:
- Evaluating the historical performance of stocks, mutual funds, or other investments.
- Assessing the growth of a business's revenue, profit, or customer base over multiple years.
- Comparing investment opportunities with different time horizons.
- Setting realistic growth targets for future periods.
Example:
Let's say you invested $10,000 in a stock (Starting Value), and after 5 years (Number of Years), its value has grown to $25,000 (Ending Value).
Using the CAGR formula:
- Ending Value = $25,000
- Starting Value = $10,000
- Number of Years = 5
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 approximately 20.11% over the 5-year period, taking into account the compounding effect.
.calculator-container {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
max-width: 600px;
margin: 20px auto;
padding: 20px;
border: 1px solid #e0e0e0;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
background-color: #ffffff;
}
.calculator-title {
text-align: center;
color: #333;
margin-bottom: 25px;
font-size: 1.8em;
}
.calculator-form .form-group {
margin-bottom: 15px;
display: flex;
flex-direction: column;
}
.calculator-form label {
display: block;
margin-bottom: 8px;
color: #555;
font-weight: 500;
}
.calculator-form input[type="number"] {
width: 100%;
padding: 10px 12px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1em;
box-sizing: border-box; /* Important for consistent sizing */
}
.calculator-form input[type="number"]:focus {
border-color: #007bff;
outline: none;
box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}
.calculator-button {
width: 100%;
padding: 12px 15px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 1.1em;
cursor: pointer;
transition: background-color 0.3s ease;
margin-top: 10px;
}
.calculator-button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 25px;
padding: 15px;
background-color: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 4px;
text-align: center;
font-size: 1.3em;
color: #333;
font-weight: bold;
}
.calculator-explanation {
margin-top: 30px;
border-top: 1px solid #e0e0e0;
padding-top: 20px;
color: #444;
line-height: 1.6;
}
.calculator-explanation h2,
.calculator-explanation h3 {
color: #333;
margin-bottom: 10px;
font-size: 1.5em;
}
.calculator-explanation h3 {
font-size: 1.2em;
margin-top: 15px;
}
.calculator-explanation p,
.calculator-explanation ul {
margin-bottom: 15px;
}
.calculator-explanation ul {
padding-left: 20px;
}
.calculator-explanation li {
margin-bottom: 8px;
}
.calculator-explanation strong {
color: #007bff;
}
function calculateCAGR() {
var startingValue = parseFloat(document.getElementById("startingValue").value);
var endingValue = parseFloat(document.getElementById("endingValue").value);
var numberOfYears = parseFloat(document.getElementById("numberOfYears").value);
var resultDiv = document.getElementById("result");
if (isNaN(startingValue) || isNaN(endingValue) || isNaN(numberOfYears)) {
resultDiv.innerHTML = "Please enter valid numbers for all fields.";
return;
}
if (startingValue <= 0) {
resultDiv.innerHTML = "Starting Value must be greater than zero.";
return;
}
if (endingValue < 0) {
resultDiv.innerHTML = "Ending Value cannot be negative.";
return;
}
if (numberOfYears <= 0) {
resultDiv.innerHTML = "Number of Years must be greater than zero.";
return;
}
var cagr = Math.pow((endingValue / startingValue), (1 / numberOfYears)) – 1;
var formattedCAGR = (cagr * 100).toFixed(2); // Format to 2 decimal places
resultDiv.innerHTML = "CAGR:
" + formattedCAGR + "%";
}