Audited 25 May 2026·Last updated 27 Jul 2026·5 citations·Tier 1·0 uses

Harmonic Mean Calculator

Calculate the harmonic mean for rates, ratios, and averages of reciprocals. Common in physics and finance.

Harmonic Mean Calculator

Comma-separated positive numbers
Harmonic Mean
4.8
Reciprocal of the arithmetic mean of reciprocals
Count
2

Background.

The harmonic mean is the reciprocal average, designed for data that express rates, ratios, or fractions where the denominator of the rate is constant. It answers questions such as: "If I drive 60 miles per hour to a destination and 30 miles per hour back over the same distance, what is my average speed?" The arithmetic mean of 60 and 30 is 45, but the correct answer is 40 miles per hour. The harmonic mean produces this result because it weights the slower speed more heavily: you spend twice as much time traveling at 30 mph as at 60 mph, so the slower speed must exert greater influence on the average.

Students search for harmonic mean calculators when solving physics problems involving average velocity, average acceleration, and equivalent resistance in parallel electrical circuits. Financial analysts use it to average price-earnings ratios and cost-per-unit metrics where the number of shares or units differs across firms. In hydrology, the harmonic mean estimates the effective hydraulic conductivity of layered soils when flow is perpendicular to the layers. In demography, it appears in the calculation of the total fertility rate and in indices that average rates across populations of unequal size.

The harmonic mean is one of the three classical Pythagorean means, alongside the arithmetic and geometric means. For any set of positive numbers that are not all identical, the harmonic mean is strictly less than the geometric mean, which is in turn strictly less than the arithmetic mean. This hierarchy—AM ≥ GM ≥ HM—is a foundational result in analysis with applications in optimization, information theory, and thermodynamics. The inequality is strict unless all values are equal. In the average speed example, the geometric mean is approximately 42.4 mph and the arithmetic mean is 45 mph, with the true harmonic mean of 40 mph sitting at the bottom of the ordering.

The mathematical reason the harmonic mean dominates rate averaging lies in the structure of the reciprocal. When a rate r = d/t is inverted, it becomes t/d, a measure of time per unit distance. Averaging these inverted rates and then inverting the result yields a time-weighted average speed. This is precisely what the harmonic mean computes. Any attempt to average rates directly without respecting the reciprocal structure commits a category error that produces biased results. Textbooks in physics and engineering universally prescribe the harmonic mean for average speed over equal distances and for equivalent conductance in parallel resistors.

Historically, the harmonic mean appeared in Greek mathematics as the mean associated with musical harmony. The name derives from its role in the theory of musical intervals: the harmonic mean of two frequencies corresponds to a pitch that creates consonant overtones with both. While this acoustic origin is largely forgotten, the statistical properties of the harmonic mean remain essential in any field where rates must be averaged correctly. Mastering the harmonic mean is therefore essential for anyone working with rates, ratios, or reciprocal quantities in science, engineering, or finance. Its proper use prevents costly analytical errors that simpler averages cannot detect.

What is harmonic mean calculator?

The harmonic mean of n positive real numbers is the reciprocal of the arithmetic mean of their reciprocals. The formula is HM = n / (Σ 1/x_i). It is defined only for positive inputs because the reciprocal of zero is undefined and the reciprocal of a negative number, while mathematically valid, destroys the rate-averaging interpretation that motivates the harmonic mean in practice. The harmonic mean is the smallest of the three Pythagorean means. It is the appropriate average when the data represent rates with a fixed numerator or denominator, such as speed over equal distances or workload completion times. In electrical engineering, the harmonic mean of resistances gives the equivalent resistance of parallel resistors. In finance, it averages ratios such as price-earnings multiples when the dollar amount invested is held constant across positions. The harmonic mean shares the same units as the input data—miles per hour, ohms, dollars per share—but its value is always less than or equal to the arithmetic mean of the same data. Unlike the arithmetic mean, the harmonic mean is highly sensitive to small values, which can pull the average downward dramatically. This sensitivity makes it the most conservative of the three Pythagorean means and the only choice when rates must be averaged over equal distances or equal work units.

How to use this calculator.

  1. Enter your data values as comma-separated positive numbers in the text area.
  2. Ensure every value is greater than zero; the reciprocal is undefined at zero.
  3. Include at least two values to compute a meaningful harmonic mean.
  4. Click calculate to display the harmonic mean.
  5. Review the count of parsed values shown as secondary output.
  6. Use the result for average speed, rate averaging, or equivalent resistance calculations.

The formula.

HM = n ⁄ Σ(1⁄xᵢ)

