Mann-Whitney U Test Calculator
Paste two groups of ratings or skewed measurements to compare them by rank with the…
Paste two groups of ratings or skewed measurements to compare them by rank with the Mann-Whitney U test, which needs no normal distribution.
Read 12 values; left out the header row (“New design”).
Read 11 values; left out the header row (“Old design”).
More optionsTwo-sided, 95% confidence
The significance level is 1 − the confidence level (0.05 at 95%).
ExampleP-value
0.0022
A value from New design beats one from Old design 87.5% of the time (ties count half); medians 7.5 and 5. Significant at the 5% level (p < 0.05).
Paste your own numbers to test them.
Every value is a dot and the box is the middle half, split at the median.
The distribution the statistic follows if there were no difference; the shaded area beyond it is the p-value.
- U (New design), U (Old design)
- 115.5, 16.5
- Rank-biserial r
- 0.75
- Method
- Normal approx., ties corrected
How this works: 9 sources,
How this works
Method
The Mann-Whitney U test (also called the Wilcoxon rank-sum test) compares two independent groups by rank, not by mean. It suits ratings on a 1 to 10 scale, waiting times with a long tail, or small samples where you can’t trust a normal curve. In the example, people rated a new app design and an old one; the new design’s ratings sit clearly higher, with medians of 7.5 and 5. Full method
Sources
- Mann and Whitney, On a test of whether one of two random variables is stochastically larger than the other (Annals of Mathematical Statistics, 1947)
- Wikipedia, Mann–Whitney U test
- NIST/SEMATECH e-Handbook of Statistical Methods
- Abramowitz and Stegun, Handbook of Mathematical Functions, chapters 6, 7 and 26 (1964)
- SciPy 1.18 scipy.stats (reference values for the tests)
- statsmodels 0.15 (reference values for the A/B test and regression intervals)
- Welch, The generalization of Student’s problem when several different population variances are involved (Biometrika) (1947)
- Fleiss, Levin and Paik, Statistical Methods for Rates and Proportions, 3rd edition (sample size for two proportions) (2003)
- Hyndman and Fan, Sample quantiles in statistical packages (The American Statistician) (1996)
How it’s tested
2 worked examples for this page are checked by automated tests before every release: given the inputs, the tool must show the expected answer.
Privacy
On your device. Nothing you enter or open leaves this browser. About privacy labels
Changes
- First published: live curves with draggable cut-offs, and tests on pasted data (t-tests, ANOVA, chi-square, Fisher’s exact, correlation, regression, A/B), checked against SciPy.
How the Mann-Whitney U test works
The Mann-Whitney U test (also called the Wilcoxon rank-sum test) compares two independent groups by rank, not by mean. It suits ratings on a 1 to 10 scale, waiting times with a long tail, or small samples where you can’t trust a normal curve. In the example, people rated a new app design and an old one; the new design’s ratings sit clearly higher, with medians of 7.5 and 5.
Rank every value from both groups together, smallest first, with ties sharing the average rank. Add up the first group’s ranks and turn the sum into U = R₁ − n₁(n₁ + 1)/2. U counts, over every pair of one value from each group, how many the first group wins, with ties as half a win. Divided by n₁ × n₂, it is the chance that a random value from the first group beats one from the second, a plain-language effect size.
For small groups without ties the p-value is exact: the page counts every way the ranks could have split between the groups, as SciPy does when either group has 8 or fewer values. Otherwise it uses the normal approximation with corrections for ties and for continuity. Ratings almost always have ties, so the example uses the approximation.
U₁ = R₁ − n₁(n₁ + 1)/2 · U₁ + U₂ = n₁n₂ · P(A beats B) = U₁ ÷ (n₁n₂)
- Mann and Whitney (1947) gave the U statistic and its distribution for testing whether one of two random variables tends to be larger than the other. Source: Mann and Whitney, On a test of whether one of two random variables is stochastically larger than the other (Annals of Mathematical Statistics, 1947).
- U divided by n₁n₂ estimates the probability that a value from one group exceeds a value from the other (the common-language effect size), and the rank-biserial correlation is 2U/(n₁n₂) − 1. Source: Wikipedia, Mann–Whitney U test.
Exact critical values of U (two-sided, 5%)
For two groups of the sizes shown with no ties: the smaller U must be at most this value for p ≤ 0.05, with the exact p-value at that U. Counted from every possible split of the ranks.
| Group sizes | Pairs (n₁n₂) | Critical U | Exact p at it |
|---|---|---|---|
| 3 and 5 | 15 | 0 | 0.0357 |
| 4 and 4 | 16 | 0 | 0.0286 |
| 4 and 6 | 24 | 2 | 0.0381 |
| 5 and 5 | 25 | 2 | 0.0317 |
| 5 and 8 | 40 | 6 | 0.0451 |
| 6 and 6 | 36 | 5 | 0.0411 |
| 6 and 9 | 54 | 10 | 0.0496 |
| 7 and 7 | 49 | 8 | 0.0379 |
| 8 and 8 | 64 | 13 | 0.0499 |
| 8 and 10 | 80 | 17 | 0.0434 |
Show all 12 rowsShow fewer
| 10 and 10 | 100 | 23 | 0.0433 |
| 12 and 12 | 144 | 37 | 0.0449 |
Common questions
Does the Mann-Whitney test compare medians?
Not exactly. It tests whether values from one group tend to be larger than values from the other. If the two groups have the same shape and spread, that amounts to a difference in medians, which is how it is often described.
When should I use it instead of a t-test?
With ranks or ratings, with small samples that are clearly skewed, or with outliers you can’t justify removing. With larger, roughly symmetric samples the t-test is a little more powerful and gives a difference in means you can interpret directly.
Why do other programs give a slightly different p-value?
Programs differ in whether they use the exact distribution, the normal approximation, the tie correction and the continuity correction. This page follows SciPy’s defaults and says which method it used.