🧮
🧮 Math & statistics

Mann-Whitney U Test Calculator

Results update as you type.

Your numbers

Understanding the Mann-Whitney U test — concept and principle

The Mann-Whitney U test (also called the Wilcoxon rank-sum test) compares two independent groups without assuming normal data. It works on ranks instead of raw values, so it suits small samples, skewed measurements, outliers and ordinal scales such as satisfaction ratings. Enter the values of group A and group B; the calculator returns U, a z score and an approximate two-tailed p-value.

Mann-Whitney U test from pooled ranksAll ten values are ranked together; group A ranks sum to 35, so U1 is 20, U2 is 5 and U is 5, p about 0.117.Line everyone up and use ranksGroup AGroup B11223344.544.556677889910rank ↑ (ties share 4.5)A’s ranks: 3 + 6 + 7 + 9 + 10 = 35U₁ = 35 − 15 = 20 · U₂ = 25 − 20 = 5U = smaller one = 5z ≈ 1.57 · two-tailed p ≈ 0.117
Only the order matters: A’s rank sum 35 gives U = 5, p ≈ 0.117.

How it is calculated

  1. Pool both groups and rank all values from smallest (rank 1) to largest. Tied values receive the average of the ranks they occupy.
  2. Add the ranks of group A to get R₁.
  3. U₁ = R₁ − n₁(n₁ + 1) ÷ 2, and U₂ = n₁n₂ − U₁. The reported U is the smaller of the two.
  4. Normal approximation: z = (U₁ − n₁n₂ ÷ 2) ÷ √(n₁n₂(n₁ + n₂ + 1) ÷ 12).
  5. Two-tailed p = 2 × (1 − Φ(|z|)).

A positive z means group A tends to have higher values.

The principle

U₁ counts, over all n₁ × n₂ pairs of one value from A and one from B, how many times the A value is larger (ties count one half). If both groups come from the same distribution, A wins each pair half the time, so U₁ is centred at n₁n₂ ÷ 2. Its variance under that null hypothesis is n₁n₂(n₁ + n₂ + 1) ÷ 12, and for moderate samples U is close to normally distributed. The test was developed by Wilcoxon (1945) and by Mann and Whitney (1947).

Worked example

  1. A = 3, 5, 6, 8, 9; B = 1, 2, 4, 4, 7; n₁ = n₂ = 5.
  2. Pooled ranks: 1→1, 2→2, 3→3, 4 and 4→4.5 each, 5→6, 6→7, 7→8, 8→9, 9→10.
  3. R₁ = 3 + 6 + 7 + 9 + 10 = 35.
  4. U₁ = 35 − 15 = 20, U₂ = 25 − 20 = 5, so U = 5.
  5. z = (20 − 12.5) ÷ √(25 × 11 ÷ 12) = 7.5 ÷ 4.787 ≈ 1.5667.
  6. p ≈ 0.1172 (two-tailed, normal approximation).

How to read the result

U ranges from 0 (complete separation of the groups) to n₁n₂ ÷ 2 (complete overlap). Here A ranks higher on average, but p ≈ 0.12 is above 0.05, so the difference is not significant. For n₁ = n₂ = 5, exact tables require U ≤ 2 for significance at the two-tailed 5% level; the exact p for U = 5 is about 0.15. A useful effect size is U₁ ÷ (n₁n₂) = 0.8: an A value beats a B value in 80% of pairs.

Common mistakes

Keep in mind: This calculator uses the plain normal approximation without tie correction or continuity correction. With fewer than about 10 values per group or with many ties, use exact tables or software with an exact or corrected method.

Frequently asked questions

When should I prefer it over the t-test?

When data are ordinal, clearly skewed or contain outliers, and the sample is too small to rely on the central limit theorem.

Is it the same as the Wilcoxon rank-sum test?

Yes. The statistics differ only by a constant, W = U + n(n + 1) ÷ 2, and give the same p-value.

Do the groups need equal sizes?

No. Any n₁ and n₂ of at least 2 work here.

Sources: Mann, H. B. & Whitney, D. R. (1947). Annals of Mathematical Statistics, 18(1), 50–60. · Wilcoxon, F. (1945). Biometrics Bulletin, 1(6), 80–83.

Checked 8 Nov 2026. Standard formulas, computed in your browser with double-precision numbers.

🧮 All math & statistics tools →🌍 Calculators by country →