Harmonic Mean Calculator

Calculate the harmonic mean of any dataset - or find the true average speed for a round trip.

⟨⟩ Harmonic Mean Calculator
Values (comma or line separated, all positive)

⟨⟩ What is Harmonic Mean?

The harmonic mean is a type of average calculated by dividing the count of values by the sum of their reciprocals. It is the reciprocal of the arithmetic mean of the reciprocals. For a set of values x₁, x₂, …, xₙ: HM = n ÷ (1/x₁ + 1/x₂ + … + 1/xₙ). Like all means, it produces a single representative value for a dataset - but it does so in a way that gives proportionally more weight to smaller values.

The harmonic mean is the correct average to use for rates - quantities measured as "something per unit of something else" - when the denominator quantity (the unit) is constant across measurements. The most intuitive example is average speed. If you drive 100 km at 60 km/h and 100 km at 40 km/h, you spend more time driving at 40 km/h (2.5 hours) than at 60 km/h (1.67 hours). The total is 200 km in 4.17 hours = 48 km/h. The harmonic mean gives exactly this: HM(60, 40) = 2 × 60 × 40 / (60 + 40) = 4800/100 = 48 km/h. The arithmetic mean of 50 km/h is wrong.

In the hierarchy of means, the harmonic mean is always the smallest: HM ≤ GM ≤ AM (AM-GM-HM inequality). The harmonic mean represents the "lower bound" of averages, and the gap between HM and AM grows as values become more spread out. This inequality is one of the fundamental results in classical mathematics, appearing in optimization, inequalities, and physics.

Practical applications of the harmonic mean include: average price-per-share in dollar-cost averaging, fuel efficiency averages (miles per gallon), parallel resistance in electronics, average P/E ratios in financial analysis, and pharmacokinetic averages in medicine. Any time equal portions are divided at different rates, the harmonic mean is the correct tool.

📐 Formula

HM = n ÷ (1/x1 + 1/x2 + … + 1/xn)
x1, x2, …, xn = the n positive values
n = the count of values
Example: HM of 4, 8, 16 = 3 ÷ (1/4 + 1/8 + 1/16) = 3 ÷ 0.4375 ≈ 6.857
Average Speed = 2 × v1 × v2 ÷ (v1 + v2)
v1 = speed on the outward leg
v2 = speed on the return leg
This is the harmonic mean of v1 and v2 - valid when both legs cover equal distances.
Example: 60 km/h outward, 40 km/h return → Avg speed = 2×60×40 / 100 = 48 km/h
AM ≥ GM ≥ HM
The AM-GM-HM inequality: arithmetic mean ≥ geometric mean ≥ harmonic mean for any set of positive values. Equality holds only when all values are identical.

📖 How to Use This Calculator

Steps to Calculate Harmonic Mean

1
Select a mode: "List of Values" for a general dataset of positive numbers, or "Average Speed" for a two-leg journey where both legs cover equal distances.
2
Enter your values. In list mode, type comma-separated positive numbers (e.g., 4, 8, 16). In speed mode, enter the speed for the outward journey and the return journey.
3
Click Calculate to see the harmonic mean, geometric mean, and arithmetic mean together. The AM-GM-HM inequality is shown as a verification note.

💡 Example Calculations

Example 1 — Harmonic Mean of a List

Find the harmonic mean of 3, 6, 9

1
Reciprocals: 1/3 + 1/6 + 1/9 = 6/18 + 3/18 + 2/18 = 11/18 ≈ 0.6111
2
HM = 3 ÷ 0.6111 ≈ 4.909
3
AM = (3+6+9)/3 = 6  ·  GM = (3×6×9)1/3 = 1621/3 ≈ 5.451
HM ≈ 4.909 ≤ GM ≈ 5.451 ≤ AM = 6 ✓ — AM-GM-HM inequality holds
Try this example →

Example 2 — Average Speed for a Round Trip

Drive 100 km at 60 km/h, return 100 km at 40 km/h

1
Time outward: 100/60 = 1.667 h  ·  Time return: 100/40 = 2.5 h  ·  Total time: 4.167 h
2
True average speed = 200 km ÷ 4.167 h = 48 km/h
3
HM(60, 40) = 2×60×40 / (60+40) = 4800/100 = 48 km/h
Average speed = 48 km/h. The arithmetic mean of 50 km/h overstates average speed by 4.2%.
Try this example →

