Harmonic Mean Calculator screenshot

Harmonic Mean Calculator

n divided by the sum of reciprocals, for rates and per-unit averages, with the arithmetic mean beside it.

Privacy First
0 Runs
Updated 2026-11-21
Runs in your browser
No sign-up, no upload

What the harmonic mean calculator does

It divides the number of values by the sum of their reciprocals: HM = n ÷ Σ(1/x). That is the average a rate needs — averaging speeds over equal distances, or prices over equal spend — where the arithmetic mean would overstate the answer. The series 2, 4, 4, 4, 5, 5, 7, 9 has a reciprocal sum of 1.903968254 and a harmonic mean of 4.201750729, beside an arithmetic mean of 5.

The two means are printed together on purpose: the harmonic mean is never larger than the arithmetic mean for positive values, and seeing both makes the difference a number rather than a claim.

Every value must be greater than 0, which also keeps the reciprocal sum away from zero. The page names a zero or negative value rather than returning an infinity, refuses a series longer than 100 000 values with the count, and refuses a line that is not a number with its line number.

Figures print to ten significant figures with trailing zeros trimmed.

How to use it

Paste your data into the text box, one positive value per line.

Press Run. The result prints n, the reciprocal sum, the harmonic mean and the arithmetic mean for contrast.

Worked example

Input with the default series:

2
4
4
4
5
5
7
9

Output:

n:              8
Reciprocal sum: 1.903968254 (Σ 1/x)
Harmonic mean:  4.201750729 (n ÷ reciprocal sum)
Arithmetic mean: 5 (for contrast)

Why it runs in your browser

The reciprocals are summed in this tab. Your data is never uploaded.

The page divides the number of values by the sum of their reciprocals: n ÷ Σ(1/x). The eight values 2, 4, 4, 4, 5, 5, 7, 9 have a reciprocal sum of 1.903968254 and a harmonic mean of 4.201750729.

The arithmetic mean is printed beside it, because the harmonic mean is the right average for rates — speeds over equal distances, prices over equal spend — and seeing both makes the difference a number rather than a claim.

Every value must be greater than zero. A zero is refused by name, since its reciprocal has no value and would take the whole answer with it.

Why a rate needs the harmonic mean

Travel 60 km at 60 km/h and 60 km back at 30 km/h. The trip takes an hour and then two hours, so the average speed over the 120 km is 40 km/h — not the arithmetic mean of 45. The harmonic mean of 60 and 30 is 40, because the fixed quantity is the distance and the time is what adds.

The same structure appears wherever a rate is averaged over a fixed amount of the denominator: kilometres per litre over equal distances, price per item over equal spend, resistance of parallel resistors. The page computes the mean of the reciprocals and inverts it once.

The positivity rule, and the other mean beside it

A reciprocal exists for every non-zero value, but a negative value makes the sum and the answer hard to interpret, and a zero makes it undefined. The page requires positive values, which is the domain where the harmonic mean is a rate average.

The arithmetic mean is printed on the same answer so the comparison is immediate: for positive values the harmonic mean never exceeds it, and the gap widens as the values spread. The page does not choose between the means; it computes both and names what each is for.

How to use Harmonic Mean Calculator

Paste your data into the text box, one positive value per line.

The text box takes the values as rates or amounts; the page sums their reciprocals, so no conversion is applied.

Press Run. The result prints n, the reciprocal sum, the harmonic mean and the arithmetic mean for contrast.

What to Expect

Best for

  • Averaging speeds over equal distances
  • Averaging prices paid over equal amounts spent
  • Combining rates that share a fixed denominator

Not ideal for

  • A series with a zero or a negative value
  • Averaging values that add rather than invert, where the arithmetic mean is right
  • A weighted series, which needs weighted reciprocals

What this tool keeps

  • The values you pasted and their count
  • The reciprocal sum, so the answer can be recomputed

What may need cleanup

  • A speed in minutes per kilometre, which has to become kilometres per hour first
  • Values separated by commas, which have to become one per line

Common errors

  • Using the arithmetic mean for a rate averaged over a fixed distance
  • Mixing units in one series, such as km/h and mph

Example use cases

  • Averaging the speed of a there-and-back trip
  • Averaging a share's cost over equal purchases
  • Checking a parallel-resistance figure by hand

Sample input

The eight values 2, 4, 4, 4, 5, 5, 7, 9, one per line.

Sample output

n = 8, reciprocal sum 1.903968254, harmonic mean 4.201750729, arithmetic mean 5.

Who this is for

  • Anyone averaging a rate over a fixed quantity
  • Students learning why the means differ

Frequently asked questions

Why is the harmonic mean smaller than the arithmetic mean?

For positive values it always is, unless every value is equal. The reciprocal gives more weight to small values, which is exactly what a rate average needs: a slow leg takes more time and should count for more.

When should I use it instead of the arithmetic mean?

Use it when the quantity that stays fixed is the denominator — a distance at a speed, an amount at a price. Use the arithmetic mean when the values themselves add, such as the heights of a group of people.

Why is a zero refused?

The reciprocal of zero has no value, and one zero would make the answer zero for the wrong reason. The page names the zero rather than printing a number that cannot be interpreted.

Does it work for parallel resistors?

Yes. The parallel resistance of several resistors is the reciprocal of the sum of their conductances, which is the harmonic mean divided by n. The page prints the reciprocal sum, so the resistance follows in one more step.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.