Mann-Whitney U Test Calculator

Nonparametric tests

z-score1.98
Two-tailed p-value0.0477
Effect size r0.388
Standard deviation of U19.44
How this was calculated
  1. Under the null hypothesis the Mann-Whitney U statistic averages n1 x n2 / 2 = 12 x 14 / 2 = 84, with standard deviation sqrt(n1 n2 (n1 + n2 + 1) / 12) = 19.44.
  2. The observed U is 45, a distance of 39 from the null mean; with the continuity correction the z-score is (39 - 0.5) / 19.44 = 1.98.
  3. Two-tailed p-value from the normal approximation: 0.0477 - below the conventional 0.05 line.
  4. Effect size r = z / sqrt(N) = 1.98 / 5.10 = 0.388, the rank-biserial-style effect size reported with the test.

When two groups cannot be trusted to be normal - reaction times, Likert scales, hospital stays, anything skewed or ordinal - the Mann-Whitney U test compares them by rank instead of by mean. It asks whether a randomly drawn value from one group tends to exceed a randomly drawn value from the other, and it answers with the U statistic: a count of pairwise wins. For samples beyond the small tables, U is judged by a normal approximation, and that approximation is what this calculator performs.

Enter the two sample sizes and the U statistic from your rank calculation, and the page returns the null mean and standard deviation of U, the z-score with continuity correction, the two-tailed p-value, and the effect size r that modern reporting standards ask for beside the p. It is the back half of the test - the half software sometimes hides - made explicit and auditable.

Worked examples

U 45, z 1.98

(12 · 14 · 45)

z-score1.98
Two-tailed p-value0.0477
Effect size r0.388
Standard deviation of U19.44

U 120, z 2.15

(20 · 20 · 120)

z-score2.15
Two-tailed p-value0.0315
Effect size r0.340
Standard deviation of U36.97

U 30, z 0.53

(8 · 9 · 30)

z-score0.53
Two-tailed p-value0.5966
Effect size r0.128
Standard deviation of U10.39

Ranks, U and the null distribution

Pool both samples, rank everything, and U counts how many times a member of one group outranks a member of the other. Under the null hypothesis of identical distributions, U is centred exactly halfway: mean n1 x n2 / 2. For the first worked example, samples of 12 and 14 give a null mean of 84 - of the 168 cross-group pairs, half should be won by each side if the groups are the same. The observed U of 45 is far below that centre, saying group one's values systematically sit lower in the joint ranking.

The spread of U under the null is equally formulaic: standard deviation sqrt(n1 n2 (n1 + n2 + 1) / 12), which for the first example is 19.44. With both parameters known, the test reduces to a z-score - and the rest of the page is that reduction, done carefully, with the continuity correction that a discrete statistic judged by a continuous curve deserves.

Everything on this page flows from the three inputs, so a result can be checked end-to-end in seconds - one of the quiet virtues of a test whose null distribution is pure combinatorics.

  • Null mean of U = n1 x n2 / 2
  • Null SD of U = sqrt(n1 n2 (n1 + n2 + 1) / 12)
  • z = (|U - mean| - 0.5) / SD, with continuity correction
  • Effect size r = z / sqrt(n1 + n2)

Worked examples: three U statistics

The first example is the borderline every researcher meets: n1 12, n2 14, U 45, z 1.98, two-tailed p 0.0477 - just under the conventional 0.05 line, with effect size r 0.388, a medium effect by the usual bands. Report all three numbers and the borderline stops being a cliff edge: the reader sees a medium-sized shift that a study of 26 observations can only just resolve. The second example is firmer: two samples of 20, U 120 against a null mean of 200, standard deviation 36.97, z 2.15, p 0.0315, effect size 0.340.

The third example is the null behaving itself: samples of 8 and 9, U 30 against a mean of 36, z 0.53, p 0.5966, effect size 0.128. Nothing here suggests the groups differ, and the small effect size says the data are not merely underpowered for a large effect - the observed shift is itself small. Reading p and r together, as these examples do, is what separates a result from a ritual.

Which U to enter deserves a sentence, because software conventions differ: some packages report U for group one, some the smaller of the two possible values, and the two sum to n1 x n2 - 168 in the first example, so U 45 and U 123 are the same result stated from opposite sides. This calculator's z uses the distance from the null mean, so either convention gives the same z, p and r; if your software's U looks unfamiliar, check it against the null mean of 84 before suspecting the arithmetic.

n1 / n2UNull meanSD of Uzp (two-tailed)r
12 / 14458419.441.980.04770.388
20 / 2012020036.972.150.03150.340
8 / 9303610.390.530.59660.128

