Mann-Whitney U Test Calculator
Non-parametric two-sample test (aka Wilcoxon rank-sum). Full ranks with tie correction, z / p-value, plain-language verdict, dot-plot diagram and show/hide step-by-step working.
What is the Mann-Whitney U test?
The Mann-Whitney U test — also called the Wilcoxon rank-sum test — is the non-parametric alternative to the independent-samples t-test. It asks the same broad question ("are these two groups really different?") but without assuming the values follow a normal distribution. Instead of comparing means, it pools the two groups, ranks every observation from smallest to largest, and checks whether the ranks are systematically higher in one group than the other.
Because the test only cares about the ranks, extreme outliers, heavy skew and ordinal (rating-scale) data don't break it. If the two rank sums are very unbalanced, one group tends to produce larger values than the other and the test flags a significant difference.
The Mann-Whitney U test, piece by piece
Given — combine, sort, rank
Merge both groups, sort ascending, and assign ranks 1, 2, 3… Whenever several values are tied, give each of them the average of the ranks they would have taken. Ties preserve the total rank sum R₁ + R₂ = N(N + 1)/2.
Formula & Substitute — U from rank sums
Subtract each group's minimum possible rank sum from its actual rank sum to get U₁ and U₂. The reported U is always the smaller of the two; the identity U₁ + U₂ = n₁·n₂ is a useful arithmetic check.
Substitute — normal approximation
For all but the smallest samples, U is approximately normal with mean n₁n₂/2 and a variance that gets pulled down whenever there are ties. Add a 0.5 continuity correction before dividing to get a z-score you can look up.
Answer — z, p, effect size
The rank-biserial correlation converts U into a directional effect size on the −1…+1 scale. Equivalently, U₁/(n₁·n₂) is the common-language effect size — the probability that a random value from group 1 exceeds one from group 2.
Assumptions and interpretation
- Independent observations, within and between groups. For paired data, use the Wilcoxon signed-rank test instead — different test, similar name.
- Values must be at least ordinal (i.e. they can be ranked). Nominal categories like colour or country don't qualify.
- What Mann-Whitney tests: whether P(X > Y) ≠ 1/2 — i.e. whether a random draw from group 1 is more likely to exceed a random draw from group 2 than vice versa. That translates to "medians differ" only if both distributions have the same shape (same spread, same skew).
- Effect size: the rank-biserial correlation r = 1 − 2U/(n₁·n₂) or the common-language effect size P(X > Y) ≈ U₁/(n₁·n₂) give a plain magnitude to go with the p-value.
Common mistakes
- Reading U instead of U₁ for direction. min(U₁, U₂) is always the smaller one — its sign doesn't tell you which group is larger. Look at R₁ vs R₂ or the medians for that.
- Ignoring ties. If several values are equal, they must share the average rank AND the variance must be tie-corrected. Forgetting the tie correction inflates σU and makes p-values too conservative.
- Using it on paired data. Mann-Whitney assumes independent samples. For before/after or matched-pair designs, use the Wilcoxon signed-rank test.
- Calling it a test of medians without checking shape. If the two distributions have different shapes, a significant U can reflect a spread difference as much as a location difference.
Features of this calculator
- Two flexible dataset boxes — accepts commas, spaces, tabs, new lines and even values pasted from a spreadsheet.
- Combined ranking table with tie handling (average ranks) shown explicitly.
- U₁, U₂ and U = min(U₁, U₂) — plus the R₁ + R₂ = N(N+1)/2 sanity check.
- Normal-approximation z with a continuity correction AND a tie correction to σU² — accurate whenever the smaller sample has around 8+ observations.
- One-sided or two-sided p-value with a plain-language verdict at your chosen α (0.10, 0.05, 0.01).
- Dot-plot / strip diagram overlaying both groups on one number line so you can eyeball the overlap that the test measures.
- Show/hide step-by-step working with your own numbers substituted into every formula.
- Copy the summary as text or download the result panel as a PNG.
Frequently asked questions
+Is Mann-Whitney U the same as the Wilcoxon rank-sum test?
Yes — they're mathematically equivalent, just parameterised differently. Wilcoxon reports R (a rank sum); Mann-Whitney reports U = R − n(n+1)/2. Any software that gives one can convert to the other.
+Do I need equal sample sizes?
No. The test works with any n₁ and n₂ (both ≥ 2). The normal approximation gets more accurate as the smaller sample grows.
+Should I use one-sided or two-sided?
Two-sided if you're just asking whether the groups differ. One-sided only if you have a directional hypothesis fixed before looking at the data (e.g. "the treatment group has larger values"). Never pick the direction after peeking — that's p-hacking.
+How small can the samples be before the normal approximation breaks?
It's usually fine once min(n₁, n₂) is around 8 with a tie-corrected variance. For very small samples with no ties, an exact table gives a slightly more conservative p — but the difference is small and the approximation almost always agrees on the reject/fail-to-reject decision.
+What does 'stochastic dominance' mean here?
P(X > Y) > 1/2 — a random value from group X is more likely to be larger than a random value from group Y. That's what Mann-Whitney really tests. If you additionally assume identical distributional shapes, this reduces to "the medians differ".
+Can I use this for ordinal (Likert) data?
Yes — that's one of its main use cases. Ranks require only an ordering, which Likert scales provide. Just be aware of the shape assumption if you want to talk about medians rather than dominance.