# Harmonic Mean Calculator

Calculate the harmonic mean of positive values, with optional arithmetic and geometric mean comparison

> Canonical page: https://elysiatools.com/en/tools/harmonic-mean-calculator

- **Category:** Math & Numbers

- **Keywords:** harmonic mean, harmonic average, statistics, rates, speed average, reciprocal mean

## Overview

Calculate the harmonic mean for a dataset of positive numbers.

The harmonic mean is:

H = n / sum(1 / x)

It is especially useful for averaging rates, ratios, speeds, unit prices, and other values where reciprocal relationships matter.

## Inputs

- **Dataset** (textarea): e.g. 2, 4, 8
- **Decimal Places** (number)
- **Include Mean Comparison** (checkbox)

## When to use

- When calculating the average speed of a journey with multiple segments covering the same distance at different speeds.
- When determining the average cost per unit of shares or items purchased with fixed investment amounts over time.
- When analyzing financial ratios, such as Price-Earnings (P/E) ratios, across a portfolio of assets.

## How it works

- Enter your dataset of positive numbers into the text area, separating values with commas, spaces, or newlines.
- Specify the desired number of decimal places for the output precision (between 0 and 10).
- Toggle the mean comparison option to simultaneously calculate and compare the harmonic, arithmetic, and geometric means.
- The tool computes the formula H = n / sum(1 / x) and returns the results in a structured JSON format.

## Use cases

- Financial analysts calculating the average P/E ratio of an investment portfolio to avoid upward bias.
- Engineers and physicists determining average speeds or rates of flow across equal distances or volumes.
- Data scientists comparing Pythagorean means to understand the skewness and distribution of a dataset.

## Frequently asked questions

### What is the difference between harmonic and arithmetic mean?

The arithmetic mean adds all values and divides by the count, which is best for standard quantities. The harmonic mean divides the count by the sum of the reciprocals of the values, making it accurate for rates, ratios, and speeds.

### Can I use negative numbers or zero in the dataset?

No, the harmonic mean is only defined for strictly positive numbers. Zeros will cause a division by zero error, and negative numbers can yield invalid or misleading results.

### Why is the harmonic mean always lower than the arithmetic mean?

According to the inequality of arithmetic and geometric means, for any set of positive numbers with at least one variation, the harmonic mean is always the smallest, followed by the geometric, then the arithmetic mean.

### How do I format my input data?

You can paste your numbers separated by commas, spaces, or line breaks. The tool will automatically parse the numeric values from your input.

### What does the 'Include Mean Comparison' feature do?

When enabled, the tool calculates the arithmetic and geometric means alongside the harmonic mean, allowing you to easily compare the three standard Pythagorean means for your dataset.

## Related tools

- [Average Calculator](https://elysiatools.com/en/tools/average-calculator): Compare arithmetic, geometric, and harmonic averages for a numeric dataset in one place
- [Cam Follower Displacement Calculator](https://elysiatools.com/en/tools/cam-follower-displacement): Calculate the follower displacement, velocity coefficient, acceleration coefficient and pressure angle during the cam rise phase. Supports constant-velocity, constant-acceleration, harmonic (SHM) and cycloidal motion laws.
- [Confidence Interval Calculator](https://elysiatools.com/en/tools/confidence-interval-calculator): Calculate confidence intervals for a sample mean or proportion using either raw data or summary statistics
- [Geometric Mean Calculator](https://elysiatools.com/en/tools/geometric-mean-calculator): Calculate the geometric mean of positive numeric values for growth rates, ratios, and multiplicative datasets
- [Heat Exchanger LMTD Calculator (Log Mean Temperature Difference)](https://elysiatools.com/en/tools/heat-exchanger-lmtd): Compute the Log Mean Temperature Difference (LMTD) of a heat exchanger for parallel or counter flow. Parallel flow: ΔT₁ = T_h,in - T_c,in and ΔT₂ = T_h,out - T_c,out; counter flow: ΔT₁ = T_h,in - T_c,out and ΔT₂ = T_h,out - T_c,in. LMTD = (ΔT₁ - ΔT₂)/ln(ΔT₁/ΔT₂), or ΔT₁ when ΔT₁ = ΔT₂. A non-positive terminal difference (temperature cross) is physically impossible and is rejected. Optionally, with the overall heat transfer coefficient U (W/(m²·K)) and the heat transfer area A (m²), the heat transfer rate Q = U·A·LMTD (W) is returned. Temperatures are used only as differences: Δ°C = ΔK and Δ°F ×5/9 = ΔK; the LMTD is reported in K.
- [Mean Calculator](https://elysiatools.com/en/tools/mean-calculator): Calculate the arithmetic mean of a numeric dataset and review the main supporting statistics
- [Normal Distribution Calculator](https://elysiatools.com/en/tools/normal-distribution-calculator): Calculate z-scores, cumulative probability, tail probability, and interval probability for a normal distribution
- [Sample Size Calculator](https://elysiatools.com/en/tools/sample-size-calculator): Estimate required sample size for proportions or means using confidence level, margin of error, and optional finite population correction

## Samples

- [Android Image Processing Java Samples](https://elysiatools.com/en/samples/android-image-processing-java): Android Java image processing examples including reading/saving images, scaling, and format conversion
- [Android Image Processing Kotlin Samples](https://elysiatools.com/en/samples/android-image-processing-kotlin): Android Kotlin image processing examples including reading/saving images, scaling, and format conversion
- [Web Image Processing Python Samples](https://elysiatools.com/en/samples/web-image-processing-python): Web Python image processing examples using PIL/Pillow including reading, saving, resizing, and format conversion
- [Web Image Processing Rust Samples](https://elysiatools.com/en/samples/web-image-processing-rust): Web Rust image processing examples including image read/save, scaling, and format conversion

## Related content

- [Barcode, QR Code, and Label Tools](https://elysiatools.com/en/hubs/barcode-utility): Compare barcode generation, QR code creation and decoding, UPC/EAN validation, WiFi QR sharing, and printable label tools in one hub.
