Harmonic Mean Calculator

Harmonic mean40.00
Arithmetic mean (for comparison)43.33
Geometric mean (for comparison)41.60
How this was calculated
  1. Take the reciprocal of each value: 0.0333, 0.0167, 0.0250 — these sum to 0.0750.
  2. The harmonic mean is the count divided by that sum: 3 ÷ 0.0750 = 40.00.
  3. It never exceeds the other means of the same numbers: harmonic 40.00 ≤ geometric 41.60 ≤ arithmetic 43.33.
  4. That is why it is the correct average for rates over equal distances or amounts — the average speed of a trip out at one speed and back at another, for instance, is the harmonic mean of the two speeds, not the midpoint.

This harmonic mean calculator computes the harmonic mean of any set of positive numbers you enter. The harmonic mean is defined as n divided by the sum of reciprocals: for values x1 through xn, HM = n / (1/x1 + ... + 1/xn). Enter your numbers and the calculator returns the result along with the full calculation. For instance, the values 30, 60 and 40 have a harmonic mean of 40.00, while 20 and 30 have a harmonic mean of 24.00 — the true average speed of a round trip made at those two speeds. Likewise, 10, 15, 20 and 30 have a harmonic mean of 16.00, compared with an arithmetic mean of 18.75.

The harmonic mean is the right average whenever the values are rates measured against a fixed amount of the denominator — speed over equal distances, price per unit over equal spending. For any set of positive numbers, harmonic is less than or equal to geometric, which is less than or equal to arithmetic, with equality only when all values are equal. The values 30, 60 and 40 illustrate this ordering: a harmonic mean of 40.00, a geometric mean of 41.60 and an arithmetic mean of 43.33. This page shows the formula, step-by-step workings, worked examples and sources so you can verify every result yourself.

Worked examples

The classic average-speed trap

Primary result: 40.00 — not the 43.33 midpoint, because more time is spent at the slow speed. (3 values · 30 · 60 · 40 · 0)

Harmonic mean40.00
Arithmetic mean (for comparison)43.33
Geometric mean (for comparison)41.60

Out at 20, back at 30

Primary result: 24.00 — the round trip averages 24, not 25. (2 values · 20 · 30 · 0 · 0)

Harmonic mean24.00
Arithmetic mean (for comparison)25.00
Geometric mean (for comparison)24.49

Four rates together

Primary result: 16.00 — well below the arithmetic mean of 18.75. (4 values · 10 · 15 · 20 · 30)

Harmonic mean16.00
Arithmetic mean (for comparison)18.75
Geometric mean (for comparison)17.32

The harmonic mean formula

The harmonic mean formula takes the number of values in your set and divides it by the sum of the reciprocals of those values. For values x1 through xn, the formula reads HM = n / (1/x1 + 1/x2 + ... + 1/xn). A reciprocal is simply 1 divided by the number, so the first step is to flip each value into its reciprocal, add those reciprocals together, and then divide the count of values by that sum. Our harmonic mean calculator applies this formula directly, so you can skip the manual arithmetic and still see exactly how the result is derived.

Walking through a concrete example makes the process clear. Take the values 30, 60, and 40. First find the reciprocal of each: 1/30 = 0.0333, 1/60 = 0.0167, and 1/40 = 0.025. Add those reciprocals together and you get 0.075. Now divide the number of values, which is 3, by that sum: 3 / 0.075 = 40.00. So the harmonic mean of 30, 60, and 40 is 40.00. For comparison, the same three values have a geometric mean of 41.60 and an arithmetic mean of 43.33, which illustrates a consistent mathematical relationship: for any set of positive numbers, harmonic is less than or equal to geometric, which is less than or equal to arithmetic, with equality only when all values are identical.

This ordering matters because it tells you when the harmonic mean is the right average to use. The harmonic mean is the correct choice whenever the values are rates measured against a fixed amount of the denominator. Speed over equal distances is the classic case: if you travel a round trip at 20 miles per hour one way and 30 miles per hour the other way, the true average speed is not 25 but 24.00, which is exactly the harmonic mean of 20 and 30. The same logic applies to price per unit over equal spending and similar rate-based problems where the denominator stays constant across each measurement.

