# Harmonic Mean Calculator

Free harmonic mean calculator. Calculate the harmonic mean for averaging rates, speeds, and ratios. Compare with arithmetic and geometric means.

## What this calculates

Calculate the harmonic mean of up to 6 positive values. The harmonic mean is the correct average for rates, speeds, and any quantity where the denominator varies across samples.

## Inputs

- **Value 1** — min 0.0001
- **Value 2** — min 0.0001
- **Value 3** — min 0 — Enter 0 to skip.
- **Value 4** — min 0 — Enter 0 to skip.
- **Value 5** — min 0 — Enter 0 to skip.
- **Value 6** — min 0 — Enter 0 to skip.

## Outputs

- **Harmonic Mean** — The harmonic mean of the values.
- **Arithmetic Mean** — The arithmetic mean for comparison.
- **Geometric Mean** — The geometric mean for comparison.
- **Number of Values** — How many values were used.
- **Formula** — formatted as text — The harmonic mean formula and values.

## Details

The harmonic mean is the reciprocal of the arithmetic mean of reciprocals.

Formula:
HM = n / (1/x₁ + 1/x₂ + ... + 1/xₙ)

When to Use

- Average speed for equal-distance trips at different speeds

- Average price-to-earnings ratio

- F1 score in machine learning (harmonic mean of precision and recall)

- Any rate where the denominator varies

Example:
Driving 60 mph for one leg and 40 mph for the return: HM = 2/(1/60 + 1/40) = 48 mph (not 50!).

## Frequently Asked Questions

**Q: Why use the harmonic mean for averaging speeds?**

A: If you drive equal distances at different speeds, the arithmetic mean overestimates the average speed. The harmonic mean correctly accounts for the fact that you spend more time at the slower speed. For 60 mph and 40 mph over equal distances: arithmetic mean = 50 mph, but harmonic mean = 48 mph (correct).

**Q: How is the harmonic mean used in machine learning?**

A: The F1 score is the harmonic mean of precision and recall: F1 = 2 × (precision × recall) / (precision + recall). The harmonic mean is used because it penalizes extreme imbalances -- if either precision or recall is very low, the F1 score will also be low.

**Q: Why is the harmonic mean always less than or equal to the other means?**

A: For positive values: HM ≤ GM ≤ AM (AM-GM-HM inequality). The harmonic mean gives more weight to smaller values. Equality holds only when all values are identical. This property makes HM useful when you want to penalize extreme low values.

---

Source: https://vastcalc.com/calculators/math/harmonic-mean
Category: Math
Last updated: 2026-04-21
