Mann-Whitney U Test Calculator
The Mann-Whitney U test compares the measurements of two independent groups by converting them into rank numbers. It is the nonparametric counterpart of the independent samples t-test and is the right choice when normality does not hold, when the sample is small, when outliers distort the mean, or when the data were collected on a Likert-type ordinal scale.
This calculator ranks both groups together, computes the rank sums (R1, R2) and from them U1, U2, and the reported U = min(U1, U2). It also returns the z statistic built on the tie-corrected standard deviation (with and without the continuity correction), the two-tailed p-value, the r = |z|/√N effect size, the Hodges-Lehmann confidence interval for the difference in medians, and the group medians. The ranking table and the box plot let you see which observations produced the result.
Mann-Whitney U Test Formulas
Rank sum: R₁ = Σ (ranks falling to group 1) U statistics: U₁ = R₁ − n₁(n₁+1)/2 , U₂ = n₁·n₂ − U₁ Reported U: U = min(U₁, U₂) Expected value: μ_U = n₁·n₂ / 2 Standard deviation: σ_U = √[ (n₁n₂/12) · ( (N+1) − Σ(t³ − t) / (N(N−1)) ) ] z statistic: z = (U₁ − μ_U) / σ_U Continuity corr.: z_c = (|U₁ − μ_U| − 0.5) / σ_U Effect size: r = |z| / √N , r_rb = 2·U₁/(n₁n₂) − 1 Location shift: Δ̂ = median(xᵢ − yⱼ) (Hodges-Lehmann)
The Σ(t³ − t) term is the variance correction for tied observations, where t is the number of observations in each tie group. The p-value is computed with the normal approximation and matches the SPSS 'Asymp. Sig. (2-tailed)' row; when min(n₁, n₂) < 8, an exact test should be preferred.
How to Calculate
- Paste the measurements of the two independent groups into separate boxes; the groups do not have to be the same size.
- Name the groups if you like; those names are used in the table, the charts, and the interpretation.
- Choose which p-value to report: use the version without the continuity correction to match SPSS output, and the corrected version with small samples.
- Set the significance level (α); the confidence interval is automatically computed at the 1 − α level.
- Read U and the p-value first, then the r effect size: significance shows only that the difference is unlikely to be chance, not how large it is.
- Compare the shapes of the two distributions in the box plot; if the shapes are similar, you can report the result directly as a difference in medians.
Worked Examples
Exam scores of a treatment and a control group
The rank sum of the treatment group is 152 and that of the control group is 58, which gives U₁ = 97, U₂ = 3, and a reported U = 3. With z = 3.553 and p < 0.001 the difference is statistically significant. The medians are 86.00 and 70.50; r = 0.794 marks a large effect, and the 95% confidence interval for the difference in medians runs from 10 to 21 points. The common language effect size is 97.0%: that is the probability that a student drawn from the treatment group scores higher than one drawn from the control group.
U test statistic: 3.0 · z statistic: 3.553 · Degrees of freedom: —
Two overlapping distributions — no significant difference
The medians of 13.50 and 14.50 are very close, and the rank sums are 64 and 72. With U₁ = 28, U₂ = 36, a reported U = 28, and z = −0.424, p = 0.672, so no difference is detected between the two classes. The effect size r = 0.106 is small, and the 95% confidence interval for the difference in medians runs from −3 to 2, which includes zero.
U test statistic: 28.0 · z statistic: -0.424 · Degrees of freedom: —
Likert-scale satisfaction — many tied values
Ordinal data produce a great many tied values, so the variance is computed with the correction Σ(t³ − t) = 1,152, giving σ_U = 16.58. With the continuity-corrected z = 3.136 and p = 0.002, satisfaction with the new interface is significantly higher. The medians are 4 and 3, U = 19.5, and r = 0.646 marks a large effect; the 95% confidence interval for the difference in medians runs from 1 to 2 points.
U test statistic: 19.5 · z statistic: 3.136 · Degrees of freedom: —