The Mann-Whitney U test asks whether two independent samples come from populations with the same distribution, using only the order of the observations rather than their values. This Mann-Whitney U test calculator ranks the pooled data, assigns tied observations their average rank, computes both U statistics, and returns a p-value from the exact null distribution when the samples are small and untied, or from the tie-corrected normal approximation when they are not. It always states which of the two it used, because the difference matters and most calculators do not mention it.
Arb Digital built the page around the two things that are usually got wrong: tie handling and the exact-versus-approximate boundary. A tie correction changes the standard deviation in the denominator of the z score, and skipping it makes the p-value too large — conservative, but wrong. Using a normal approximation with five observations per group is wrong in the other direction. Neither error announces itself in the output of a tool that stays quiet about its method.
What This Mann-Whitney U Test Calculator Does
It pools both samples, sorts them, assigns ranks from one upward with tied values sharing the average of the ranks they span, and sums the ranks belonging to each sample. From those rank sums it derives U₁ and U₂, which always add to n₁ × n₂. The smaller of the two is the conventional test statistic. It then produces a p-value, a z score, and the rank-biserial correlation as an effect size, alongside the full rank table so you can see exactly how each observation was treated.
The test is the non-parametric counterpart to the independent-samples t-test on our t-test calculator. Where the t-test compares means and assumes approximately normal populations, this one compares distributions through their ranks and assumes nothing about shape. It is the right choice for ordinal data, for small samples with visible skew, and for data with outliers that would drag a mean around. If you already have a test statistic and simply want the tail probability, our p-value calculator converts it directly.
How to Use It
- Paste each sample into its own box. The groups need not be the same size, and the test handles unequal n without adjustment.
- Choose the alternative hypothesis before you look at the data. Picking a one-tailed test after seeing which group came out higher doubles your false positive rate.
- Leave the method on automatic. It selects the exact distribution when both samples are ten or fewer and there are no ties, and the tie-corrected normal approximation otherwise.
- Read the rank table when a result surprises you. Tied values sharing a fractional rank are the usual explanation for a U statistic that differs from a hand calculation.
- Report the effect size with the p-value. Rank-biserial correlation runs from −1 to +1 and describes how consistently one group outranks the other.
The Method and How It's Calculated
Take a small example with no ties. Sample 1 is 12, 15, 18, 20 and sample 2 is 10, 11, 14, 17. Sorted together they run 10, 11, 12, 14, 15, 17, 18, 20, so the ranks belonging to sample 1 are 3, 5, 7 and 8, summing to 23. The formula U₁ = R₁ − n₁(n₁ + 1)/2 gives 23 − 10 = 13, and U₂ = n₁n₂ − U₁ = 16 − 13 = 3. The test statistic is the smaller value, 3.
What U counts is pairwise wins. Compare every observation in sample 1 against every observation in sample 2 — sixteen comparisons here — and U₁ is the number of pairs where the sample 1 value is larger, with ties counting as a half. That interpretation is worth holding on to, because it explains the effect size directly: rank-biserial correlation is 1 − 2U/(n₁n₂), which is simply the win rate rescaled to run from −1 to +1.
Under the null hypothesis U has mean n₁n₂/2 and, with no ties, standard deviation √(n₁n₂(N + 1)/12) where N is the combined sample size. The z score is the standardised distance of the observed U from that mean, optionally with a half-unit continuity correction because U is discrete and the normal curve is not. The construction and the small-sample tables are set out in the NIST/SEMATECH e-Handbook section on comparing two arbitrary processes.
Ties Are Not a Detail
When two or more observations share a value there is no honest way to say which should rank higher, so they all take the average of the ranks they occupy. Three observations tied for ranks 4, 5 and 6 each receive rank 5. This keeps the total rank sum equal to N(N + 1)/2, which is what the U formulas depend on.
The consequence is in the variance. Ties reduce the spread of the null distribution of U, so the correct standard deviation is smaller than the untied formula gives. The corrected version subtracts a term built from the tie group sizes: for each group of t equal values, t³ − t is accumulated and divided by N(N − 1) before being taken off N + 1. Ignoring the correction inflates the denominator of the z score, shrinks z, and pushes the p-value up. You will fail to detect real differences.
Ties also rule out the exact distribution. The exact p-value is computed by counting how many of the possible rank assignments give a U as extreme as the observed one, and that count assumes every observation has a distinct rank. With ties present the exact enumeration no longer matches the data, so this tool switches to the tie-corrected approximation and says so in the working panel rather than quietly returning an exact figure that does not apply.
Exact Versus Normal: Where the Boundary Sits
For small samples the null distribution of U is visibly lumpy. With four observations in each group there are only seventy possible rank arrangements, so U can take a limited set of values and the achievable p-values come in coarse steps. Fitting a smooth normal curve to that produces noticeably wrong tail probabilities, which is why printed U tables exist for small n at all.
As the samples grow the distribution smooths out quickly. The usual working rule is that the normal approximation is adequate once both groups have at least eight to ten observations, and this calculator uses the exact distribution when both are at most ten and there are no ties. Between those regimes the two methods agree closely; below them they do not, and the exact value is the one to report.
The continuity correction is a separate choice. Because U takes whole or half-integer values while the normal curve is continuous, subtracting half a unit from the distance between U and its mean gives a better match to the discrete tail. It always makes the p-value slightly larger. Most software applies it by default and this tool does too, but the option is exposed above because some textbooks omit it and you may need to reproduce their number.
What the Test Actually Assumes
The Mann-Whitney U test is described as assumption-free far too often. It assumes the observations are independent both within and between groups, that the measurement scale is at least ordinal, and that the two samples were drawn from populations that either are identical or differ by a shift in location. That last assumption is the one people skip.
If the two distributions have genuinely different shapes — one symmetric and one strongly skewed, or one much more spread out than the other — then a significant result tells you the distributions differ, but not that one is systematically higher. The test can reject the null because of a variance difference alone, with medians that are identical. Plotting both samples before running the test is the only reliable defence, and comparing the spreads with our standard deviation calculator or the quartiles with our interquartile range calculator takes a few seconds.
It is also not a test of medians in general. It becomes one only under the shift assumption. The broader framing of what a two-sample comparison can and cannot establish is set out in the NIST/SEMATECH e-Handbook introduction to comparisons, which is worth reading before any two-group test rather than after it.
Reading U, z and the Effect Size Together
U on its own is hard to interpret because its scale depends on the sample sizes. A U of 20 means something quite different with five observations per group than with fifty. Dividing by n₁n₂ fixes this: the result is the probability that a randomly chosen member of one group exceeds a randomly chosen member of the other, a quantity sometimes called the common language effect size, and it is directly interpretable.
Rank-biserial correlation is the same information centred on zero. A value of 0 means the two groups are perfectly interleaved; +1 means every observation in sample 1 exceeds every observation in sample 2; −1 is the reverse. Reporting it alongside the p-value distinguishes a small consistent difference in a large sample from a large difference in a small one, which a p-value alone cannot do.
The z score is a bridge rather than a result. It is how the approximate p-value is obtained, and quoting it is useful mainly for reproducibility, since anyone can convert it back with our z-score calculator. When the exact method is used no z score is needed at all, and the one displayed is the approximate figure shown for comparison.
Choosing Between This and the Alternatives
Two independent groups with roughly normal data and no serious outliers: the independent-samples t-test has more statistical power, so use it. Two independent groups with skew, outliers, ordinal ratings or very small samples: the U test. Two related measurements on the same subjects, such as before and after: neither of these — that needs a paired test, because the independence assumption fails outright.
Three or more independent groups extend the same idea through the Kruskal-Wallis test, which is the rank-based analogue of one-way analysis of variance. Categorical counts rather than measurements belong in a contingency table, which our chi-square calculator handles. Where the question is about association between two ranked variables rather than a difference between groups, the tool you want is our Spearman rank correlation calculator.
Arb Digital runs experiments with the sample sizes and the tests stated up front, so the result means what it appears to mean.
Browse All Free Tools Talk To Our TeamCommon Mistakes to Avoid
- Ranking each sample separately — the ranks must come from the pooled data, because the whole test is about how the two groups interleave.
- Ignoring the tie correction — it shrinks the standard deviation, and leaving it out makes the p-value too large so real differences go undetected.
- Using the test on paired data — before-and-after measurements on the same subjects violate independence and need a paired rank test instead.
- Calling a significant result a difference in medians — that reading holds only if the two distributions have the same shape and differ by a shift.
- Choosing a one-tailed test after seeing the data — the direction has to be specified in advance or the stated error rate is not the real one.
Related Free Tools From Arb Digital
Run the parametric alternative on the t-test calculator, convert a statistic to a tail probability with the p-value calculator, check the spread of each group with the standard deviation calculator, summarise the centre with the mean, median and mode calculator, or test association between ranks with the Spearman rank correlation calculator. The full free online tools hub lists every statistics tool we publish.
Frequently Asked Questions
Use it when the data are ordinal, visibly skewed, contain outliers, or come from samples too small to judge normality. When the data are approximately normal the t-test has more power and is the better choice.
Every tied observation receives the average of the ranks that group would have occupied. Three values tied across ranks four, five and six each take rank five, which keeps the total rank sum correct.
Ties reduce the variance of the null distribution of U, so the standard deviation used in the z score must be corrected downward. Without that correction the z score is too small and the p-value too large.
This tool uses the exact distribution when both samples have ten or fewer observations and no ties are present. Larger samples, or any tie, switch it to the tie-corrected normal approximation.
U takes discrete values while the normal curve is continuous, so half a unit is subtracted from the gap between U and its mean before standardising. It makes the approximate p-value slightly larger and slightly more accurate.
Only if the two distributions have the same shape and differ by a shift in location. If the shapes differ, a significant result means the distributions differ in some way that need not be a median difference.
Convention is to report the smaller of U₁ and U₂ together with both sample sizes, since the two always add to n₁ times n₂ and either one determines the other.
Yes. Unequal group sizes need no adjustment; the formulas already use n₁ and n₂ separately, and the test remains valid provided the observations are independent.
This page explains a statistical method for study and for checking your own working. It is not a substitute for advice from a qualified statistician, and it is not medical, legal, or financial advice.