Harmonic Mean Calculator

Harmonic mean—
Count of numbers—

How Harmonic Mean Calculator is calculated: Harmonic mean = count ÷ sum of the reciprocals (1 ÷ each value)

What is a harmonic mean?

A harmonic mean is the average you use when the numbers are rates — speeds, prices per unit, or anything measured per something else. Divide the count by the sum of the reciprocals: for 2 and 4, the reciprocals are 0.5 and 0.25, their sum is 0.75, and 2 ÷ 0.75 = 2.67. For the default list — 10, 20, 30, 40, 50 — the harmonic mean is 21.9.

The classic example is average speed. Drive 60 kilometres at 30 km/h and another 60 at 60 km/h, and your average speed is not 45 — it is 40, because you spent twice as long at the slower speed. The harmonic mean gives 40, the ordinary mean gives 45, and the road does not care about the ordinary mean.

This calculator takes a list of numbers — separated by commas, spaces, or new lines — and returns the harmonic mean and the count. The result updates as you type. Nothing is uploaded, and there is no sign-up.

How a harmonic mean calculator works

The method has three steps. First, take the reciprocal of each value — 1 divided by the value. Second, add all the reciprocals together. Third, divide the count by that sum. For 2 and 4: the reciprocals are 1/2 = 0.5 and 1/4 = 0.25, the sum is 0.75, and 2 ÷ 0.75 = 2.67.

For the default list, the reciprocals are 0.1, 0.05, 0.0333, 0.025 and 0.02, which add up to 0.2283. Five divided by 0.2283 is 21.9, so the harmonic mean is 21.9 — lower than both the ordinary mean of 30 and the geometric mean of 26.05. That ordering is a law: for any list of positive numbers, the harmonic mean is the smallest of the three.

Equal values are a useful check. For 60 and 60, the reciprocals are 1/60 and 1/60, their sum is 2/60, and 2 ÷ (2/60) = 60. When every value is the same, all three means agree — and if they do not, something went wrong in the arithmetic.

Why the numbers must be positive

The harmonic mean only works on positive numbers, and the reason is in the formula. A zero in the list means dividing by zero to find its reciprocal, which is undefined. A negative value gives a negative reciprocal, and the sum can cancel out to zero — making the whole mean undefined — or produce a negative average for a list of positive-looking rates.

If any value in your list is zero or negative, the calculator shows a dash for the harmonic mean instead of a wrong number. That dash is the calculator refusing to guess. Fix the list — remove the zero, or check whether a negative value was a typo — and the mean will appear.

This rule is also a clue about when the harmonic mean fits. Speeds, rates and unit prices are naturally positive, so the tool fits them. Differences, profits and losses, and anything that crosses zero belong to the ordinary mean instead — use an average calculator for those.

A worked example: two speeds and the default list

Start with the default list: 10, 20, 30, 40, 50. The reciprocals add up to 0.2283, and 5 ÷ 0.2283 = 21.9. The harmonic mean of 21.9 is the lowest of the three means for this list: the ordinary mean is 30, the geometric mean is 26.05, and the harmonic mean is 21.9. The harmonic mean always leans hardest toward the small values.

Now the speed problem that makes the harmonic mean famous. Drive 60 kilometres at 30 km/h and 60 kilometres at 60 km/h. The reciprocals are 1/30 and 1/60, their sum is 0.05, and 2 ÷ 0.05 = 40. Your average speed over the whole 120 kilometres is 40 km/h, not 45 — because the slow leg took two hours and the fast leg took one.

Try three rates: 30, 60 and 90. The reciprocals are 0.0333, 0.0167 and 0.0111, adding up to 0.0611, and 3 ÷ 0.0611 = 49.09. The ordinary mean of the same three numbers is 60, which overstates the average rate by a wide margin whenever the distances are equal.

Where the harmonic mean actually gets used

Average speed is the textbook use, and it is a real one. Any journey split into equal distances at different speeds — a delivery route, a commute with a slow stretch and a fast stretch — needs the harmonic mean. The ordinary mean answers the wrong question: it averages the speeds as if equal time were spent at each, which is not how equal distances work.

Finance uses the harmonic mean for price-to-earnings ratios. Averaging the P/E ratios of several companies with the ordinary mean lets one expensive company dominate the result; the harmonic mean gives the correct average cost per rupee of earnings, which is what an investor comparing a basket of stocks actually wants.

