Geometric Mean Calculator
The nth root of the product for a series of positive values, evaluated in logarithms.
What the geometric mean calculator does
It multiplies the values and takes the nth root, which is the correct average for growth factors and ratios. The page evaluates it as exp(Σ ln x ÷ n) so a long series cannot overflow the product: 2, 4, 4, 4, 5, 5, 7, 9 has a log sum of 12.21404082 over 8 values, and a geometric mean of 4.603215596.
The geometric mean is always at or below the arithmetic mean for the same series, and the gap grows with the spread; the page prints the log sum as well as the answer so the arithmetic is visible.
Every value must be greater than 0, because the logarithm of a non-positive number has no real value. The page names the offending value rather than returning a non-number, and it refuses a series longer than 100 000 values with the count. A value that is not a number is refused with its line number, so a mistyped value cannot become a zero.
Figures print to ten significant figures with trailing zeros trimmed.
How to use it
Paste your data into the text box, one positive value per line.
Press Run. The result prints n, the log sum, the geometric mean and the mean of the logs it divided by.
Worked example
Input with the default series:
2
4
4
4
5
5
7
9
Output:
n: 8
Log sum: 12.21404082 (Σ ln x)
Geometric mean: 4.603215596 (exp(log sum ÷ n))
Why it runs in your browser
The logarithms are summed in this tab. Your data is never uploaded.
The page multiplies a series of positive values and takes the nth root, which is the average growth factors need. The eight values 2, 4, 4, 4, 5, 5, 7, 9 have a log sum of 12.21404082 and a geometric mean of 4.603215596.
It is evaluated in logarithms, exp(Σ ln x ÷ n), so a long series cannot overflow the product and the printed log sum shows the working.
Every value must be greater than zero, because the logarithm of a non-positive number has no real value. A zero or negative value is refused by name.
When the geometric mean is the right average
A growth factor multiplies rather than adds: a fund that gains 20 % and then loses 20 % has not returned to its start, and the arithmetic mean of 1.2 and 0.8 is not the factor that links them. The geometric mean of the factors is, which is why it is the average for compounding.
The same argument applies to ratios, areas scaled by a dimension and any quantity that lives on a multiplicative scale. The page does not claim the geometric mean is always better; it computes it for a series of positive values and prints the log sum so the arithmetic is visible.
The logarithms, and the positivity rule
Taking the nth root of a product is the same as averaging the logarithms and exponentiating, and the second form is what a computer should do: a hundred values near 10 would overflow the product long before the root was taken. The log sum is printed as well as the answer so the division is visible.
A logarithm needs a positive argument, so a zero or negative value makes the geometric mean meaningless. The page names the offending value rather than returning a NaN, which is the failure a spreadsheet would show.
How to use Geometric Mean Calculator
Paste your data into the text box, one positive value per line.
The text box takes any number of values up to the cap; a line that is not a number is reported with its line number.
Press Run. The result prints n, the log sum, the geometric mean and the mean of the logs it divided by.
What to Expect
Best for
- Averaging growth factors or compound returns
- Averaging ratios and multiplicative indices
- Checking a published geometric mean against the data
Not ideal for
- A series containing zero or a negative value
- A quantity on an additive scale, where the arithmetic mean is the right one
- A weighted series, which needs weighted logs
What this tool keeps
- The values you pasted and their count
- The log sum, so the root can be recomputed
What may need cleanup
- Growth rates given as percentages, which have to become factors (1 + r) first
- Values separated by commas, which have to become one per line
Common errors
- Averaging growth rates directly instead of their factors
- A zero in a returns series, which makes the geometric mean zero and is refused here
Example use cases
- Averaging a fund's annual growth factors
- Averaging a set of dilution ratios
- Checking a reported CAGR from its yearly factors
Sample input
The eight values 2, 4, 4, 4, 5, 5, 7, 9, one per line.
Sample output
n = 8, log sum 12.21404082, geometric mean 4.603215596.
Who this is for
- Analysts averaging growth factors
- Students learning which mean fits which scale
Frequently asked questions
Why is the geometric mean lower than the arithmetic mean?
For positive values with any spread, the geometric mean is at or below the arithmetic mean, and the gap grows with the spread. That is a property of the two averages, not a rounding difference.
What happens if one value is zero?
The product is zero, so the geometric mean would be zero regardless of the other values, and the logarithm is undefined. The page refuses the zero by name instead of printing a misleading zero.
Do I enter returns as percentages or as factors?
As factors. A 20 % gain is 1.2 and a 20 % loss is 0.8, and the geometric mean of those is about 0.98 — which is the honest answer, because the pair does not return to the start.
Does it handle a very long series?
Yes, up to 100 000 values. The product is never formed: the logs are summed and divided, so the arithmetic stays finite even where the product would overflow.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.