induwara.lk
induwara.lkStatistics · Non-parametric

Mann-Whitney U Test Calculator

Compare two independent samples that aren't normally distributed. Paste your numbers to get the U statistic, an exact or tie-corrected p-value, an effect size, and every ranking step — all in your browser, no signup.

By Induwara AshinsanaUpdated Jul 9, 2026
Mann-Whitney U test
Exact + tie-corrected · cross-checked
4 values

Paste numbers separated by commas, spaces, or new lines.

3 values

The second independent group. Sizes need not match.

Try an example
Alternative hypothesis
Fail to reject H₀ — no significant difference between the groups (p = 0.4000 ≥ α = 0.05).
Method: Exact test — enumerated null distribution over C(7, 4) arrangements (no ties).
U statistic
3
U₁ = 9 · U₂ = 3
p-value (two-sided)
0.4000
exact enumeration
Rank-biserial r
0.5
large · A higher
CLES
0.75
P(random A > random B)

Combined ranking

#ValueGroupRank
12B1
23A2
34B3
45A4
56B5
67A6
78A7
Rank sums — R₁ (A) = 19, R₂ (B) = 928

Cross-check: R₁ + R₂ = 28 must equal N(N+1)/2 = 28matches ✓.

Show working

  1. R₁ = 19 → U₁ = R₁ − n₁(n₁+1)/2 = 19 − 10 = 9
  2. U₂ = n₁n₂ − U₁ = 12 − 9 = 3
  3. μ_U = n₁n₂/2 = 6
  4. σ_U = √(n₁n₂(N+1)/12) = √(12·8/12) = 2.82843
  5. z (no correction) = (U₁ − μ_U)/σ_U = 1.06066
  6. z (continuity-corrected) = 0.88388
  7. p-value: exact enumeration of the null distribution over C(7, 4) = 35 arrangements.

Cross-check: U₂ from the identity (3) and U₂ recomputed from R₂ directly (3) agree ✓.

Sources cited

How it works

The Mann-Whitney U test — equivalently the Wilcoxon rank-sum test — asks whether one of two independent groups tends to produce larger values than the other. It is the non-parametric alternative to the two-sample t-test: instead of comparing means, it compares the whole distributions by rank, so skew, outliers, and ordinal data don't break it.

  1. Rank the pooled data.All N = n₁ + n₂ observations from both groups are sorted together and ranked 1…N. Tied values receive the average of the ranks they span — two values tied for ranks 5 and 6 each become 5.5 (Mann & Whitney, 1947).
  2. Sum the ranks. R₁ is the total rank of sample A, R₂ of sample B. As a check, R₁ + R₂ must equal N(N+1)/2.
  3. Form the U statistics. U₁ = R₁ − n₁(n₁+1)/2 and U₂ = n₁n₂ − U₁. The reported statistic is U = min(U₁, U₂). This tool also recomputes U₂ directly from R₂ as an independent cross-check.
  4. Exact p-value (small, tie-free samples). When both groups have 20 or fewer values and there are no ties, the exact null distribution of U is enumerated with the recurrence c(m, n, u) = c(m−1, n, u−n) + c(m, n−1, u), and the p-value is the share of arrangements at least as extreme as yours over C(N, n₁) total arrangements.
  5. Normal approximation (ties or larger samples). Otherwise the test uses μ_U = n₁n₂/2 and the tie-corrected standard deviation σ_U = √((n₁n₂/12)·[(N+1) − Σ(tⱼ³−tⱼ)/(N(N−1))]), where tⱼ is the size of each group of tied values (NIST e-Handbook). The z-score (with an optional ±0.5 continuity correction toward the mean) is read against the standard-normal distribution.

Two effect sizes accompany the verdict: the rank-biserial correlation r = (U₁ − U₂)/ (n₁n₂), bounded in [−1, 1], and the common-language effect size (CLES) = U/(n₁n₂), the probability that a randomly picked value from one group beats one from the other. Every step above runs client-side, so nothing you paste leaves your device.

Worked examples

Small samples, no ties — exact path

A = 7, 3, 5, 8 (n₁ = 4) · B = 2, 4, 6 (n₂ = 3)

  1. Pooled ranks: 2→1(B), 3→2(A), 4→3(B), 5→4(A), 6→5(B), 7→6(A), 8→7(A)
  2. R₁ = 2+4+6+7 = 19, R₂ = 1+3+5 = 9 (check 19+9 = 28 = 7·8/2 ✓)
  3. U₁ = 19 − 4·5/2 = 9, U₂ = 12 − 9 = 3 → U = 3
  4. Exact null distribution of U over C(7,4) = 35 arrangements
  5. P(U₁ ≥ 9) = 7/35 = 0.2 → two-sided p = 2 × 0.2 = 0.40 → fail to reject at α = 0.05
  6. Effect size: r = (9−3)/12 = 0.50, CLES(A>B) = 9/12 = 0.75

Larger samples with a tie — normal approximation

Control (A) = 55, 60, 62, 58, 65 (n₁ = 5) · Treatment (B) = 70, 68, 72, 65, 75 (n₂ = 5)

  1. The two 65s (one A, one B) tie for ranks 5 and 6 → each gets 5.5
  2. R_A = 1+2+3+4+5.5 = 15.5, R_B = 5.5+7+8+9+10 = 39.5 (check 55 = 10·11/2 ✓)
  3. U_A = 15.5 − 15 = 0.5, U_B = 25 − 0.5 = 24.5 → U = 0.5
  4. μ_U = 12.5; tie group t = 2 → Σ(t³−t) = 6
  5. σ_U = √((25/12)·[11 − 6/(10·9)]) = √22.778 = 4.773
  6. z = (0.5 + 0.5 − 12.5)/4.773 = −2.410 → two-sided p ≈ 0.016 → reject at α = 0.05
  7. Effect size: r = (0.5−24.5)/25 = −0.96, CLES(B>A) = 24.5/25 = 0.98

Edge case — complete separation, exact one-sided

A = −2.5, −1, 0 (n₁ = 3) · B = −3, −4.5, −6 (n₂ = 3)

  1. Every A value exceeds every B value (negatives handled the same as positives)
  2. Ranks: −6(B)→1, −4.5(B)→2, −3(B)→3, −2.5(A)→4, −1(A)→5, 0(A)→6
  3. R_A = 15, R_B = 6 → U₁ = 15 − 6 = 9, U₂ = 0, U = 0
  4. Exact over C(6,3) = 20 arrangements: P(U₁ ≥ 9) = 1/20 = 0.05
  5. One-sided A > B: p = 0.05 (equals α, so a strict p < α test does not reject)
  6. Two-sided p = 2 × 0.05 = 0.10 → fail to reject at α = 0.05

Frequently asked questions

Sources & references

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.