The normal approximation and continuity correction

U takes only whole-number values, but the normal curve is continuous; the continuity correction bridges the two by moving the observed U half a unit toward the null mean before computing z. In the first example that turns a raw distance of 39 into 38.5, and z from 2.01 into the more honest 1.98 - occasionally, as here, the correction is exactly what moves a result across the 0.05 boundary, which is an argument for applying it always rather than when convenient. This calculator applies it in every case and says so.

The approximation itself needs adequate samples: the usual rule asks both groups to reach about 8-10 observations (the third example, at 8 and 9, sits at the edge, where exact tables are preferable and the approximation is a guide). With ties in the data, the standard deviation should be reduced by a tie correction this page does not apply - heavily tied data (many identical values) will make the printed p slightly optimistic, and exact or tie-corrected software should confirm a borderline result.

Effect size and reporting

The effect size r = z / sqrt(N) converts the test into the correlation-like scale journals increasingly require: 0.1 small, 0.3 medium, 0.5 large, by Cohen's rough bands. The first example's 0.388 and the second's 0.340 are both medium - a fact invisible from their p-values (0.0477 and 0.0315) alone, since p mixes effect with sample size. The third example's 0.128 is small, completing the sentence the p-value of 0.5966 begins.

A complete report reads: U, the two sample sizes, z, p and r - 'U = 45, n1 = 12, n2 = 14, z = 1.98, p = 0.0477, r = 0.388' - plus medians for each group, because the test is about distributions, not means, and a rank test reported with means is a small irony worth avoiding. This page supplies every inferential element of that sentence from the three inputs.

The test's history explains its double name: Wilcoxon's rank-sum statistic and Mann and Whitney's U are linear transforms of each other - U is the rank sum minus the minimum it could take - so the two tests always agree exactly, and software may report either. Converting is one subtraction, and the z and p on this page are identical whichever form you start from, another reason the win-count definition of U is the one worth learning.

Mann-Whitney versus the t-test

The choice between them is about assumptions and estimands. The t-test compares means and, with normal data, is slightly more powerful; Mann-Whitney compares rank distributions - formally, the probability that a random value from one group exceeds a random one from the other - and keeps its validity under skew, outliers and ordinal measurement where the t-test's mean may not even be the quantity of interest. With truly normal data the efficiency loss is small (about 5 %); with heavy tails Mann-Whitney can be far more powerful, because ranks cap the influence of the extremes that inflate the t-test's variance.

One misreading to avoid: Mann-Whitney is a test of medians only under the extra assumption that the two distributions have the same shape. In general it detects stochastic dominance - one group tending to score higher - which the U statistic's win-counting definition makes literal: the first example's U of 45 against a null 84 says group one wins barely a quarter of the cross-group comparisons. That plain-language statement is the test's meaning, whatever the medians do.

Power planning runs the machinery backwards: given a target effect size - say the r of 0.340 in the second example - sample-size tables for Mann-Whitney ask for slightly larger groups than the equivalent t-test when data are normal, and smaller when they are not. Either way, the three quantities this page connects (n, U's null spread, and r) are the whole geometry of the design question.

The borderline example is the lesson: U 45 with samples of 12 and 14 gives z 1.98 and p 0.0477 only after the continuity correction - without it the same data overstate themselves at z 2.01.

FAQs

n1 12, n2 14, U 45: what is the z-score?

1.98, from a null mean of 84 and a standard deviation of 19.44, with continuity correction.

And the p-value for that test?

0.0477 two-tailed - just below the conventional 0.05 line.

What effect size should I report with it?

r = 0.388, the z-score divided by the square root of the total sample of 26.

Two samples of 20 with U 120?

z 2.15, p 0.0315, effect size 0.340, against a null mean of 200.

n1 8, n2 9, U 30 - is that significant?

No: z 0.53 and p 0.5966, with a small effect size of 0.128.

Why does the calculator apply a continuity correction?

U is discrete and the normal curve is not; the 0.5 adjustment turns the first example's raw z of 2.01 into the honest 1.98.

Sources

Related calculators

One-Sample T-Test Calculator
Test a sample mean against a hypothesised population mean: the t statistic, standard error, degrees of freedom, the critical value from the t table, and the verdict at your alpha.
Z-Score Calculator
The z-score of any value in a normal distribution, its percentile, and the share of values above and below it — the standardisation behind test scores and quality control.
Spearman Correlation Calculator
Spearman's rank correlation rho for five paired observations with average ranks for tied values, the sum of squared rank differences, the t statistic and a plain-language band for the strength of the monotone trend.