Harmonic Mean Calculator
Introduction: What is the harmonic mean?
The harmonic mean is one of the three classical means, alongside the arithmetic mean and geometric mean. It is especially useful when you want to average rates, speeds, or other quantities that behave like “value per unit” (for example, km/h, items per hour, cost per unit).
Given a set of positive numbers that represent such rates, the harmonic mean gives more weight to smaller values than to larger ones. This reflects the idea that spending time at a very low speed or rate can drag down your overall performance much more than short bursts at a higher speed can improve it.
Common situations where the harmonic mean is appropriate include:
- Average speed over a trip where you travel equal distances at different speeds.
- Average cost per unit when buying the same quantity at different prices per unit.
- Combining parallel resistances or other physical quantities that add via reciprocals.
This calculator automates the harmonic mean computation, so you can quickly enter your data, get the result, and then interpret what it means for your specific problem.
Harmonic mean formula
Suppose you have n positive numbers:
x1, x2, …, xn
The harmonic mean H is defined as:
H = n / (1/x1 + 1/x2 + … + 1/xn)
In words, you:
- Take the reciprocal of each value (for example, turn 40 into 1/40).
- Add all those reciprocals together.
- Divide the number of values,
n, by that sum.
That definition is equivalent to the following more formal mathematical expression:
Here:
nis the number of values.xiis the i-th value in your list.- The summation sign means “add up” all the reciprocals from
i = 1toi = n.
How to use this harmonic mean calculator
To compute a harmonic mean with this tool:
- Enter your positive numbers into the input box, separated by commas. For example:
40, 60, 80 - Use a dot for decimal values, such as
10.5or3.25. - Do not include thousands separators; instead of
1,000, enter1000. - Click the button to compute the harmonic mean.
- Read the result, which is shown as a single number. You can copy this value for use in other tools or documents.
The calculator is designed for strictly positive inputs. If you include a zero, a negative number, or something that is not a valid number, the tool will not be able to compute a meaningful harmonic mean and may show an error message.
Worked example: average speed over a round trip
A classic example where the harmonic mean is the correct type of average is average speed when traveling equal distances at different speeds.
Imagine you drive:
- Half of a trip at 40 km/h, and
- The other half at 60 km/h.
Many people might think the average speed is just the arithmetic mean:
(40 + 60) / 2 = 50 km/h
However, this is incorrect for average speed when distances are the same but speeds differ, because you spend more time traveling at the lower speed. The correct measure is the harmonic mean:
H = 2 / (1/40 + 1/60)
Compute the reciprocals and sum:
1/40 = 0.0251/60 ≈ 0.01666671/40 + 1/60 = 0.025 + 0.0166667 = 0.0416667
Now divide n = 2 by this sum:
H = 2 / 0.0416667 ≈ 48 km/h
So your true average speed over the whole trip is 48 km/h, not 50 km/h. The harmonic mean correctly captures the longer time spent at the lower speed.
Interpreting the result
Once you compute the harmonic mean for your data, it helps to understand how it compares to the arithmetic and geometric means for the same numbers. For any set of positive numbers that are not all equal, you have the ordering:
harmonic mean ≤ geometric mean ≤ arithmetic mean
This inequality has practical meaning:
- If the harmonic mean is much lower than the arithmetic mean, it means that small values are having a strong influence. For example, a few very low speeds or very low rates can significantly reduce your overall performance.
- If all your values are the same (for example, 50, 50, 50), then all three means are equal. In this case, variability is zero and the choice of mean does not matter.
- As the variation in your data increases, the gap between the harmonic and arithmetic means widens. This gap reflects how uneven your speeds or rates are.
For rates and ratios, the harmonic mean often tells you “how the system actually behaved over time or over repeated trials,” while the arithmetic mean might give an overly optimistic impression by weighting all levels equally, regardless of how long they lasted.
Comparison of harmonic, geometric, and arithmetic means
The table below summarizes the differences between the three main means for positive data. This can help you decide which one is most appropriate for your situation.
| Type of mean | Formula (for x1, …, xn > 0) | Best suited for | Effect of small values |
|---|---|---|---|
| Harmonic mean | H = n / (1/x1 + … + 1/xn) |
Averaging rates, speeds, and ratios when the underlying quantity (like distance or quantity purchased) is held equal. | Small values have a strong effect and pull the mean down sharply. |
| Geometric mean | G = (x1 × x2 × … × xn)^(1/n) |
Averaging growth factors, returns, or multiplicative effects (e.g., investment returns over time). | Small values influence the mean, but less strongly than with the harmonic mean. |
| Arithmetic mean | A = (x1 + x2 + … + xn) / n |
Simple averages of quantities that add directly, like test scores or total amounts. | Each value contributes linearly; small values do not receive any extra weight. |
Another related measure is the root mean square (RMS), also known as the quadratic mean. It is always greater than or equal to the arithmetic mean and is used when you care about the magnitude of fluctuations, such as in electrical engineering (RMS voltage) or in statistics for measuring errors. While RMS is not the same as the harmonic mean, thinking about all four measures together helps you understand how different ways of averaging highlight different aspects of your data.
Assumptions and limitations
The harmonic mean is powerful in the right context, but it is not universally applicable. Keep the following assumptions and limitations in mind when you use this calculator:
- Positive values only: The harmonic mean is defined only for strictly positive numbers. If any value is zero or negative, the formula breaks down (you would be dividing by zero or by a negative rate), and the result is not meaningful.
- Use for rates or ratios: The harmonic mean makes the most sense when your numbers represent something like “units per time”, “cost per unit”, or similar ratios where the quantity of interest is inversely related to the rate.
- Not for raw totals: If you are averaging raw quantities, such as heights, weights, or test scores, the arithmetic mean is usually more appropriate.
- Sensitive to very small values: Because it heavily weights small numbers, the harmonic mean can be dominated by a single extremely small value. This is useful when that small value genuinely slows down the whole system, but it can be misleading if the outlier is due to an error or an unrepresentative event.
- Equal “weight” context: The classical interpretation of the harmonic mean assumes that each value is associated with an equal amount of the underlying quantity (e.g., equal distances, equal quantities purchased). If your distances or quantities are not equal, you may need a weighted harmonic mean instead of the simple version used here.
Before relying on the result, check that your data fit these assumptions. If your situation does not involve rates, ratios, or equal-weight scenarios, consider whether the arithmetic or geometric mean might better answer your question.
Practical tips for using the result
When you use the harmonic mean from this calculator in your own work:
- Compare it with the arithmetic mean of the same values. A much lower harmonic mean usually signals that low values have a strong impact on performance.
- Be cautious about including data points that come from very different contexts. For example, mixing long trips and very short trips in the same average speed may require more careful weighting.
- Document that you used the harmonic mean, especially in reports or technical work, so others understand why the result differs from a simple average.
Used appropriately, the harmonic mean can provide a more realistic summary of rates and ratios than the arithmetic mean, particularly in contexts where time, distance, or quantity is shared equally across the different levels you are averaging.
Arcade Mini-Game: Harmonic Mean Calculator Calibration Run
Use this quick arcade run to practice separating useful scenario inputs from common planning mistakes before you rely on the calculator output.
Start the game, then use your pointer or arrow keys to catch useful inputs and avoid bad assumptions.
