Calculate a Growth Rate

Compound Annual Growth Rate (CAGR) Calculator

What is Compound Annual Growth Rate (CAGR)?

The Compound Annual Growth Rate (CAGR) is a financial metric that measures the year-over-year growth of an investment over a specified period of time, longer than one year. It represents the smoothed-out annual rate of return that would have been required for an investment to grow from its beginning balance to its ending balance, assuming the profits were reinvested at the end of each year.

CAGR is a useful way to understand how an investment or metric has performed over time, providing a single, representative growth rate that smooths out volatility. It's commonly used to compare the performance of different investments or to assess the historical growth of a business metric like revenue or user base.

How to Calculate CAGR

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 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 in the period.

The result is usually expressed as a percentage.

Example Calculation:

Let's say you invested $10,000 in a stock five years ago, and today it's worth $25,000. To calculate the CAGR:

  • Starting Value = $10,000
  • Ending Value = $25,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

Expressed as a percentage, the CAGR is approximately 20.11%. This means your investment grew at an average annual rate of 20.11% over those five years.

.growth-rate-calculator-container { font-family: sans-serif; max-width: 800px; margin: 20px auto; padding: 20px; border: 1px solid #ddd; border-radius: 8px; background-color: #f9f9f9; } .calculator-title { text-align: center; color: #333; margin-bottom: 25px; } .calculator-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin-bottom: 25px; align-items: end; } .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; cursor: pointer; font-size: 1.1rem; transition: background-color 0.3s ease; grid-column: 1 / -1; /* Span across all columns if needed, or adjust layout */ } .calculator-inputs button:hover { background-color: #0056b3; } .calculator-result { margin-top: 20px; padding: 15px; background-color: #e9ecef; border: 1px solid #ced4da; border-radius: 4px; text-align: center; font-size: 1.2rem; font-weight: bold; color: #333; min-height: 50px; /* To prevent layout shifts */ } .calculator-explanation { margin-top: 30px; border-top: 1px solid #eee; padding-top: 20px; } .calculator-explanation h2, .calculator-explanation h3 { color: #333; margin-bottom: 15px; } .calculator-explanation p, .calculator-explanation ul { line-height: 1.6; color: #555; } .calculator-explanation ul { padding-left: 20px; margin-bottom: 15px; } .calculator-explanation li { margin-bottom: 8px; } /* Responsive adjustments */ @media (max-width: 600px) { .calculator-inputs { grid-template-columns: 1fr; } .calculator-inputs button { grid-column: auto; /* Reset grid column for single column layout */ } } function calculateCAGR() { var startingValueInput = document.getElementById("startingValue"); var endingValueInput = document.getElementById("endingValue"); var numberOfYearsInput = document.getElementById("numberOfYears"); var cagrResultDiv = document.getElementById("cagrResult"); var startingValue = parseFloat(startingValueInput.value); var endingValue = parseFloat(endingValueInput.value); var numberOfYears = parseFloat(numberOfYearsInput.value); if (isNaN(startingValue) || isNaN(endingValue) || isNaN(numberOfYears)) { cagrResultDiv.textContent = "Please enter valid numbers for all fields."; return; } if (startingValue <= 0) { cagrResultDiv.textContent = "Starting Value must be greater than zero."; return; } if (endingValue < 0) { cagrResultDiv.textContent = "Ending Value cannot be negative."; return; } if (numberOfYears <= 0) { cagrResultDiv.textContent = "Number of Years must be greater than zero."; return; } var cagr = Math.pow((endingValue / startingValue), (1 / numberOfYears)) – 1; if (isNaN(cagr) || cagr === Infinity || cagr === -Infinity) { cagrResultDiv.textContent = "Calculation resulted in an invalid number. Please check your inputs."; } else { cagrResultDiv.textContent = "CAGR: " + (cagr * 100).toFixed(2) + "%"; } }

Leave a Comment