Harmonic Mean Calculator

StatisticsLast updated: August 22, 2026

The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals. It is the right average wherever a quantity is expressed 'per unit' of something else: hours per kilometer (speed), currency per item (unit cost), price per unit of earnings (P/E), and output per hour (productivity). For measurements like these the arithmetic mean is systematically wrong.

The classic example is a round trip: a car that drives out at 60 km/h and returns over the same road at 40 km/h averages 48 km/h, not 50, because it spends more time on the slow leg. Alongside the harmonic mean this calculator also reports the arithmetic and geometric means, confirms the AM ≥ GM ≥ HM inequality numerically, produces the weighted harmonic mean from optional weights, and shows each value's reciprocal contribution in a table.

Speeds, ratios, or per-unit values. All of them must be positive. Separate them with commas, spaces, or line breaks.
Enter as many weights as values, in the same order. A weight is the quantity over which that value applies: the distance travelled for a speed, the amount spent for a unit cost.

Harmonic Mean Formulas

Definition:        HM = n / Σ(1/xᵢ) = n / (1/x₁ + 1/x₂ + … + 1/xₙ)
Equivalent form:   1/HM = (1/n) · Σ(1/xᵢ)
Weighted:          HM_w = Σwᵢ / Σ(wᵢ/xᵢ)
For two values:    HM = 2·x₁·x₂ / (x₁ + x₂)
Round-trip speed:  v̄ = 2·v₁·v₂ / (v₁ + v₂)
Inequality:        HM ≤ GM ≤ x̄   (all xᵢ > 0)
Relation:          GM² = x̄ · HM   (exact equality for n = 2)

HARMEAN in Excel, 1/mean(1/x) in R, and the Harmonic Mean statistic in the SPSS Means menu all return the same result. The weighted form is identical to dividing the total quantity by the total cost or total time in per-unit measurements.

How to Calculate

  1. Type the rates or speeds you want to average into the box; every one of them must be positive.
  2. If the quantity over which each value applies differs (different distances, different amounts), fill in the weights box in the same order.
  3. Compare the harmonic mean with the arithmetic mean; the gap between them shows how spread out the values are.
  4. Check the table of reciprocals to see which observation contributes most to the denominator: the smallest value is always the dominant one.
  5. Sanity-check the result: the harmonic mean must always fall between the smallest and largest value, and below the arithmetic mean.
  6. State clearly which mean you used when reporting; for speed and unit-cost tables this distinction changes the result entirely.

Worked Examples

Average speed of a round trip

For a car driving out at 60 km/h and back at 40 km/h over the same road, the reciprocals sum to 1/60 + 1/40 = 0.041667, so the harmonic mean is 2 / 0.041667 = 48.0000 km/h. The arithmetic mean of 50 km/h is the wrong answer; the geometric mean is 48.9898, which confirms the ordering HM ≤ GM ≤ AM.

Number of values (n): 2 · Harmonic mean (HM): 48.0000 · Sum of the reciprocals Σ(1/xᵢ): 0.041667

Averaging price/earnings ratios

For the P/E ratios of four stocks the reciprocals sum to 0.213889, so the harmonic mean is 4 / 0.213889 = 18.7013. The arithmetic mean of 21.0000 sits 2.2987 points above it; for 'price per unit of earnings' ratios such as P/E, the harmonic mean is the correct index-level average.

Number of values (n): 4 · Harmonic mean (HM): 18.7013 · Sum of the reciprocals Σ(1/xᵢ): 0.213889

Weighted average unit price

If 1,000, 1,500, and 2,000 TL were spent at three stations charging 42, 45, and 48 TL per liter, then Σw = 4,500 and Σ(w/x) = 98.809524 liters, so the weighted harmonic mean is 4,500 / 98.809524 = 45.5422 TL per liter. The weighted arithmetic mean returns 45.6667 TL and thus overstates the average price actually paid per liter.

Number of values (n): 3 · Weighted harmonic mean: 45.5422 · Sum of the weights (Σwᵢ): 4,500

Frequently Asked Questions

When should the harmonic mean be used?
The harmonic mean is correct whenever the quantity being averaged is defined with the denominator of a ratio held constant. Average speed over equal distances, average unit price for equal amounts spent, an index-level P/E ratio, and output per hour are the typical cases. What they share is that the averaged value is expressed 'per' something.
Why is the average of 60 and 40 km/h 48 rather than 50?
Because the car spends more time on the slow leg, and time is what weights the average. Over a 120 km road the outward leg takes 2 hours and the return leg 3 hours; 240 km are covered in 5 hours, giving 240/5 = 48 km/h. The harmonic mean performs exactly this calculation as a shortcut.
What is the difference between the arithmetic, geometric, and harmonic means?
The arithmetic mean is for additive quantities (height, score, amount), the geometric mean for multiplicative ones (returns, growth rates), and the harmonic mean for ratios (speed, unit cost). For positive data the ordering HM ≤ GM ≤ AM always holds, and the three coincide only when every value is identical.
When should I use the weighted harmonic mean?
Weights are needed whenever the quantity over which each value applies differs. If different speeds were driven over different distances, the weight is the distance; if purchases were made for different amounts, the weight is the amount spent. When the weights are equal, the formula reduces to the ordinary harmonic mean.
What happens if the data contains zero or negative values?
A zero leaves the term 1/x undefined, so the harmonic mean cannot be computed and the calculator returns an error. In series that mix negative and positive values the sum of the reciprocals can approach zero and the result blows up meaninglessly. For such data, prefer the arithmetic mean or the median.
How is the harmonic mean computed in Excel and R?
In Excel the HARMEAN function returns the result directly and raises a #NUM! error if it sees a zero or a negative value. In R it is common to write 1/mean(1/x) rather than use a built-in function; harmonic.mean() from the psych package also works. In SPSS, Harmonic Mean is selected under Compare Means > Means.
Why is the F1 score a harmonic mean?
F1 is the harmonic mean of precision and recall. Because the harmonic mean lets the smaller value dominate, F1 stays low whenever either measure is very low, whereas an arithmetic mean would hide that imbalance. The same logic applies to any combination of ratios where balanced performance matters.