The formula also scales to larger sets without changing the method. For the values 10, 15, 20, and 30, you would again take each reciprocal, sum them, and divide 4 by that sum. The result is a harmonic mean of 16.00, notably lower than the arithmetic mean of 18.75 for the same set. That gap widens as the values spread further apart, which is why using the wrong average can materially distort rate-based conclusions. The reciprocal-sum structure is what pulls the result toward the smaller values in the set, reflecting the fact that a slow leg of a trip or a low rate of return has a disproportionate effect on the overall average.

Worked examples

The table below shows three verified cases side by side. Each row lists the input values, the harmonic mean, the geometric mean (where available), and the arithmetic mean so you can see exactly how the three averages differ. Running these same inputs through any harmonic mean calculator should reproduce the same results.

The first example uses 30, 60, and 40 — three values that produce a harmonic mean of 40.00, a geometric mean of 41.60, and an arithmetic mean of 43.33. The second example uses 20 and 30, which yield a harmonic mean of 24.00. That second case is the classic round-trip speed problem: if you travel the same distance at 20 miles per hour and then return at 30 miles per hour, your true average speed for the entire trip is 24.00, not 25. The arithmetic mean of 20 and 30 is 25, but that figure overstates your actual speed because you spend more time moving at the slower speed.

The third example uses 10, 15, 20, and 30, which produce a harmonic mean of 16.00 against an arithmetic mean of 18.75. The gap between the two averages is substantial — nearly 3 full points — and it illustrates why choosing the wrong average can lead to a noticeably different answer.

  • For any set of positive numbers, harmonic ≤ geometric ≤ arithmetic, with equality only when all values are equal.
  • The harmonic mean is the right average whenever the values are rates measured against a fixed amount of the denominator — speed over equal distances, price per unit over equal spending.
Input valuesHarmonic meanGeometric meanArithmetic mean
30, 60, 4040.0041.6043.33
20, 3024.00—25.00
10, 15, 20, 3016.00—18.75

The average-speed problem

Suppose you drive to a destination at 20 miles per hour and return along the same route at 30 miles per hour. What is your average speed for the entire round trip? The instinctive answer is 25 — the ordinary midpoint of 20 and 30 — but that answer is wrong. The true average speed is 24.00, and a harmonic mean calculator will show you why.

The reason is that the two speeds do not last for equal amounts of time. You spend more hours traveling at the slower speed than you do at the faster speed, so 20 mph pulls the average down below the simple midpoint of 25. A harmonic mean accounts for this imbalance by weighting each speed according to how much time it actually occupies. For values x1 through xn, the formula is HM = n / (1/x1 + ... + 1/xn). Plug in 20 and 30 and you get 2 / (1/20 + 1/30), which equals 24.00.

This principle extends to any situation involving rates measured against a fixed amount of the denominator. Speed over equal distances is the classic example: each leg of the trip covers the same number of miles, so the denominator — distance — stays constant while the numerator — time — varies. The same logic applies to price per unit when you spend equal amounts of money at different prices. In every case, the harmonic mean is the correct average because it reflects the actual time or cost involved, not just the numerical spread of the values.

It is worth noting that the harmonic mean is always the lowest of the three common averages. For any set of positive numbers, harmonic is less than or equal to geometric, which is less than or equal to arithmetic, with equality only when every value is identical. So when you see a simple average that seems too high for a rates problem, that gap is not a rounding error — it is a sign you may need the harmonic mean instead.

The harmonic mean is the right average whenever the values are rates measured against a fixed amount of the denominator — speed over equal distances, price per unit over equal spending.

Harmonic, geometric and arithmetic means compared

