Harmonic Mean Calculator

Calculate the harmonic mean of a set of positive numbers, the correct average for speeds, rates and price-earnings ratios.

Separate values with commas, spaces or new lines.
Harmonic mean 48
HM = n / (1/x₁ + 1/x₂ + … + 1/xₙ)
Arithmetic mean 50
HM = n / (1/x₁ + 1/x₂ + … + 1/xₙ)
Geometric mean 48.98979486
HM = n / (1/x₁ + 1/x₂ + … + 1/xₙ)
Values 2
Sum of reciprocals 0.04166667
Status HM ≤ GM ≤ AM, as always for positive numbers.

Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.

What the Harmonic Mean Calculator does

The harmonic mean calculator on this page will calculate the harmonic mean of a set of positive numbers, the correct average for speeds, rates and price-earnings ratios. Fill in the single field and the result updates as you type — there is no Calculate button to press and no page reload. It is most often used for average speed over equal distances travelled at different speeds. For a second version of this harmonic mean calculator, see FreeToolsWorld.org.

How to use it

  1. Paste the rates you want to average, separated by commas, spaces or new lines.
  2. Check that what is constant between them is the numerator — equal distances, equal jobs, equal output.
  3. Read the harmonic mean, with the arithmetic and geometric means shown for comparison.
  4. If the three means are far apart, your values are highly variable and the choice of mean matters a great deal.

How it works

The harmonic mean is the reciprocal of the average of the reciprocals, and it is the right average whenever the numbers are rates with a fixed numerator. The classic case is average speed over equal distances: drive 60 km out at 60 km/h and back at 40 km/h and your average speed is not 50 but 48 km/h, because you spent more time on the slow leg. The harmonic mean of 60 and 40 is exactly 48.

The test for which mean to use is what stays constant. Equal distances at different speeds call for the harmonic mean. Equal times at different speeds call for the arithmetic mean. Compounding factors call for the geometric mean. Using the wrong one is not a rounding issue — it produces a confidently wrong answer, and it always errs in the same direction, because for positive numbers HM ≤ GM ≤ AM.

Outside travel, the harmonic mean is what you want for averaging price-to-earnings ratios across a portfolio, for parallel resistance and parallel pipe flow, for combining work rates — two people finishing a job in 4 and 6 hours — and for the F1 score in machine learning, which is deliberately the harmonic mean of precision and recall so that a model cannot score well by sacrificing one of them.

When to use it

  • Average speed over equal distances travelled at different speeds.
  • Combining work rates when several people do the same job at different paces.
  • Averaging P/E ratios across holdings.
  • Calculating an F1 score from precision and recall.

Common mistakes to avoid

  • Using the arithmetic mean for speeds over equal distances, which always overstates the average.
  • Including a zero. One zero rate means infinite time and no finite average exists.
  • Applying the harmonic mean when the times are equal rather than the distances — then the plain arithmetic mean is correct.

Frequently asked questions

Why is the average of 60 and 40 km/h not 50?

Because you travel at 40 for longer. Over 120 km each way, the fast leg takes 2 hours and the slow one 3, so 240 km in 5 hours — 48 km/h. The arithmetic mean would only be right if you spent equal time at each speed.

When should I not use the harmonic mean?

Whenever the quantity being held constant is the denominator rather than the numerator. Averaging prices, heights or test scores calls for the arithmetic mean; averaging compounding growth factors calls for the geometric mean.

Can it handle negative numbers?

Not meaningfully. Reciprocals of mixed-sign values can cancel and produce an enormous or negative "mean" that describes nothing, so this page requires positive values.

Related tools

See all math & statistics calculators →