Computing uses it for average rates too — the harmonic mean of several benchmark speeds is the standard way to average rates that were measured over the same amount of work. Whenever the denominator is fixed and the numerator varies, the harmonic mean is the right average, and a ratio calculator helps set up the numbers before you average them.

Fuel economy is another harmonic-mean job. A car that does 10 km per litre in the city and 20 km per litre on the highway does not average 15 km per litre over equal distances — the harmonic mean of 10 and 20 is 13.33, because the thirsty city leg burns more fuel per kilometre and covers the same distance more slowly in fuel terms.

Harmonic mean vs arithmetic mean

The arithmetic mean adds and divides; the harmonic mean flips, adds, and flips back. For 10, 20, 30, 40 and 50, the arithmetic mean is 30 and the harmonic mean is 21.9. The harmonic mean is always the smallest of the three classic means, unless every value is identical, when all three agree.

Use the arithmetic mean for things that add up — totals, bills, scores. Use the harmonic mean for rates over equal distances or equal amounts — speeds, unit prices, and work rates. Averaging two speeds of 30 and 60 arithmetically gives 45, but over equal distances the true average is 40, and the error grows as the speeds get further apart.

The geometric mean calculator sits between the two: it is the right average for things that multiply, like growth rates. The three means form a family — harmonic for rates, geometric for growth, arithmetic for totals — and each answers a question the others get wrong.

Common harmonic mean mistakes

The most common mistake is averaging speeds with the ordinary mean. Two equal-distance legs at 30 and 60 km/h average to 40 km/h, not 45. The ordinary mean only works for speeds when equal time is spent at each speed — a different question with a different answer.

The second mistake is including a zero. A zero speed means a reciprocal of 1 ÷ 0, which is undefined, and the whole calculation breaks. If a leg of the journey had zero speed, the vehicle was not moving, and the harmonic mean cannot describe a trip that includes standing still.

The third mistake is using the harmonic mean on plain quantities. Marks, heights and weights are not rates, and the harmonic mean of 70, 80 and 90 marks is 79.13 — a number with no useful meaning. The harmonic mean is for rates, and using it on ordinary measurements is a category error.

The fourth mistake is forgetting that the harmonic mean leans toward small values. A single slow leg dominates the average, which is correct for speeds but surprising if you expected a middle value. If the result looks too low, check the smallest value in the list — it is doing most of the work, and the percentage calculator can show how much time each leg actually took. A fifth mistake is mixing rates with different denominators. Speeds in km/h and miles per hour cannot be averaged together, and prices per kilo cannot be averaged with prices per item. Convert every rate to the same unit first, then take the harmonic mean, or the answer mixes two different things.

How to use this harmonic mean calculator

Paste or type your numbers into the box, separated by commas, spaces, or one per line. A column copied from a spreadsheet works as it is — just paste it in. All values must be greater than zero; if any value is zero or negative, the harmonic mean shows a dash and you should fix the list. The mean and the count update live as you type.

Check the count row first. If you pasted 12 numbers and the count says 11, one value did not parse — usually a thousands separator like 1,000, which the calculator reads as two numbers, 1 and 000. Remove the comma inside large numbers and the count will match.

Everything runs in your browser. No account, no upload, no data sent anywhere — your numbers never leave your device. Use it for speeds, rates, and unit prices, and pair it with the average calculator whenever you want to see how far the two means sit apart.

Frequently Asked Questions

The harmonic mean is 21.9. The reciprocals add up to 0.2283, and 5 ÷ 0.2283 = 21.9. It is the lowest of the three means for this list: the ordinary mean is 30 and the geometric mean is 26.05.

Because equal distances take different amounts of time at different speeds. Driving 60 km at 30 km/h and 60 km at 60 km/h takes two hours and one hour, so the average over 120 km is 40 km/h — the harmonic mean — not the ordinary mean of 45.

Because it divides 1 by each value. A zero makes 1 ÷ 0 undefined, and a negative value can make the reciprocals cancel out. If any value is zero or negative, the calculator shows a dash instead of a wrong number.

The harmonic mean is 2.67. The reciprocals are 0.5 and 0.25, their sum is 0.75, and 2 ÷ 0.75 = 2.67. The ordinary mean of 2 and 4 is 3, which is higher — the harmonic mean always leans toward the smaller value.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.