For any set of positive numbers, the harmonic mean is always less than or equal to the geometric mean, which is always less than or equal to the arithmetic mean. Equality happens only when every value in the set is identical. To see this relationship in concrete terms, take the values 30, 60, and 40. Their harmonic mean is 40.00, their geometric mean is 41.60, and their arithmetic mean is 43.33. The gap between these three figures is not a rounding artifact — it reflects a real mathematical hierarchy that holds for every possible set of positive inputs you could enter into a harmonic mean calculator.

The reason this hierarchy matters is that each mean answers a different question. The arithmetic mean is the right choice when you are averaging independent quantities — for example, the daily temperatures over a week. The geometric mean is the right choice when you are averaging multiplicative growth — for example, year-over-year investment returns. The harmonic mean is the right choice whenever the values are rates measured against a fixed amount of the denominator.

Consider a round trip where you travel one direction at 20 miles per hour and return at 30 miles per hour over the same distance. The harmonic mean of 20 and 30 is 24.00, and that is the true average speed of the entire trip. The arithmetic mean of 25 would overstate your speed because it fails to account for the fact that you spent more time traveling at the slower speed. The same logic applies to price per unit calculations: if you spend an equal amount of money at several stores with different unit prices, the harmonic mean gives you the true average price per unit.

The size of the gap between these means grows as the values become more spread out. For the values 10, 15, 20, and 30, the harmonic mean is 16.00 while the arithmetic mean is 18.75 — a difference of nearly three full units. When the values are close together, as with 30, 60, and 40, the three means cluster more tightly at 40.00, 41.60, and 43.33. Understanding this pattern helps you recognize when using the wrong mean would materially distort your result and when the choice among the three is less critical.

The harmonic mean is the honest average whenever you are working with rates — like speeds over equal distances or prices over equal spending — because it correctly weights each value by the time or quantity it represents.

Where the harmonic mean is used

The harmonic mean is the right average whenever the values are rates measured against a fixed amount of the denominator — speed over equal distances, price per unit over equal spending. A harmonic mean calculator applies the formula HM = n / (1/x1 + ... + 1/xn), which weights smaller values more heavily than the arithmetic mean does. That makes it the correct tool, not merely an alternative, in several practical fields.

The most familiar case is average speed on a round trip. If you drive one leg at 20 mph and the return leg at 30 mph, the true average speed of the trip is 24.00 mph, not the arithmetic mean of 25 mph. The arithmetic mean overstates the result because you spend more time at the slower speed. The harmonic mean accounts for the time weighting automatically, giving the correct answer whenever equal distances are traveled at different rates.

Beyond average speed, the harmonic mean appears in finance, science, and engineering. Price-earnings style ratios, such as a portfolio's average P/E across equal dollar investments, require the harmonic mean because each holding contributes equally in dollars rather than equally in shares. Material densities combined over equal volumes, and electrical resistors or conductors arranged in parallel, follow the same reciprocal-based logic. In machine learning, the F1 score — the standard measure combining precision and recall — is a harmonic mean, chosen specifically because it penalizes extreme imbalance between the two values.

What ties these uses together is the relationship between the averages. For any set of positive numbers, harmonic <= geometric <= arithmetic, with equality only when all values are equal. That ordering explains why the harmonic mean gives a lower, more conservative result than the arithmetic mean whenever the data are rates. For example, 10, 15, 20, and 30 have a harmonic mean of 16.00 against an arithmetic mean of 18.75. Similarly, 30, 60, and 40 have a harmonic mean of 40.00, a geometric mean of 41.60, and an arithmetic mean of 43.33. The spread among the three averages widens as the values diverge, and the harmonic mean always sits closest to the smallest value in the set.

When not to use it

A harmonic mean calculator will fail the moment you feed it a zero, because the formula divides by each value in turn. Recall that the harmonic mean equals n divided by the sum of reciprocals: for values x1 through xn, HM = n / (1/x1 + ... + 1/xn). Plug in zero and the term 1/0 is undefined, so the whole expression collapses. Negative values are just as damaging, since their reciprocals flip the sign and can make the denominator sum to zero or produce a nonsensical result. The tool is built strictly for positive numbers, and any dataset containing a zero or a negative number is a signal to choose a different average.

