Harmonic Mean Calculator
Enter six non-zero values to find their harmonic mean.
What the harmonic mean is
This calculator adds the reciprocals of six values and divides 6 by that sum. The result is the harmonic mean, the average built for rates: speeds, prices per unit, and any ratio where the numerator is fixed and the denominator varies. At the defaults 2, 4, 6, 8, 10 and 12, the reciprocals sum to 1.225 and the harmonic mean is 4.9, well below the arithmetic mean of 7 for the same numbers.
How the formula works
Read the formula from the inside out. Each reciprocal 1/xi flips a rate into a per-unit quantity: miles per gallon becomes gallons per mile, price per share becomes shares per dollar. Averaging those flipped quantities arithmetically and flipping back gives the harmonic mean. That flip is what makes it the correct average when equal weights attach to the denominator side of a rate rather than the numerator side.
The harmonic mean is the most pull-sensitive of the three classical means: small values dominate it. For the defaults, the arithmetic mean is 42 ÷ 6 = 7, the geometric mean of the same six values is about 5.99, and the harmonic mean is 4.9, satisfying the ordering HM ≤ GM ≤ AM. A single small input drags the harmonic mean down hard: replacing the 2 with a 1 while keeping the rest drops the result to 6 ÷ (1 + 0.25 + 0.166667 + 0.125 + 0.1 + 0.083333) = 6 ÷ 1.725 ≈ 3.48.
Worked example with the default inputs
Take the reciprocals one at a time: 1/2 = 0.5, 1/4 = 0.25, 1/6 = 0.166667, 1/8 = 0.125, 1/10 = 0.1, 1/12 = 0.083333. Add them: 0.5 + 0.25 = 0.75; 0.75 + 0.166667 = 0.916667; 0.916667 + 0.125 = 1.041667; 1.041667 + 0.1 = 1.141667; 1.141667 + 0.083333 = 1.225. Divide the count by the sum: HM = 6 ÷ 1.225 = 4.898 ≈ 4.9.
A precise fractional version confirms it: the reciprocals of 2, 4, 6, 8, 10, 12 sum to 49/40 exactly, so HM = 6 × 40/49 = 240/49 ≈ 4.898. The displayed 4.9 is that fraction rounded.
The classic speed problem
| Trip legs | Speeds | Correct average | Arithmetic mean (wrong) |
|---|---|---|---|
| Two legs of equal distance | 60 and 40 mph | 48 mph | 50 mph |
| Two legs of equal distance | 30 and 90 mph | 45 mph | 60 mph |
| Six equal-distance legs | 2, 4, 6, 8, 10, 12 mph | 4.9 mph | 7 mph |
Verify the first row by hand: 60 mph and 40 mph over the same distance, say 120 miles each. Time out is 120 ÷ 60 = 2 hours; time back is 120 ÷ 40 = 3 hours. Total 240 miles in 5 hours gives 240 ÷ 5 = 48 mph, exactly the harmonic mean 2 ÷ (1/60 + 1/40) = 2 ÷ 0.0416667 = 48. The arithmetic mean of 50 mph overstates the true pace because more clock time is spent at the slower speed.
When to use it
- Average speeds over equal distances, as in the table above.
- Average price paid with equal dollars per purchase: buying $1,000 of a stock at P/E 20 and $1,000 at P/E 30 gives a blended P/E of 24, the harmonic mean of 20 and 30.
- Machine throughput: a pipeline alternating 100 and 200 jobs per hour processes 2 ÷ (1/100 + 1/200) = 133.3 jobs per hour, not 150.
- Any rate where the denominator varies and the numerator is fixed, such as gallons per mile, seconds per item or dollars per mile.
The P/E example worked out
Invest $1,000 each into two stocks with price-to-earnings ratios of 20 and 30. You buy $50 of earnings exposure at the first price and $33.33 at the second, so $2,000 buys $83.33 of earnings. The blended P/E is 2,000 ÷ 83.33 = 24, which equals 2 ÷ (1/20 + 1/30) = 2 ÷ 0.0833333 = 24. Averaging 20 and 30 arithmetically to 25 would quietly overstate how much earnings each dollar bought.
Common mistakes
- Using it for speeds over equal times instead of equal distances: if you drive 1 hour at 60 mph and 1 hour at 40 mph, the arithmetic mean 50 mph is correct, and the harmonic mean would be wrong. The weighting decides which mean applies.
- Including zero: 1/0 is undefined, and the compute skips zero inputs, so a set containing 0 gives a result over five values rather than six. Replace zeros before drawing conclusions.
- Mixing signs: with positive and negative values the reciprocal sum can approach zero or cancel, producing meaningless magnitudes. Keep all inputs the same sign.
- Reporting the reciprocal sum as the answer: the intermediate 1.225 at the defaults is not the mean; the division 6 ÷ 1.225 is what produces 4.9.
How the three means compare
Choosing among the three
For any positive data set the ordering is fixed: harmonic ≤ geometric ≤ arithmetic, with equality only when every value is identical. The spread between them grows with relative dispersion. On the defaults the three values are 4.9, 5.99 and 7, and the spread explodes if you widen the data to 2, 4, 6, 8, 10 and 100, where the harmonic mean falls to 6 ÷ (0.5 + 0.25 + 0.166667 + 0.125 + 0.1 + 0.01) = 6 ÷ 1.151667 ≈ 5.21 while the arithmetic mean climbs to 21.67. The geometric mean calculator handles the middle case when growth rates rather than per-unit rates are involved.
Frequently asked questions
Why does the harmonic mean matter for speed?
When each leg covers the same distance, average speed is the harmonic mean of the leg speeds. Two 120-mile legs at 60 and 40 mph take 5 hours total, so 240 miles ÷ 5 hours = 48 mph, exactly what 2 ÷ (1/60 + 1/40) returns.
What is the harmonic mean of 2, 4, 6, 8, 10 and 12?
The reciprocals sum to 1.225, and 6 ÷ 1.225 ≈ 4.9. In exact fractions the sum is 49/40, so the mean is 240/49 ≈ 4.898.
Can values be zero?
No. The reciprocal of zero is undefined. The calculator skips zero inputs and divides by six regardless, so remove or replace zeros before trusting the result.
How does it compare to other means?
For positive values, harmonic ≤ geometric ≤ arithmetic always. On the defaults the three are 4.9, about 5.99, and 7, and they coincide only when all inputs are equal.
Why is the harmonic mean smaller than the arithmetic mean?
It weights small values more heavily because reciprocals of small numbers are large. Changing the default 2 into a 1 drops the result from 4.9 to about 3.48, while the arithmetic mean would move from 7 to only 6.17.
When should I use the arithmetic mean for speeds?
When the time spent is equal rather than the distance. One hour at 60 mph plus one hour at 40 mph covers 100 miles in 2 hours, exactly 50 mph, so the simple average applies.
What is a harmonic mean P/E?
For equal dollar amounts invested, the blended price-to-earnings ratio is the harmonic mean. Equal money at P/E 20 and P/E 30 blends to 2 ÷ (1/20 + 1/30) = 24, not 25, because your dollars buy more earnings at the cheaper ratio.
Does the order of the six values change the result?
No. Addition of reciprocals is commutative, so 2, 4, 6, 8, 10, 12 entered in any order still sums to 1.225 and returns 4.9.
Method and sources
- Harmonic mean definition HM = n / sum(1/x_i).