statcompute

Hypothesis tests

Mann-Whitney U Test Calculator

Compare two independent groups using only the order of the values — the test to reach for when the data are skewed, ordinal, or have outliers.

Updated August 2026Runs in your browser — nothing is uploadedVerified against R
One value per line, or separated by commas, tabs or spaces. A header row is ignored.
One value per line, or separated by commas, tabs or spaces. A header row is ignored.
Pick this before seeing the results, not after.
Conventionally 0.05. Decide before you look at the data.

The calculation runs in your browser, so this box needs JavaScript. The formula, the worked example and the interpretation below do not.

01

How to read this result

U counts wins. For every pairing of one value from each group, U counts how often the first group's value is larger. If the two groups were interchangeable, that count would sit near half of all pairings — which is what the test measures the distance from.

Exact where it can be. With no ties and samples up to 30 each, the calculator enumerates the whole null distribution rather than approximating it, which matters most at exactly the sample sizes people bring to this test. Ties force the normal approximation, with the standard correction to the variance.

It compares distributions, not medians. The common shorthand "a test of medians" is only true if you are willing to assume the two distributions have the same shape and differ by a shift. The safe reading is: values in one group tend to be larger than values in the other.

Read the rank-biserial correlation as the effect size. It is signed with respect to the first sample: positive means the first sample tends to hold the larger values, negative means the second does. It runs from −1 to 1 and has a direct interpretation: 0.6 means the first group wins 80% of the pairwise comparisons.

02

The formula

U1=R1n1(n1+1)2U2=n1n2U1
R1
the sum of the ranks of group 1 in the combined, sorted sample
n1,n2
the two sample sizes

U₁ + U₂ = n₁n₂ always, which is a useful check on the arithmetic.

The large-sample approximation

z=Un1n22n1n212[(N+1)(t3t)N(N1)]

The bracketed term is the tie correction: t is the size of each group of tied values. With no ties it reduces to N + 1.

03

Worked example

Two teaching methods, small classes

Seven students learn by method A and eight by method B, and each sits the same test. The scores are not normally distributed and one class is small — a t-test would be leaning on an assumption that cannot be checked at this size.

Method A: 12, 15, 9, 20, 14, 11, 17 Method B: 19, 22, 16, 25, 18, 24, 21, 23

  1. Pool all 15 values and rank them from smallest to largest.
    9 → 1, 11 → 2, 12 → 3, 14 → 4, 15 → 5, 16 → 6, 17 → 7, 18 → 8, …
  2. Add up the ranks belonging to method A.
    R₁ = 1 + 2 + 3 + 4 + 5 + 7 + 10 = 32
  3. Convert to U.
    U₁ = 32 − 7×8/2 = 32 − 28 = 4
  4. U₂ is the complement.
    U₂ = 7 × 8 − 4 = 52
  5. With no ties and small samples, enumerate the exact null distribution of U and add up the tail.
    two-sided p = 0.00373
  6. Effect size: the share of pairwise comparisons method A wins, minus the share it loses.
    rank-biserial r = 2(4/56) − 1 = −0.857
U 4exact p 0.0037rank-biserial r −0.857median A / B 14 / 21.5

U = 4 means method A's scores beat method B's in only 4 of the 56 possible pairings. That is close to complete separation, which is why the p-value is small despite the tiny samples.

Checked against R's wilcox.test(a, b).

The calculator above is loaded with these numbers by the Load the worked example button.

04

Assumptions, and when to use something else

The Mann-Whitney test asks much less of the data than a t-test, but not nothing.

  • Independent observations, and two independent groups. Paired data belongs in the Wilcoxon signed-rank test.
  • At least ordinal data. The values must be rankable; they need not be numeric or normal.
  • For the "median" interpretation only: similar distribution shapes in the two groups. Without that, the test still works — it just answers the broader question of whether one group tends to produce larger values.
  • The data are roughly normalT-testWith normal data the t-test has slightly more power — about 5% more at large samples — and gives a confidence interval for the difference in means.
  • Paired or repeated measurementsWilcoxon signed-rank testThe paired version of the same idea.
  • Three or more groupsKruskal-Wallis testThe rank-based extension to k groups, exactly as ANOVA extends the t-test.
  • You want to check whether normality is a fair assumptionShapiro-Wilk testTests it directly, and draws the Q-Q plot that shows how it fails.
05

Questions people ask

Is the Mann-Whitney U test the same as the Wilcoxon rank-sum test?

Yes — they are the same test, derived independently and named after both. R's wilcox.test reports W, which is U for the first sample. The Wilcoxon signed-rank test is a different test, for paired data.

Does Mann-Whitney compare medians?

Only under an extra assumption. Strictly it tests whether one distribution is stochastically larger than the other. If you can assume the two distributions have the same shape and differ only by a shift, that shift is a difference in medians — otherwise the test can be significant while the medians are identical.

What do I do about ties?

The calculator applies the standard tie correction to the variance and uses the normal approximation, because the exact distribution assumes no ties. A few ties change very little; many ties — as in a five-point rating scale — mean the approximation is doing most of the work, and the p-value should be read as approximate.

How small a sample can I use?

The exact test works from two observations per group, but power is the binding constraint: with three per group, no arrangement of the data can produce a two-sided p below 0.10. Somewhere around 5–6 per group is where the test becomes capable of reaching significance at all.