Harmonic Mean Calculator
Enter your numbers separated by commas, spaces or new lines and the tool returns their harmonic mean, rounded to four decimals. The guide explains when this average is the right one and how to check it by hand.
Related calculators
Created by the Reeliy Editorial Team. Last updated: Oct 19, 2026
What is the harmonic mean?
The harmonic mean is one of the three classical averages, next to the arithmetic mean and the geometric mean. It is the reciprocal of the average of the reciprocals: take 1 divided by each value, average those fractions, then flip the answer back over.
That construction makes it the natural average for rates and ratios that share a fixed numerator, such as kilometres per hour over equal distances, items per minute over equal batches, or price-to-earnings multiples across equal amounts of money. In those situations the plain arithmetic mean overstates the typical value, because it gives fast rates the same weight as slow ones even though slow ones consume far more of the quantity you are dividing by.
Harmonic mean formula
H = n ÷ (1/x1 + 1/x2 + … + 1/xn)n is how many numbers there are; every x must be non-zero
For exactly two numbers a and b the fractions can be combined into a shortcut that avoids the reciprocals altogether:
H = 2ab ÷ (a + b)
Example: for 3 and 6 the shortcut gives 2 × 3 × 6 ÷ 9 = 36 ÷ 9 = 4. The long form agrees: 2 ÷ (1/3 + 1/6) = 2 ÷ 0.5 = 4.
How to use this calculator
- Type or paste the values into the box. Commas, spaces, tabs and line breaks all work as separators, and decimals use a dot.
- Press Calculate. The result is rounded to four decimals, and whole numbers are shown without a decimal part.
A few cases behave in a particular way. If any value is exactly zero the harmonic mean is reported as 0, because 1/0 is undefined and the tool follows the usual convention of treating the whole mean as zero. If positive and negative values cancel so that the sum of reciprocals is zero (for example 1 and −1), a division-by-zero message is shown. Negative numbers are otherwise accepted and simply go through the formula. An entry without any digits is read as 0.
Worked examples
Average speed on a round trip. A courier drives 120 km out at 80 km/h and returns the same 120 km at 120 km/h. The trip takes 1.5 h plus 1 h, which is 2.5 h for 240 km, so the average speed is 240 ÷ 2.5 = 96 km/h. Entering 80 and 120 gives exactly that, whereas the arithmetic mean would wrongly say 100.
Three values. For 1, 2 and 4 the reciprocals are 1, 0.5 and 0.25, which add up to 1.75. Then H = 3 ÷ 1.75 = 12 ÷ 7 ≈ 1.7143. For comparison, the same data has an arithmetic mean of 2.3333 and a geometric mean of 2. For positive numbers the three averages always satisfy:
harmonic ≤ geometric ≤ arithmeticequality holds only when all the numbers are identical
You can compute the other two averages with the arithmetic mean calculator and the geometric mean calculator.
Weighted harmonic mean
When the values carry different weights w, each reciprocal is multiplied by its weight and the total weight replaces n:
H(w) = (w1 + w2 + … + wn) ÷ (w1/x1 + w2/x2 + … + wn/xn)
Example: a vehicle covers 100 km at 50 km/h and then 200 km at 100 km/h. With distances as weights, H = 300 ÷ (100/50 + 200/100) = 300 ÷ 4 = 75 km/h. This tool has no weight column, but whole-number weights can be imitated by repeating a value. Entering 50, 100, 100 (the 100 listed twice) gives 3 ÷ (0.02 + 0.01 + 0.01) = 75 as well.
Where the harmonic mean is used
- Investing. Spending the same amount at each purchase, say $100 a month at $8, $10 and $12.50 per share, buys 12.5 + 10 + 8 = 30.5 shares for $300. The average cost is $300 ÷ 30.5 ≈ $9.84 per share, which is the harmonic mean of the three prices (9.8361), not their arithmetic mean (10.17).
- Electronics. Resistors in parallel combine as the reciprocal of the sum of reciprocals. For 6 Ω and 3 Ω the total is 1 ÷ (1/6 + 1/3) = 2 Ω, which equals the harmonic mean (4) divided by the number of parts (2).
- Geometry. In a trapezoid with parallel sides a and b, the line segment through the intersection of the diagonals and parallel to the bases has length 2ab ÷ (a + b). With sides 10 and 15 that segment is 12 long.
- Machine learning. The F1 score combines precision and recall as their harmonic mean. Precision 0.8 with recall 0.5 gives about 0.6154, noticeably lower than the plain average of 0.65, which punishes imbalance between the two.
- Work rates. If one pump fills a tank in 6 hours and another in 3, together they take 2 hours, again a harmonic combination.
Limits and cautions
- The harmonic mean is dominated by the smallest values. One tiny number drags the result towards zero, which is useful for rates but surprising for other data.
- It is meant for positive quantities. Mixed signs can produce misleading answers such as a negative mean for a mostly positive list.
- It does not describe the centre of a typical data set the way the median does. Use it only when the numbers are rates or ratios whose reciprocals are meaningful.
Frequently asked questions
When should I use the harmonic mean instead of the arithmetic mean?
Use it when you average rates or ratios over equal amounts of the denominator, such as speeds over equal distances or prices paid with equal money. In that situation the harmonic mean gives the true overall rate.
Why does a zero in the list make the result 0?
The harmonic mean divides by the sum of reciprocals, and 1/0 is undefined. By convention a zero value pulls the mean down to zero, which is what this calculator reports.
Can the harmonic mean be larger than the arithmetic mean?
Not for positive numbers. The harmonic mean is never greater than the geometric mean, which in turn is never greater than the arithmetic mean. The three are equal only if all the numbers are the same.
How do I get the harmonic mean of two numbers quickly?
Use 2ab ÷ (a + b). For 3 and 6 that is 36 ÷ 9 = 4, with no need to take reciprocals.
References
- G. H. Hardy, J. E. Littlewood and G. Pólya, Inequalities, Cambridge University Press
Cite this calculator and page
If you use this page in your work, you can cite it as:
Reeliy Editorial Team. (2026). Harmonic Mean Calculator. Reeliy. https://reeliy.com/calculators/harmonic-mean-calculator“Harmonic Mean Calculator.” Reeliy, 2026, https://reeliy.com/calculators/harmonic-mean-calculator.