Example 3 — Harmonic Mean for Fuel Efficiency

Car gets 25 mpg in city, 40 mpg on highway - equal distances driven

1
HM = 2 × 25 × 40 / (25 + 40) = 2000 / 65 ≈ 30.77 mpg
2
Arithmetic mean: (25 + 40) / 2 = 32.5 mpg - overestimates actual fuel efficiency
True average fuel efficiency = 30.77 mpg, not 32.5 mpg. Harmonic mean gives the correct answer.
Try this example →

Example 4 — Five-Value Dataset with AM-GM-HM Comparison

Values: 2, 5, 10, 20, 50 - verify the three-means inequality

1
AM = (2+5+10+20+50) / 5 = 87/5 = 17.4
2
GM = (2×5×10×20×50)1/5 = 1000000.210
3
HM = 5 / (1/2 + 1/5 + 1/10 + 1/20 + 1/50) = 5 / 0.87 ≈ 5.747
HM (5.747) ≤ GM (10) ≤ AM (17.4) ✓ — The three means diverge as values spread out.
Try this example →

❓ Frequently Asked Questions

What is the formula for harmonic mean?+
Harmonic Mean = n ÷ (1/x₁ + 1/x₂ + ... + 1/xₙ). Count the values, compute the sum of all their reciprocals, then divide. Example: HM of 4, 8, 16 = 3 ÷ (0.25 + 0.125 + 0.0625) = 3 ÷ 0.4375 ≈ 6.857.
When should I use harmonic mean?+
Use harmonic mean when averaging rates or ratios where equal amounts of the denominator quantity are used. Key applications: average speed (equal distances), average fuel efficiency (equal distances), average price per unit (equal investment amounts), P/E ratio averages in finance, parallel resistance in electronics.
What is the harmonic mean of 2 numbers?+
For two values a and b: HM = 2ab / (a+b). Example: HM(30, 60) = 2×30×60 / (30+60) = 3600/90 = 40. This is the same formula used for two resistors in parallel: 1/R_total = 1/R₁ + 1/R₂, which gives R_total = R₁R₂/(R₁+R₂) = HM(R₁,R₂)/2.
Why is the arithmetic mean wrong for average speed?+
Arithmetic mean assumes equal time at each speed. For equal-distance legs, you spend more time at the slower speed, skewing the real average downward. Driving 100 km at 50 km/h (2 h) and 100 km at 100 km/h (1 h): total = 200 km / 3 h = 66.7 km/h. HM(50,100) = 2×50×100/150 = 66.7 ✓. Arithmetic mean = 75 ✗.
What is the difference between harmonic mean and arithmetic mean?+
Arithmetic mean = sum ÷ count. Harmonic mean = count ÷ (sum of reciprocals). AM ≥ HM for all positive values. AM is correct for quantities you add directly (scores, heights). HM is correct for rates where the denominator unit is fixed (speed, efficiency, price-per-unit). The more values differ, the larger the gap between AM and HM.
What is the relationship between HM, GM, and AM?+
The AM-GM-HM inequality: AM ≥ GM ≥ HM for all positive values, with equality only when all values are equal. For 1 and 4: AM = 2.5, GM = 2, HM = 1.6. This confirms 2.5 ≥ 2 ≥ 1.6. The inequality can be proven geometrically using a circle where AM, GM, and HM appear as specific lengths.
What is the harmonic mean used for in finance?+
Harmonic mean is used for averaging price-per-unit ratios when equal amounts are invested. In dollar-cost averaging: buying shares at prices 10, 20, 40 (equal dollar amounts each time) gives average price = HM(10,20,40) ≈ 16.36 per share - not the AM of 23.33. P/E ratio averages in index funds are also calculated as harmonic means.
Can harmonic mean be negative or zero?+
Harmonic mean is undefined when any value is zero (reciprocal is infinite). For strictly negative values, harmonic mean can technically be computed but has no practical interpretation for rates. In all standard applications - speed, efficiency, finance - values are strictly positive, so this is rarely an issue in practice.
How do I calculate harmonic mean in Excel?+
Use =HARMEAN(values_range). Example: =HARMEAN(A1:A5) for five values. HARMEAN returns #NUM! if any value is zero or negative. For just two values: =2*A1*A2/(A1+A2). For average speed over equal distances with multiple legs: =COUNT(A1:A5)/SUMPRODUCT(1/A1:A5) as an array formula.
What is the harmonic mean in physics and engineering?+
In electronics, two parallel resistors R₁ and R₂ give R_total = HM(R₁,R₂)/2 = R₁R₂/(R₁+R₂). In optics, the thin lens equation 1/f = 1/d_object + 1/d_image relates focal length to object and image distances using harmonic-mean structure. In acoustics and fluid dynamics, harmonic mean appears in wave-speed calculations through composite media.

