Skip to content
MoneyDeck

Harmonic Mean Calculator

Average rates and ratios correctly — with optional weights

Updated · Free, no signup

Separate with commas, spaces or new lines.

One weight per value, in the same order — e.g. the distance covered at each speed.

Harmonic mean

48

Count (n)

2

Arithmetic mean

50

Geometric mean

48.989795

Sum of (weight ÷ value)

0.041667

  • Harmonic mean = 2 ÷ 0.041667 = 48.
  • The arithmetic mean (50) is 4.17% higher than the harmonic mean — using it to average rates would overstate the true average.

Harmonic vs geometric vs arithmetic mean

Reciprocal working

#Value xWeight ww ÷ x
16010.016667
24010.025

About the Harmonic Mean Calculator

This harmonic mean calculator finds the right average for rates and ratios — speeds, prices per unit, P/E multiples, or anything expressed "per" something. Paste your values separated by commas, spaces or new lines and it returns the harmonic mean, the reciprocal of the average of reciprocals. It also shows the arithmetic and geometric means of the same numbers so you can see how far apart the three averages are.

Use it when every value covers the same amount of the "denominator": the average speed over two legs of equal distance, the average price paid when you invest the same amount of money each month (dollar-cost averaging), or the F1 score, which is the harmonic mean of precision and recall. Add weights when the legs are unequal — for example distances driven at each speed — and the calculator returns the weighted harmonic mean.

The harmonic mean is defined only for positive values here: a zero would make a reciprocal infinite and negative numbers make the result meaningless for rates. Non-numeric tokens are ignored. For positive data the harmonic mean is always less than or equal to the geometric mean, which is less than or equal to the arithmetic mean.

With the default inputs, the harmonic mean is 48. Change any value above to recalculate instantly.

How to use the harmonic mean calculator

  1. 1Paste or type your positive values, separated by commas, spaces or new lines.
  2. 2Optionally enter one weight per value, in the same order.
  3. 3Read the harmonic mean at the top of the results.
  4. 4Compare it with the arithmetic and geometric means in the chart.

Formula and method

H = n ÷ Σ(1/xᵢ) Weighted: H = Σwᵢ ÷ Σ(wᵢ/xᵢ)

The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals. Take 1/x for every value, average those reciprocals, then take the reciprocal of the result. Equivalently, divide the number of values by the sum of their reciprocals.

It is the correct average whenever the quantity being averaged is a rate and each value applies to the same amount of the denominator — equal distances for speeds, equal money for prices per share. When the amounts differ, weight each value by its share of the denominator (distance, money spent) to get the weighted harmonic mean. For positive data, H ≤ G ≤ A, with equality only when all values are identical.

H
Harmonic mean
n
Number of values
xᵢ
Each positive value (a rate or ratio)
wᵢ
Optional weight for each value

Worked examples

Round trip at 60 mph out and 40 mph back

For equal distances the average speed is the harmonic mean: 2 ÷ (1/60 + 1/40) = 2 ÷ 0.041667 = 48 mph. The arithmetic mean of 50 mph is wrong because you spend longer driving at the slower speed.

Dollar-cost averaging: same amount invested at four prices

Investing an equal sum at $25, $20, $32 and $40 per share gives an average cost of 4 ÷ (1/25 + 1/20 + 1/32 + 1/40) = 4 ÷ 0.14625 ≈ $27.35 per share — below the simple average price of $29.25, because you bought more shares when the price was low.

Weighted: 120 km at 80 km/h, then 30 km at 50 km/h

Weights are the distances. Total time is 120/80 + 30/50 = 1.5 + 0.6 = 2.1 hours for 150 km, so the average speed is 150 ÷ 2.1 ≈ 71.43 km/h.

Frequently asked questions

When should I use the harmonic mean instead of the average?+

Use the harmonic mean to average rates or ratios when each value covers the same amount of the denominator, such as speeds over equal distances, prices per share for equal investments, or price-to-earnings ratios of equally weighted holdings.

Why is the harmonic mean always smaller than the arithmetic mean?+

Taking reciprocals gives small values large influence, so the harmonic mean is pulled toward the smaller numbers. For any set of positive values, harmonic ≤ geometric ≤ arithmetic mean, with equality only when every value is the same.

Can the harmonic mean be calculated with zero or negative numbers?+

Not meaningfully. A zero has no reciprocal (1/0 is undefined) and negative values can make the sum of reciprocals zero or change sign. This calculator requires all values to be strictly positive.

Is the F1 score a harmonic mean?+

Yes. F1 = 2 × precision × recall ÷ (precision + recall), which is the harmonic mean of precision and recall. It punishes imbalance: precision 0.9 and recall 0.1 give an F1 of only 0.18.

How do I calculate a weighted harmonic mean?+

Divide the sum of the weights by the sum of each weight divided by its value: H = Σw ÷ Σ(w/x). For speeds, use the distance at each speed as the weight; the result equals total distance divided by total time.

Related tools