One value per line or separated by commas. The two groups are independent — different people in each group.
RESULTS
The Mann-Whitney U test compares the two distributions by rank — it tests stochastic superiority (whether values from one group tend to be larger), NOT whether the medians are equal. Two groups can have identical medians and still differ by this test (see the demo below).
Enter both samples and press Calculate.
The Mann-Whitney U test compares two independent groups by rank — the non-parametric alternative to the two-sample t-test. Paste both samples and get the rank table, U1 and U2, the exact p-value for small samples, the normal approximation for large ones, and the rank-biserial effect size.
This test is for TWO INDEPENDENT groups — different people in each group. If the same subjects were measured twice, use the Wilcoxon signed-rank test instead. If both groups are roughly normal, the two-sample t-test is more powerful — use it instead. This test compares the whole distributions by rank — it does NOT test whether the medians are equal (see the worked demo below).
How to use the Mann-Whitney U test calculator
- Paste both samples. Group 1 in the first box, Group 2 in the second. One value per line, or separated by commas. The groups do not need the same size.
- Choose the tail and α. Two-tailed is the usual choice; pick a one-tailed alternative (Group 1 > Group 2, or Group 1 < Group 2) only if you stated the direction before seeing the data. α is 0.05 by default.
- Press Calculate. The calculator pools both samples, ranks them together, and returns U, the p-value, the rank-biserial effect size and the probability of superiority.
Try it now: the calculator is pre-filled with Worked Example 1 below — two teaching methods, five students each. Press Calculate and you should get U = 0 and an exact two-tailed p-value of 0.0079.
When should you use a Mann-Whitney U test?
Use this test when you have two independent groups and the two-sample t-test’s normality assumption is doubtful:
- The groups are not roughly normal. The two-sample t-test assumes both groups are roughly normal (or the samples are large). When the data are skewed, heavy-tailed or contain outliers, ranking is the safer choice.
- The samples are small. With few values per group, normality is hard to check and a single outlier can dominate a t-test.
- The data are ordinal or the scale is coarse. Ranks make sense when only the order of the values matters.
- You want a test of stochastic superiority. The test asks whether values from one group tend to be larger than values from the other — not whether the means or the medians are equal.
It is not a test for paired data. For the same subjects measured twice, use the Wilcoxon signed-rank test; for a single sample against a mean, use the one-sample t-test.
Two-sample t-test vs Mann-Whitney: which one do you need?
Decision box: if both groups look roughly normal, use the two-sample t-test — it is more powerful, and it tests the means. If the groups are skewed, have outliers, or the samples are too small to judge normality, use the Mann-Whitney U test. If the data are paired, use neither — use the Wilcoxon signed-rank test.
| Question | Two-sample t-test | Mann-Whitney U test |
|---|---|---|
| What does it test? | Whether the means differ | Whether values from one group tend to be larger (stochastic superiority) |
| Does it need normal groups? | Yes, roughly | No |
| Small samples | Risky if normality fails | Safer; exact p-value for n1, n2 ≤ 20 |
| Outliers | Can dominate the result | Muted, because only ranks are used |
| Equal group sizes | Not required | Not required |
| Power when the groups are normal | Higher | Slightly lower |
How do I read U, the p-value and the effect sizes together?
- U is the smaller of U1 and U2. A small U means one group’s ranks sit mostly below the other’s — the groups are separated.
- The p-value is the probability of a U at least this extreme if the two groups really came from the same distribution. For n1, n2 ≤ 20 with no ties, the calculator gives the exact p-value by enumerating all rank combinations; otherwise it uses the normal approximation with a tie correction, showing both the continuity-corrected p-value and the uncorrected one when they differ.
- The rank-biserial effect size is 1 − 2U/(n1n2). It runs from 0 to 1 when U is the smaller value: 0 means the groups overlap completely, 1 means they are fully separated. It is the rank-based counterpart of Cohen’s d for t-tests.
- The probability of superiority, P(Group 1 > Group 2) = U1/(n1n2), is the chance that a random value from Group 1 beats a random value from Group 2. In Example 1 it is 0.00: every value in Group 2 beats every value in Group 1.
- The medians are shown for description only. The test does not test the medians — see the demo below, where the medians are identical and the test still sees a difference in shape.
- The decision compares the p-value with your α. A p-value below α rejects the null hypothesis that the two distributions are the same.
Worked examples
Example 1 — two teaching methods
Method A (n = 5): 12, 15, 14, 10, 13. Method B (n = 5): 18, 20, 17, 22, 19. Pool the ten values and rank them: A takes ranks 1–5 (R1 = 15) and B takes ranks 6–10 (R2 = 40). U1 = 15 − 15 = 0, U2 = 25 − 0 = 25, so U = 0. The exact two-tailed p-value is 0.0079, so we reject H0 at α = 0.05. The asymptotic p-value is 0.0122, for reference. The rank-biserial effect size is 1.00 (maximum separation) and P(B > A) = 1.00. The medians are 13 vs 19.
| Value | Group | Rank |
|---|---|---|
| 10 | A | 1 |
| 12 | A | 2 |
| 13 | A | 3 |
| 14 | A | 4 |
| 15 | A | 5 |
| 17 | B | 6 |
| 18 | B | 7 |
| 19 | B | 8 |
| 20 | B | 9 |
| 22 | B | 10 |
Example 2 — ties
Group A: 5, 7, 7, 9, 11. Group B: 6, 8, 8, 10, 12. The ties at 7 share the average rank 3.5 and the ties at 8 share the average rank 5.5. R1 = 24, so U1 = 9, U2 = 16 and U = 9. An exact p-value is not available (ties exist), so the calculator uses the normal approximation with the tie correction and continuity correction: z = 0.6305, p = 0.5284 — fail to reject H0 at α = 0.05. The rank-biserial effect size is 0.28.
The median demo — identical medians, but the test still sees a difference
Group A: 1, 2, 3, 4, 5, 5, 5, 5, 5, 15. Group B: 0, 5, 5, 5, 5, 5, 6, 7, 8, 9. Both medians are 5.0 — yet U1 = 31.5, U2 = 68.5 and U = 31.5, with P(A > B) = 0.315. The exact p-value by permutation, as reported by SciPy, is 0.1903. For tied data the calculator above reports the normal approximation (p = 0.1460) instead.
Caption: identical medians, but A beats B only 31.5% of the time — the test sees the shape, not the medians.
How to do a Mann-Whitney U test in Excel
Excel has no built-in Mann-Whitney function, so the test is built by hand. Pool both groups in one column, keeping the group label in the next column, then:
- Rank the pooled values with =RANK.AVG, which gives tied values the average rank.
- Sum each group’s ranks to get R1 and R2.
- Compute U1 as =R1-n1*(n1+1)/2 and U2 the same way for Group 2; U is the smaller of the two.
- For the normal approximation, compute z from U, the mean n1n2/2 and the tie-corrected standard deviation, then get the two-tailed p-value with =NORM.S.DIST.
The parametric counterpart is =T.TEST(array1, array2, tails, 2) for the pooled test, or type 3 for Welch’s test. The Real Statistics Resource Pack provides a Mann-Whitney test as an add-in — an add-in, not Excel itself — if you would rather not build the ranks by hand.
Frequently asked questions
When do I use Mann-Whitney instead of the two-sample t-test?
When the groups are not roughly normal, when the samples are small, or when outliers make the means unreliable. If both groups are roughly normal, the two-sample t-test is more powerful, so use that instead.
Does it test the medians?
No. It tests whether values from one group tend to be larger than values from the other (stochastic superiority). Two groups can have identical medians and still differ by this test — see the median demo above.
What if there are ties?
Tied values share the average rank. Ties also rule out the exact p-value, so the calculator switches to the normal approximation with a tie correction to the variance.
What is U1 vs U2, and why is U the smaller one?
U1 is built from Group 1’s rank sum and U2 from Group 2’s. U is the smaller of the two, because a small U means one group’s ranks sit mostly below the other’s — which is the evidence against the null hypothesis.
What is the probability of superiority?
It is the chance that a random value from one group beats a random value from the other: P(Group 1 > Group 2) = U1/(n1n2). A value of 0.50 means neither group tends to be larger; 1.00 means Group 1 always wins.
What is the rank-biserial effect size?
It is 1 − 2U/(n1n2), running from 0 (complete overlap) to 1 (complete separation). It is the rank-based counterpart of Cohen’s d: it tells you how big the difference is, not just whether it is significant.
Sources: the rank-sum test follows the NIST/SEMATECH e-Handbook, Do two arbitrary processes have the same central tendency? — rank the combined samples, sum the ranks for each group, and form U from the rank sums. The NIST Dataplot T TEST reference notes that “The Wilcoxon rank sum test (also called the Mann-Whitney U test) can be used for the unpaired t test” (T TEST reference).
See all 67 free statistics tools on Empirical Rule Calculators.
Next steps
πβ Live
Hypothesis Testing Explained
The five steps of a hypothesis test, with worked z, t and chi-square examples.GuideRead the Guide β
πβ Live
Two-Sample T-Test Calculator
The parametric version β use it when both groups are roughly normal.CalculatorTry Calculator β
πβ Live
Shapiro-Wilk Test Calculator
Check whether each group is normal enough for a t-test.CalculatorTry Calculator β
More Tools to Explore
Keep going with the calculators that pair with the Mann-Whitney test — the two-sample t-test, the Wilcoxon test, the t-distribution and confidence intervals.
Two-Sample T-Test Calculator
The parametric version — use it when both groups are roughly normal.
Wilcoxon Signed-Rank Test Calculator
The same subjects measured twice — the paired version of the rank test.
Shapiro-Wilk Test Calculator
Check whether each group is normal enough for a t-test.
Cohen's d Calculator
Measure how big the difference is, not just whether it is significant.
Pooled Standard Deviation Calculator
Combine two samples’ spread into one pooled SD for two-sample tests.
T-Distribution Calculator
Look up any area, p-value or critical t for any degrees of freedom.
Explore All Tools →
Browse all 67 free statistics tools — every calculator on this site in one place.