Harmonic mean calculator

Type a and b. H = 2ab/(a+b) when a+b ≠ 0. 3 and 6 give 4. 1 and 3 give 1.500000. −2 and 2 give 0.

Two numbers. A zero sum returns 0, not a blank. A fraction goes through six decimal places. An empty field leaves a blank.

Input data

Results

Enter data and click Calculate.

How it works

The harmonic mean of two numbers is 2ab/(a+b). 3 and 6 give 36/9 = 4. 2 and 2 give 2. The engine: (a+b)!==0 ? 2*a*b/(a+b) : 0.

1 and 3 give 1.5, on the page 1.500000. −2 and 2 have sum 0, so the calculator returns 0, it does not divide by zero and does not leave a blank.

An empty field is a blank value. (a blank value+b)!==0 is true, the quotient is a blank value, the result is blank. Zero and 5 give 0, because 2×0×5/5 = 0.

The geometric mean of 4 and 9 gives 6. Arithmetic mean from a list is on the neighbouring page. Here always two numbers and 2ab/(a+b).

The header units switch does not multiply anything. 3 and 6 stay 4 whatever the label says.

3 and 6 give 4. 1 and 3 give 1.500000. −2 and 2 give 0.

Formula

H = (a+b) !== 0 ? 2ab/(a+b) : 0

How to use

  1. Type two numbers, for example 3 and 6.
  2. Click Calculate. The harmonic mean comes out 4.
  3. 1 and 3 give 1.500000. −2 and 2 give 0.
  4. A zero sum does not divide. The calculator returns 0.
  5. The square root of the product lives on the geometric mean card.

3 and 6 give 4

The harmonic mean is 2ab/(a+b). 3 and 6 give 4. 1 and 3 give 1.500000. −2 and 2 give 0.

harmonic
2ab/(a+b). 3 and 6 give 4. 1 and 3 give 1.500000.
mean
Two numbers, one quotient. A zero sum returns 0, not a blank.
two
Fields a and b. 2 and 2 give 2. Empty leaves a blank.

Examples

Example 1

  • a = 3
  • b = 6

4

What is the harmonic mean of 3 and 6? 4. 2×3×6/9.

Example 2

  • a = 1
  • b = 3

1.500000

What is the harmonic mean of 1 and 3? 1.500000. 6/4 and six decimal places.

Example 3

  • a = −2
  • b = 2

0

What is the harmonic mean of −2 and 2? 0. Sum 0, the engine returns 0.

Related calculators

Common questions

What is the harmonic mean of 3 and 6?

4. 2×3×6/9 = 4.

What does harmonic mean mean?

2ab/(a+b) for two numbers. When the sum is 0, the calculator returns 0.

What about 1 and 3?

1.500000. 6/4. A fraction through six decimal places.

What about −2 and 2?

0. a+b = 0, the engine does not divide.

Do 2 and 2 give 2?

Yes. 2ab/(a+b) = 8/4 = 2.

What if a field is empty?

a blank value. The result stays blank, not the zero-sum zero.

Do 0 and 5 give 0?

Yes. 2×0×5/5 = 0.

How is this different from geometric?

Here 2ab/(a+b). There the root of the product. 4 and 9 there give 6.

Does the order of a and b change the result?

No. 3 and 6 and 6 and 3 give 4.

Does a comma in 1.5 work?

Yes. 1.5 and 1,5 are the same number.

Knowledge sources

The calculator computes the same formula as the definition below.

Page updated in 2026.