Compound Annual Growth Rate (CAGR) Calculator
Understanding Compound Annual Growth Rate (CAGR)
The Compound Annual Growth Rate (CAGR) is a financial metric that measures the mean annual growth rate of an investment over a specified period of time longer than one year. It smooths out the volatility of returns, providing a representation of how an investment has grown, assuming its profits were reinvested at the end of each year during the investment's duration. CAGR is particularly useful for comparing the performance of different investments over the same time frame, as it normalizes growth rates.
The CAGR Formula:
The formula for CAGR is as follows:
CAGR = [(Ending Value / Starting Value) ^ (1 / Number of Years)] – 1
Where:
- Ending Value: The value of the investment at the end of the period.
- Starting Value: The value of the investment at the beginning of the period.
- Number of Years: The total duration of the investment period in years.
How to Use the Calculator:
- Enter the Starting Value of your investment.
- Enter the Ending Value of your investment after the specified number of years.
- Enter the Number of Years over which the growth occurred.
- Click the "Calculate CAGR" button.
Example:
Let's say you invested $10,000 (Starting Value) in a stock five years ago, and today that investment is worth $25,000 (Ending Value).
- Starting Value = $10,000
- Ending Value = $25,000
- Number of Years = 5
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 approximately 20.11% over the five-year period.
function calculateCAGR() {
var startValue = parseFloat(document.getElementById("startValue").value);
var endValue = parseFloat(document.getElementById("endValue").value);
var years = parseFloat(document.getElementById("years").value);
var resultDiv = document.getElementById("result");
if (isNaN(startValue) || isNaN(endValue) || isNaN(years) || startValue <= 0 || endValue <= 0 || years <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
var cagr = Math.pow((endValue / startValue), (1 / years)) – 1;
var formattedCAGR = (cagr * 100).toFixed(2);
resultDiv.innerHTML = "
CAGR: " + formattedCAGR + "%";
}
.calculator-container {
font-family: sans-serif;
max-width: 600px;
margin: 20px auto;
padding: 20px;
border: 1px solid #e0e0e0;
border-radius: 8px;
background-color: #f9f9f9;
}
.calculator-container h2 {
text-align: center;
margin-bottom: 20px;
color: #333;
}
.calculator-form {
display: flex;
flex-direction: column;
gap: 15px;
margin-bottom: 20px;
}
.form-group {
display: flex;
flex-direction: column;
}
.form-group label {
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
.form-group input[type="number"] {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
}
.calculator-form button {
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.calculator-form button:hover {
background-color: #0056b3;
}
.calculator-result {
text-align: center;
margin-top: 20px;
padding: 15px;
border: 1px dashed #007bff;
border-radius: 4px;
background-color: #e7f3ff;
font-size: 18px;
font-weight: bold;
color: #0056b3;
}
.calculator-explanation {
margin-top: 30px;
border-top: 1px solid #eee;
padding-top: 20px;
font-size: 14px;
line-height: 1.6;
color: #666;
}
.calculator-explanation h3, .calculator-explanation h4 {
margin-bottom: 10px;
color: #444;
}
.calculator-explanation ul {
margin-left: 20px;
margin-bottom: 10px;
}
.calculator-explanation li {
margin-bottom: 5px;
}