Compound Average Growth Rate (CAGR) Calculator
The Compound Average Growth Rate (CAGR) is a popular metric used to measure the average annual growth of an investment or business over a specified period. It represents the geometric progression ratio that provides a smoothed annual rate of return. CAGR is particularly useful because it accounts for the effect of compounding, providing a more realistic picture of growth than simple average growth.
CAGR is calculated using the following formula:
CAGR = [(Ending Value / Beginning Value) ^ (1 / Number of Years)] – 1
This calculator helps you determine the CAGR based on your initial and final values and the time period involved.
function calculateCAGR() {
var beginningValue = parseFloat(document.getElementById("beginningValue").value);
var endingValue = parseFloat(document.getElementById("endingValue").value);
var numberOfYears = parseInt(document.getElementById("numberOfYears").value);
var resultDiv = document.getElementById("cagrResult");
if (isNaN(beginningValue) || isNaN(endingValue) || isNaN(numberOfYears) || beginningValue <= 0 || numberOfYears <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
if (endingValue < 0) {
resultDiv.innerHTML = "Ending Value cannot be negative.";
return;
}
var cagr = Math.pow((endingValue / beginningValue), (1 / numberOfYears)) – 1;
var cagrPercentage = (cagr * 100).toFixed(2);
resultDiv.innerHTML = "
Compound Average Growth Rate (CAGR):
" + cagrPercentage + "%";
}
.calculator-inputs, .calculator-result {
margin-top: 20px;
padding: 15px;
border: 1px solid #ccc;
border-radius: 5px;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="number"] {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box; /* Ensures padding doesn't affect width */
}
button {
padding: 10px 15px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #45a049;
}
.calculator-result h3 {
margin-top: 0;
}