The other common mistake is reaching for the harmonic mean when the question is really about a plain total. If you want the average of several test scores, monthly sales figures, or temperatures, the arithmetic mean is the correct choice. The harmonic mean is the right average whenever the values are rates measured against a fixed amount of the denominator, such as speed over equal distances or price per unit over equal spending. When that structure is absent, applying the harmonic mean will understate the true center of the data.

The reason it understates is mathematical, not accidental. For any set of positive numbers, harmonic is less than or equal to geometric, which is less than or equal to arithmetic, with equality only when all values are equal. The verified example of 30, 60 and 40 illustrates this clearly: the harmonic mean is 40.00, the geometric mean is 41.60, and the arithmetic mean is 43.33. Because the harmonic mean sits at the bottom of that chain, using it on data that is not rate-based pulls the reported average downward and gives a misleading figure.

A larger set shows the same gap. The values 10, 15, 20 and 30 have a harmonic mean of 16.00 against an arithmetic mean of 18.75, a difference of 2.75. That spread is acceptable when each number represents a rate tied to a fixed denominator, but it distorts the picture when the numbers are simply quantities to be averaged together. Knowing when the harmonic mean does not apply is as important as knowing when it does.

  • Never include zero in the dataset: 1/0 is undefined and the calculation cannot proceed.
  • Never include negative values: their reciprocals can zero out the denominator or return a meaningless result.
  • Use the arithmetic mean for plain totals and counts, such as scores, revenues, or temperatures.
  • Reserve the harmonic mean for rates measured against a fixed denominator, such as speeds over equal distances.
If the data contains a zero or a negative number, or if the values are simple quantities rather than rates, switch to the arithmetic mean. The harmonic mean is not a substitute for it.

FAQs

How do you calculate the harmonic mean?

Divide the count by the sum of reciprocals: 3 / (1/30 + 1/60 + 1/40) = 3 / 0.0750 = 40.00. You take the reciprocal of each value, add them together, then divide the total number of values by that sum to get the harmonic mean.

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

Use the harmonic mean for rates over equal amounts of the denominator. For example, a round trip at 20 and 30 averages 24.00, not the arithmetic 25. The harmonic mean gives the correct result when you are averaging rates or ratios where the denominator quantities are equal.

Is the harmonic mean always smaller than the arithmetic mean?

Yes, for positive values: 40.00 versus 43.33 in the first case, and 16.00 versus 18.75 in the third. They are equal only when all values match. This relationship holds consistently across positive data sets, making the harmonic mean the lowest of the common averages.

What is the harmonic mean of 20 and 30?

The harmonic mean of 20 and 30 is 24.00. The calculation is 2 / (1/20 + 1/30) = 2 / 0.0833. You take the reciprocal of each number, add them together, then divide the count of values by that sum to arrive at the result.

Can the harmonic mean handle zero?

No. Since 1/0 is undefined, every value must be positive. That is a real limitation, not a technicality. If any value in your data set is zero, the harmonic mean cannot be calculated because the reciprocal of zero does not exist, which breaks the formula entirely.

Where is the harmonic mean used in real life?

The harmonic mean is used for average speeds, average price per share when equal money is invested, parallel resistances, and the F1 score that balances precision and recall. These applications all involve rates or ratios where equal amounts of the denominator make the harmonic mean the correct averaging method.

Sources

Related calculators

Average Calculator
Mean, median, mode, range, sum and count for 2 to 8 numbers — the full descriptive-statistics starter set in one pass.
Geometric Mean Calculator
The multiplicative average of two, three or four numbers — the right mean for growth rates and ratios — shown next to the arithmetic mean.
Weighted Average Calculator
A weighted average of up to five values — course grades, portfolio returns, survey scores — where each value counts in proportion to its weight.
Mean Median Mode Calculator
Mean, median, mode, range and sum for up to ten numbers — with the sorted list and the working shown, so the three 'averages' finally make sense.