Harmonic Mean Calculator
Enter two or more positive numbers and this calculator returns their harmonic mean — the reciprocal-of-the-average-of-reciprocals, ideal for averaging rates and speeds.
Calculate the Harmonic Average of Numbers
Harmonic Mean Formula
Where:
- \(H\) — the harmonic mean
- \(n\) — the number of values
- \(x_1, x_2, \ldots, x_n\) — the individual values; each must be positive and non-zero
The formula divides the count of values by the sum of their reciprocals. Equivalently, it is the reciprocal of the arithmetic mean of the reciprocals, which is why it gives greater weight to smaller values.
Harmonic Mean – Calculation Example
Example: you travel the same distance twice — first at 10 km/h, then at 20 km/h — and want your average speed for the whole trip.
\[ H = \frac{2}{\dfrac{1}{10} + \dfrac{1}{20}} = \frac{2}{0.1 + 0.05} = \frac{2}{0.15} \approx 13.33 \]
Result: the harmonic mean of 10 and 20 is approximately 13.33 km/h — not 15, which the arithmetic mean would incorrectly suggest.
How to Use the Calculator
- Enter how many values you want to average in the Number of values field (minimum 2). Additional input fields appear automatically.
- Type your positive numbers into Number 1, Number 2, and so on.
- The result appears instantly in the Average field — no button needed.
- If any value is zero or negative, the calculator shows an error, because the harmonic mean is defined only for positive numbers.
What Is the Harmonic Mean?
The harmonic mean is one of the three classical Pythagorean means, alongside the arithmetic mean and the geometric mean. For any set of positive numbers it always satisfies the ordering:
\[ H \leq G \leq A \]
with equality only when all values are identical. In practice, the harmonic mean is the right average whenever the quantities being combined are expressed as rates — that is, as something per unit of something else, such as kilometres per hour, litres per 100 km, or units produced per hour.
The classic illustration is average speed. If you drive 100 km at 60 km/h and the next 100 km at 40 km/h, your true average speed is not 50 km/h but the harmonic mean \(2/(1/60 + 1/40) = 48\) km/h, because you spend more time at the slower speed. Whenever each value applies to the same distance, volume, or workload, the harmonic mean — not the arithmetic mean — gives the correct overall rate.
Because small values contribute disproportionately large reciprocals, the harmonic mean is pulled toward the smallest entries and is robust against very large outliers. This property is used in finance for averaging price–earnings ratios of a portfolio, in machine learning in the F1 score (the harmonic mean of precision and recall), and in electrical engineering for resistors in parallel.
Assumptions, Limitations and Tips
- All values must be positive. A single zero or negative number makes the harmonic mean undefined — the calculator will reject such input.
- Use it for rates, not quantities. If you are averaging prices, weights, or scores directly, the arithmetic or weighted mean is usually the correct choice.
- Equal weighting is assumed. Each value counts equally. If your rates apply to different distances or volumes, a weighted harmonic mean is needed.
- One extreme small value dominates. The harmonic mean of \(1, 100, 100\) is about 2.94, not anywhere near 67. Make sure a single tiny value is genuinely part of your data.
- To compare all three classical means on the same data — or to work with the root-mean-square used in statistics — try the quadratic mean (RMS) calculator.
Harmonic Mean vs. Other Averages
| Average | Best for | Example use |
|---|---|---|
| Harmonic mean | Rates over equal units (speed, efficiency) | Average speed over equal distances |
| Geometric mean | Multiplicative data, growth rates | Average investment return over years |
| Arithmetic mean | Additive quantities | Average of test scores |
| Quadratic mean (RMS) | Data varying around zero | Effective voltage of AC signal |
A related real-world application is computing how long two people take to complete a job together — the underlying math is essentially a harmonic-mean calculation.
Frequently Asked Questions
How do I calculate the harmonic mean by hand?
Count your values, take the reciprocal of each (flip it: 1 divided by the value), add those reciprocals together, then divide the count by that sum. For example, with 4, 6, and 12: the reciprocals are 0.25, 0.167, and 0.083, their sum is 0.5, and \(3 / 0.5 = 6\). Always double-check that the result is not larger than your smallest value — it never should be.
Is there a shortcut formula for the harmonic mean of two numbers?
Yes. For two values \(a\) and \(b\), the harmonic mean equals \(\frac{2ab}{a+b}\). For example, with 30 and 60: \(2 \times 30 \times 60 / (30 + 60) = 3600/90 = 40\). This shortcut is handy for average speed problems, such as a round trip driven at two different speeds over the same distance.
When is the harmonic mean a 'good' or typical value?
There is no universal good range — it depends entirely on your data. The useful sanity check is the ordering \(H \leq G \leq A\): the harmonic mean is always less than or equal to the geometric and arithmetic means, with equality only when all values are identical. If your result exceeds the arithmetic mean, you made a calculation error somewhere.
What happens if my rates apply to different distances or volumes?
You need a weighted harmonic mean: \(H = \frac{w_1 + w_2 + \cdots + w_n}{\frac{w_1}{x_1} + \frac{w_2}{x_2} + \cdots + \frac{w_n}{x_n}}\), where each weight \(w\) is the distance, volume, or workload that rate applies to. The unweighted version on this page assumes every value carries equal weight, which is only correct when the underlying units are the same.
Why can't I enter zero or negative numbers?
The formula divides by the sum of reciprocals, and the reciprocal of zero is undefined — so a single zero breaks the entire calculation. Negative values also break the math: reciprocal sums can become zero or negative, producing meaningless or negative results. If your dataset contains zeros or negatives, the harmonic mean is the wrong tool; use the arithmetic or geometric mean (after handling negatives) instead.
What's the most common mistake when averaging speeds?
Using the arithmetic mean when each speed covers the same distance. If you drive one stretch at 80 km/h and an equal stretch at 40 km/h, the true average is 53.33 km/h, not 60. The arithmetic mean is only correct when each speed applies for the same time. Ask yourself: am I equalizing time or distance? That determines which mean to use.
How does the harmonic mean relate to resistors in parallel?
For two resistors, the total parallel resistance is half the harmonic mean of their values: \(R_{total} = \frac{R_1 R_2}{R_1 + R_2}\). More generally, the conductances (1/R) add up, just like reciprocals in the harmonic mean formula. For two equal resistors, the result is half of one resistor — a quick way to verify your electronics calculations.