What is the formula for harmonic mean?

Harmonic Mean = n / (1/x₁ + 1/x₂ + ... + 1/xₙ) - divide the count of values by the sum of their reciprocals. Example: HM of 4, 8, 16 = 3 / (1/4 + 1/8 + 1/16) = 3 / (0.4375) ≈ 6.86.

When should I use harmonic mean?

Use harmonic mean when averaging rates, speeds, or ratios where the denominator (distance, time, quantity) is fixed and equal across all measurements. Classic cases: average speed over equal-distance segments, average price-earnings ratio, average fuel efficiency in miles per gallon, average work rate when each worker does the same fixed task.

What is the harmonic mean of 2 numbers?

For two values a and b, HM = 2ab / (a+b). Example: HM of 30 and 60 = 2×30×60 / (30+60) = 3600/90 = 40. If you drive 60 km at 30 km/h and 60 km at 60 km/h, the average speed is exactly 40 km/h - not 45 km/h as the arithmetic mean suggests.

Why is the arithmetic mean wrong for average speed?

Arithmetic mean assumes equal time spent at each speed. But for equal-distance segments, more time is spent at the slower speed. Driving 100 km at 50 km/h takes 2 hours; driving 100 km at 100 km/h takes 1 hour. Total: 200 km in 3 hours = 66.7 km/h average. HM = 2×50×100/(50+100) = 66.7 ✓. Arithmetic mean = (50+100)/2 = 75 ✗.

What is the difference between harmonic mean and arithmetic mean?

Arithmetic mean = sum ÷ count. Harmonic mean = count ÷ (sum of reciprocals). AM ≥ HM always. AM is correct for additive quantities (scores, lengths). HM is correct for rates where denominators are equal (speed, fuel efficiency). The more values differ from each other, the larger the gap between AM and HM.

What is the relationship between HM, GM, and AM?

The AM-GM-HM inequality states: Arithmetic Mean ≥ Geometric Mean ≥ Harmonic Mean, with equality only when all values are identical. For 1 and 4: AM = 2.5, GM = √(1×4) = 2, HM = 2×1×4/(1+4) = 1.6. This confirms 2.5 ≥ 2 ≥ 1.6. This inequality is fundamental in mathematics and has applications in optimization and inequalities.

What is the harmonic mean used for in finance?

In finance, harmonic mean is used to average price-to-earnings (P/E) ratios and other price-per-unit ratios. When you invest equal dollar amounts in stocks, the average price paid per share is the harmonic mean of the purchase prices - not the arithmetic mean. This is the correct 'dollar-cost averaging' calculation.

Can harmonic mean be negative or zero?

Harmonic mean is undefined if any value is zero (division by zero in the reciprocal sum). For negative values, the harmonic mean can theoretically be calculated but gives counterintuitive results. In practice, harmonic mean is used only for strictly positive values representing rates, speeds, or ratios.

How do I calculate harmonic mean in Excel?

Use =HARMEAN(values_range). Example: =HARMEAN(A1:A5). HARMEAN ignores text and empty cells but will return an error (#NUM!) if any value is zero or negative. For two speeds: =2*A1*A2/(A1+A2) gives the harmonic mean of the two values directly.

What is the harmonic mean in physics and engineering?

In physics, harmonic mean appears in parallel resistance calculations: two resistors R₁ and R₂ in parallel give R_total = R₁R₂/(R₁+R₂) = HM(R₁,R₂)/2. In optics, the lens equation 1/f = 1/d₁ + 1/d₂ is directly related to harmonic means. In signal processing, effective bandwidth calculations use harmonic-mean-type formulas.