Logo

MonoCalc

/

Harmonic Mean Calculator

Math
Separate values with commas, spaces, or newlines

About This Tool

🔢 Harmonic Mean Calculator – Average Rates, Speeds & Ratios

The harmonic mean is the correct average to use whenever you are combining quantities expressed as rates or ratios — speeds, prices per unit, throughput values, or financial multiples. Unlike the arithmetic mean, it gives proportionally more weight to smaller values, which counteracts the distortion caused by high values that take less time (or fewer resources) to complete.

📐 Formula

For n positive values x₁, x₂, …, xₙ, the harmonic mean is:

H = n / (1/x₁ + 1/x₂ + … + 1/xₙ)

For the weighted harmonic mean with weights w₁, w₂, …, wₙ:

H_w = (w₁ + w₂ + … + wₙ) / (w₁/x₁ + w₂/x₂ + … + wₙ/xₙ)

🚗 Classic Example: Averaging Speeds

Suppose you drive a 100 km route: the first half at 60 km/h and the second half at 90 km/h. The arithmetic mean gives 75 km/h — but the correct average speed for equal-distance segments is the harmonic mean:

H = 2 / (1/60 + 1/90) = 2 / (0.01667 + 0.01111) ≈ 72 km/h

The difference matters: at 75 km/h you would predict a shorter total travel time than actually occurs.

📊 When to Use Each Mean

MeanBest forExample
ArithmeticEqual-time quantitiesTest scores, temperatures
GeometricMultiplicative growthInvestment returns, population growth
HarmonicEqual-distance ratesSpeeds, unit costs, P/E ratios

💼 Finance and Ratios

In financial analysis, the harmonic mean is preferred for averaging price-to-earnings (P/E) ratios and other valuation multiples across a portfolio. Because a high P/E ratio corresponds to a relatively small earnings yield (the reciprocal), equal-weighting via the arithmetic mean overstates the average earnings yield. The harmonic mean corrects this by weighting each multiple by its implied yield.

⚖️ Weighted Harmonic Mean

Use the weighted mode when each value does not contribute equally. For example, if you purchase different quantities of items at different unit prices, weighting each price by the quantity purchased gives the true average cost per item. Enter your values in the first column and the corresponding weights in the second column — the tool validates that both lists have the same length.

📋 Supported Input Modes

  • Simple dataset — paste or type any list of positive numbers
  • Weighted — pair each value with a weight for importance-adjusted averaging
  • Equal-distance speed — enter speeds for equal-length segments
  • Ratio / multiple averaging — average P/E ratios or cost-per-unit figures
  • Comparison mode — display harmonic, arithmetic, and geometric means side by side

⚠️ Limitations

The harmonic mean is only defined for strictly positive values. Zero values make the reciprocal undefined, and negative values produce mathematically meaningless results for rate-averaging purposes. The tool will flag any such entries before computing. If your dataset contains zeros or negatives, consider whether the harmonic mean is the appropriate measure, or pre-process your data to remove invalid entries.

Frequently Asked Questions

Is the Harmonic Mean Calculator free?

Yes, Harmonic Mean Calculator is totally free :)

Can I use the Harmonic Mean Calculator offline?

Yes, you can install the webapp as PWA.

Is it safe to use Harmonic Mean Calculator?

Yes, any data related to Harmonic Mean Calculator only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

What is the harmonic mean and when should I use it?

The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals of a set of positive values. Use it when averaging rates, ratios, or quantities expressed per unit — such as speeds over equal distances, price-to-earnings multiples, or unit costs. It always produces a result less than or equal to the arithmetic mean.

How does this harmonic mean calculator work?

Enter your positive values separated by commas, spaces, or newlines. The calculator applies the formula H = n / Σ(1/xᵢ) where n is the count of values. For weighted mode it uses H_w = Σwᵢ / Σ(wᵢ/xᵢ). Optional comparison mode also shows arithmetic and geometric means side by side.

Why are zero and negative values not allowed?

Zero values produce a division-by-zero when computing reciprocals, making the harmonic mean undefined. Negative values can cancel out reciprocals and yield misleading results. The harmonic mean is mathematically valid only for datasets of strictly positive numbers.

What is the difference between weighted harmonic mean and simple harmonic mean?

The simple harmonic mean treats every value equally. The weighted version multiplies each reciprocal by a corresponding weight before summing, allowing you to express unequal importance — for example, portfolio positions of different sizes or production runs of different volumes.

When is the harmonic mean better than the arithmetic mean for averaging speeds?

When you travel equal distances at different speeds, the correct average speed is the harmonic mean of the speeds — not the arithmetic mean. The arithmetic mean overstates the true average because faster segments take proportionally less time than slower ones.

How accurate are the results for large datasets?

The calculator uses JavaScript's native IEEE 754 double-precision arithmetic, giving about 15–16 significant digits. The precision setting (0–10 decimal places) controls how results are displayed, not the internal accuracy. Very large pasted datasets are parsed efficiently without degrading precision.