The harmonic mean formula HM = n / (Σ 1/x_i) can be derived from the requirement to average rates correctly. Consider a traveler who covers distance d at speed v_1 and returns the same distance at speed v_2. The total distance is 2d. The time for the first leg is d/v_1; the time for the second is d/v_2. The average speed is total distance divided by total time: v_avg = 2d / (d/v_1 + d/v_2) = 2 / (1/v_1 + 1/v_2). This is exactly the harmonic mean of v_1 and v_2. The arithmetic mean fails because it does not account for the fact that more time is spent at the slower speed. The harmonic mean automatically applies the correct time weighting through the reciprocal structure. For n rates r_i = D / t_i with constant D, the total time is Σ t_i = Σ D/r_i = D Σ 1/r_i. The total distance is nD. The average rate is nD / (D Σ 1/r_i) = n / Σ 1/r_i, which generalizes the two-rate case. This derivation confirms that the harmonic mean is not an arbitrary definition but the natural consequence of averaging rates with a fixed numerator or denominator. The relationship HM ≤ GM ≤ AM follows from Jensen's inequality applied to the convex function f(x) = 1/x. Because 1/x is convex for x > 0, the arithmetic mean of the reciprocals is at least the reciprocal of the arithmetic mean: average(1/x_i) ≥ 1/AM. Taking reciprocals reverses the inequality, yielding HM ≤ AM. The geometric mean sits between them by a separate application of the AM-GM inequality to the logarithms. These ordering relationships are universal for positive data and provide quick sanity checks on calculations. Dimensional analysis confirms consistency. Each x_i has units of rate—distance per time, currency per share, charge per volt. The reciprocal has units of time per distance, shares per currency, volts per charge. Summing n reciprocals and dividing n by that sum inverts the units back to the original rate units. The result is dimensionally homogeneous with the inputs, unlike some improper averaging schemes that mix units incoherently.

A worked example.

Example

A motorist drives 120 miles to a destination at 60 miles per hour and returns 120 miles at 30 miles per hour. The total distance is 240 miles. The time for the outbound leg is 120 / 60 = 2 hours. The time for the return leg is 120 / 30 = 4 hours. The total travel time is 6 hours. The average speed is total distance divided by total time: 240 / 6 = 40 miles per hour. This is exactly the harmonic mean of 60 and 30: HM = 2 / (1/60 + 1/30) = 2 / (0.016667 + 0.033333) = 2 / 0.05 = 40. The arithmetic mean of 60 and 30 is 45, which overstates the true average speed by 12.5 percent because it ignores the fact that the motorist spends twice as long traveling at the slower speed. The harmonic mean correctly weights each speed by the time spent at that speed, producing the only average that satisfies the fundamental definition of average speed as total distance divided by total time.

values60, 30

Frequently asked questions.

When should I use harmonic mean instead of arithmetic mean?
Use the harmonic mean when averaging rates, ratios, or fractions where the denominator is constant across observations. Classic examples include average speed over equal distances, equivalent resistance of parallel resistors, and average price-earnings ratios when the same dollar amount is invested in each stock. The arithmetic mean is appropriate for additive quantities such as total revenue or population counts. Using the arithmetic mean for rates commits a time-weighting or share-weighting error that systematically overstates the average when the data are skewed. If you are unsure whether your data are rates, check whether the reciprocal has a meaningful interpretation in your domain.
Can harmonic mean handle zero values?
No. The reciprocal of zero is undefined, so the harmonic mean formula collapses when any input is zero. Even if only one value is zero, the sum of reciprocals becomes infinite and the harmonic mean is zero, losing all information about the non-zero values. In practice, analysts replace zero rates with small positive constants or switch to alternative statistics. The calculator rejects zero inputs because a harmonic mean of zero is usually an artifact of missing data or improper coding rather than a meaningful summary. In electrical engineering, a zero resistance in parallel would short the circuit, making the equivalent resistance zero, but this is a physical limit rather than a statistical average.
How is harmonic mean used in average speed problems?
When equal distances are traveled at different speeds, the average speed is the harmonic mean of those speeds. This follows from the definition average speed = total distance / total time. Because time equals distance divided by speed, the total time is the sum of distances divided by individual speeds. With equal distances, the distance factor cancels, leaving the harmonic mean. If the distances differ, a weighted harmonic mean is required: HM = Σ d_i / Σ (d_i / v_i). The calculator computes the unweighted harmonic mean; users with unequal distances must adjust the formula by entering distance-weighted values or computing manually.
What is the relationship between HM, GM, and AM?
For any set of positive numbers, the arithmetic mean is greater than or equal to the geometric mean, which is greater than or equal to the harmonic mean: AM ≥ GM ≥ HM. Equality holds if and only if all numbers are identical. This ordering is a consequence of Jensen's inequality applied to the convex functions −ln(x) and 1/x. The gap between the means increases with the variance of the data. For rates with high dispersion, the arithmetic mean can be dramatically larger than the harmonic mean, which is why using the wrong mean produces substantial bias. In the Pythagorean means framework, the three means correspond to three different distance metrics in the plane.
Is harmonic mean used in finance?
Yes, though less frequently than the arithmetic or geometric means. The harmonic mean is the correct way to average price-earnings ratios when the same nominal amount is invested in each company. If an investor buys $1,000 of stock A at a P/E of 10 and $1,000 of stock B at a P/E of 20, the portfolio P/E is the harmonic mean of 10 and 20, which is 13.33, not the arithmetic mean of 15. The harmonic mean also appears in the calculation of the Schiller P/E ratio for indices and in certain cost-averaging strategies. Financial analysts must be careful to match the averaging method to the investment constraint: equal dollars invested implies harmonic mean; equal shares purchased implies arithmetic mean.
What is the weighted harmonic mean?
The weighted harmonic mean generalizes the standard formula to account for unequal weights: HM_w = Σ w_i / Σ (w_i / x_i). When all weights are equal, this reduces to the unweighted form. In the average speed context, the weights are the distances traveled at each speed. In finance, the weights are the dollar amounts invested at each P/E ratio. The weighted harmonic mean preserves the rate-averaging property regardless of whether the denominators are equal. The calculator does not accept separate weights; users requiring weighted harmonic means must compute the weighted sum of denominators and divide the total weight by that sum.
Why is HM smaller than the arithmetic mean?
The harmonic mean is smaller because it gives greater weight to smaller values through the reciprocal transformation. The function 1/x is convex and decreasing, so small x values produce large reciprocals that dominate the sum in the denominator. Because the harmonic mean inverts this sum, the influence of small values is amplified. In the average speed example, the slower speed receives twice the weight of the faster speed because twice as much time is spent at that speed. This downward pull is a feature, not a bug: it ensures that the average satisfies the physical constraint total distance = average speed × total time.
Can HM be used for rates with different denominators?
Only if the rates are first converted to a common denominator or if a weighted harmonic mean is used. If the denominators differ—say, speeds over different distances—a simple harmonic mean is incorrect because it assumes equal weighting. The weighted harmonic mean with distances as weights restores correctness. Similarly, if P/E ratios are averaged across companies of different market capitalizations, the weights should reflect the market values. Using an unweighted harmonic mean in these contexts produces the same category error as using an arithmetic mean, merely in the opposite direction.
What are computational pitfalls when calculating HM?
The primary pitfall is division by very small numbers. If an input is close to zero, its reciprocal is extremely large, potentially overflowing the floating-point range or dominating the sum so heavily that other values become numerically irrelevant. A secondary issue is catastrophic cancellation when summing many reciprocals of similar magnitude and then dividing n by that sum. The calculator mitigates these risks by validating that all inputs exceed a small positive threshold and by using standard double-precision arithmetic. For data with extreme outliers near zero, analysts should consider trimming or Winsorizing before computing the harmonic mean.
How does HM relate to electrical resistance?
The equivalent resistance of n resistors connected in parallel is the harmonic mean of the individual resistances divided by n, or equivalently, 1 / Σ (1/R_i). For two resistors, R_eq = (R_1 × R_2) / (R_1 + R_2), which is half the harmonic mean. This relationship arises because conductance—the reciprocal of resistance—adds in parallel. The total conductance is the sum of individual conductances, and the equivalent resistance is the reciprocal of that sum. The harmonic mean therefore governs parallel circuit analysis, fluid dynamics with parallel channels, and heat transfer through layered materials.

References& sources.

  1. [1]NIST/SEMATECH (2012). e-Handbook of Statistical Methods. https://www.itl.nist.gov/div898/handbook/
  2. [2]Feller, W. (1968). An Introduction to Probability Theory and Its Applications, Vol. 1, 3rd ed. New York: John Wiley & Sons.
  3. [3]Bullen, P.S. (2003). Handbook of Means and Their Inequalities. Dordrecht: Kluwer Academic Publishers.
  4. [4]Kendall, M.G., Stuart, A. (1977). The Advanced Theory of Statistics, Vol. 1: Distribution Theory, 4th ed. London: Charles Griffin.
  5. [5]NIST SP 811 (2008). Guide for the Use of the International System of Units (SI). https://www.nist.gov/pml/special-publication-811

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 313 calculators remain free
  • No billing is enabled
Coming soon