Guides  /  mann whitney u test

The Mann-Whitney U test: a complete guide

The Mann-Whitney U test is the usual alternative when a t-test is not appropriate, and it is routinely described as a test of medians — which is only true under a condition most write-ups never check. This guide covers when to use it, what it actually tests, a full calculation by hand, and how to report it so the claim matches the evidence.

Hafiz Ahmad Tariq Written and reviewed by Hafiz Ahmad Tariq, Senior Biostatistician
Updated 17 August 202616 min read
What is the Mann-Whitney U test?

The Mann-Whitney U test is a non-parametric test that compares two independent groups by ranking all observations together and comparing the rank totals. It is used instead of an independent samples t-test when the data are ordinal, the distribution is heavily skewed, or the sample is too small to rely on normality. It tests whether one group tends to produce higher values than the other.

Definition

What the Mann-Whitney U test does

The Mann-Whitney U test pools both groups, ranks every observation from lowest to highest, and then asks whether one group's ranks cluster systematically higher than the other's. The raw values are used only to establish the ordering; after that they are discarded.

Mann-Whitney works on ranks, not on the raw values Group A 1215192431 Group B 1722283541 Pool and rank all 10 from lowest to highest: 1215 1719 2224 2831 3541 1234 5678 910 Group A ranks: 1 + 2 + 4 + 6 + 8 = 21 Group B ranks: 3 + 5 + 7 + 9 + 10 = 34 Because only the ORDER matters, one extreme outlier cannot drag the result the way it would a t-test.
Both groups are pooled and ranked together. Only the ordering survives into the calculation, which is what makes the test resistant to outliers.

That single design decision explains most of the test's behaviour. Because a score of 41 and a score of 4,100 both simply rank tenth, an extreme value cannot distort the result the way it would distort a mean. The cost is that genuine information about the size of the gaps is thrown away, which is why the test has slightly less power than a t-test when the t-test's assumptions do hold.

This also explains a property that surprises people: Mann-Whitney is not simply a weaker t-test. When the data are genuinely normal, it retains about 95% of the t-test's power — a small price. When the data are heavily skewed or contain outliers, it can be substantially more powerful than the t-test, because a single extreme value inflates the t-test's estimate of variability and shrinks the statistic. The choice is therefore not a trade of rigour for safety. On the kind of data that make people reach for it, the rank-based test is frequently the better-performing option as well as the more defensible one.

U and W are the same test

Mann-Whitney U and the Wilcoxon rank-sum test are mathematically equivalent and differ only in which statistic they report. SPSS gives both. Do not confuse either with the Wilcoxon signed-rank test, which is for paired data.

Choosing

When to use it instead of a t-test

SituationTest
Continuous outcome, roughly normal, adequate nIndependent samples t-test
Ordinal outcome (Likert item, rating, rank)Mann-Whitney U
Heavily skewed continuous outcomeMann-Whitney U
Small sample where normality cannot be assessedMann-Whitney U
Outliers you cannot justify removingMann-Whitney U
Paired or repeated measurementsWilcoxon signed-rank
Three or more independent groupsKruskal-Wallis

A common misconception is that you should test for normality first and let the result choose the test. In practice this is unreliable: with small samples the normality test has little power to detect real departures, and with large samples it flags trivial ones while the t-test is already robust. Choose on the measurement level and the visible shape of the distribution, and say so in your methods section.

Sample size is worth a note here too. The exact test becomes computationally heavy as groups grow, which is why software switches to the normal approximation above roughly 20 per group. The approximation is good at that size and better beyond it, so the switch costs nothing in practice — but it does mean the statistic you report changes form, from a U compared against a critical value to a z with an associated p. Both are the same test; only the presentation differs.

Do not run both and report the better one

Running a t-test and a Mann-Whitney and presenting whichever reaches significance is p-hacking. Decide on the basis of the data's measurement level and distribution, before looking at the outcome, and state the decision in advance.

Not sure which test your data support?

Answer four questions about your design and measurement level and be taken straight to the test that fits.

Use the test chooser

Assumptions

The assumptions, including the one that is usually missed

AssumptionWhat it requires
IndependenceEach participant appears in one group only
Ordinal or continuous outcomeThe values can be meaningfully ranked
Random samplingGroups drawn independently
Similar distribution shapeOnly if you want to claim a difference in medians

That last row is the one most write-ups skip, and it changes what your significant result is entitled to say.

Same shape, shifted valid to interpret as a difference in MEDIANS Different shapes only valid as “one group tends to score higher” The shape assumption decides what your significant result is allowed to claim.
If the two distributions have similar shapes, a significant result can be interpreted as a difference in medians. If they do not, it can only be read as one group tending to score higher.

Strictly, Mann-Whitney tests whether a randomly chosen observation from one group is likely to exceed a randomly chosen observation from the other — a property called stochastic dominance. Only when the two distributions have the same shape and spread does this reduce to a statement about medians.

What this means in practice

Plot both distributions. If they look similar in shape, write “median scores differed significantly”. If one is skewed and the other is not, write “scores in group A were significantly higher than in group B” and report both medians and ranges. The second claim is always safe; the first is not.

Worked example

Worked example: calculating U by hand

Two groups of five participants complete a task. Group A scores 12, 15, 19, 24, 31. Group B scores 17, 22, 28, 35, 41.

Step 1 — pool and rank

ValueGroupRank
12A1
15A2
17B3
19A4
22B5
24A6
28B7
31A8
35B9
41B10

Step 2 — sum the ranks

Rₐ = 1 + 2 + 4 + 6 + 8 = 21 and Rₖ = 3 + 5 + 7 + 9 + 10 = 34

As a check, the two must total N(N+1)/2 = 10 × 11 / 2 = 55. Here 21 + 34 = 55.

Step 3 — compute U for each group

Uₐ = nₐnₖ + nₐ(nₐ+1)/2 − Rₐ = 25 + 15 − 21 = 19

Uₖ = nₐnₖ + nₖ(nₖ+1)/2 − Rₖ = 25 + 15 − 34 = 6

A second check: Uₐ + Uₖ must equal nₐnₖ = 25. Here 19 + 6 = 25.

Step 4 — the decision

The test statistic is the smaller of the two, so U = 6. For nₐ = nₖ = 5 at α = .05 two-tailed, the critical value is 2. Since U = 6 is greater than 2, we do not reject the null: p = .222 (exact).

Small samples have very little power

With five per group, only a near-complete separation of the two sets of ranks would reach significance. Group B outscored group A on almost every comparison here and the test still could not reject the null. This is a power problem, not evidence that the groups are alike — report it as such.

Practicalities

Ties, and when to use the normal approximation

A word on why the test is so widely used in health and education research specifically. Outcome measures in those fields are frequently bounded scales, symptom counts or ratings — data that are ordinal by construction, bounded at both ends, and rarely symmetric. The t-test's assumptions are a poor fit for that shape of data, and transforming it to force normality tends to make the results harder to interpret rather than easier. A rank-based test sidesteps the problem entirely: it makes no distributional assumption at all, and the conclusion it supports translates naturally into plain language.

Handling ties

When two or more observations share a value, each receives the average of the ranks they would have occupied. Three observations competing for ranks 4, 5 and 6 all receive rank 5.

Ties reduce the variance of the rank sums, so the standard error must be adjusted. Every statistical package applies this correction automatically, but the hand formula does not — with many ties, a hand calculation will be slightly wrong. Likert data typically produce a great many ties, which is a good reason to let software do the arithmetic.

Floor and ceiling effects deserve a mention, because they arise constantly with rating scales. If a large share of respondents choose the same option — everyone selecting 5 on a 5-point item — the ranks become heavily tied and the test loses power sharply, since ranking cannot separate observations that are identical. When the effect is that pronounced, no rank-based test will rescue the analysis. The honest response is to report the distribution directly and note the ceiling, rather than presenting a significance test the data cannot support.

Exact test or normal approximation?

Sample sizeMethod
Either group ≤ 20Exact test — use critical value tables or software
Both groups > 20Normal approximation, reporting a z
Many tiesNormal approximation with the tie correction

With larger samples, U is converted to a z score:

z = (U − μ₢) / σ₢, where μ₢ = nₐnₖ/2 and σ₢ = √[nₐnₖ(N+1)/12]

Report what your software actually produced

SPSS reports both an exact and an asymptotic p-value. For small samples quote the exact one, and say that you have. Quoting the asymptotic value for n = 6 per group and calling it exact is the kind of detail an examiner checks.

Worked example

Worked example: a realistic sample

Five per group demonstrates the mechanics but has almost no power. Here is the same test on a realistic sample, using the normal approximation your software will apply.

Two groups of 40 rate a service on a 7-point scale. The rank sums come out as Rₐ = 1,384 and Rₖ = 1,856, which correctly total N(N+1)/2 = 80 × 81 / 2 = 3,240.

Step 1 — U

Uₐ = nₐnₖ + nₐ(nₐ+1)/2 − Rₐ = 1,600 + 820 − 1,384 = 1,036

Uₖ = 1,600 + 820 − 1,856 = 564. These sum to 1,600, as they must.

Step 2 — the normal approximation

μ₢ = nₐnₖ/2 = 800

σ₢ = √[nₐnₖ(N+1)/12] = √[1,600 × 81 / 12] = √10,800 = 103.92

z = (564 − 800) / 103.92 = −2.271, giving a two-tailed p = .023.

Step 3 — effect size

r = |z| / √N = 2.271 / √80 = 2.271 / 8.944 = 0.254 — a small to medium effect.

QuantityValue
U (smaller)564
z−2.271
p (two-tailed).023
r0.254
Common language effect size1,036 / 1,600 = 0.65
Note the tie correction

Seven-point rating scales produce a great many ties, and ties reduce the variance of the rank sums. The σ above assumes none, so with real Likert data your software will report a slightly smaller standard error and therefore a slightly larger z. Use the software figure, not the hand calculation.

Related tests

The wider family of rank-based tests

Mann-Whitney is one member of a family, each matched to a design. Choosing the wrong member is a common and easily avoided error.

DesignParametric testRank-based equivalent
Two independent groupsIndependent t-testMann-Whitney U
Two paired measurementsPaired t-testWilcoxon signed-rank
Three or more independent groupsOne-way ANOVAKruskal-Wallis
Three or more paired measurementsRepeated measures ANOVAFriedman
Association between two variablesPearson’s rSpearman’s rho

The pattern is consistent: each rank-based test replaces the raw values with their ranks and asks the same structural question. They are all somewhat less powerful than their parametric counterparts when the parametric assumptions genuinely hold, and considerably more trustworthy when they do not.

Following up a significant Kruskal-Wallis

Kruskal-Wallis tells you that at least one of three or more groups differs, exactly as an ANOVA does. Follow it with pairwise Mann-Whitney tests corrected for multiplicity — Dunn's test is the standard procedure and applies the correction for you.

Effect size

Effect size

The usual effect size is the rank-biserial correlation, most simply computed from the z score:

r = z / √N, where N is the total sample size across both groups

rConventional label
0.10Small
0.30Medium
0.50Large

An alternative that is easier to explain to a non-technical reader is the common language effect size: the probability that a randomly chosen member of one group scores higher than a randomly chosen member of the other. It is computed directly from U as U / (nₐnₖ). In our worked example, 19 / 25 = 0.76 — a participant from group B outscores one from group A about 76% of the time.

Report medians, not means

If you chose Mann-Whitney because the data are skewed or ordinal, reporting group means alongside it undercuts that reasoning. Give the median and the interquartile range, which are the statistics consistent with the test.

Run the test with the effect size included

Our Mann-Whitney calculator ranks your data, handles ties, gives U, the z score, the exact p-value and the rank-biserial effect size, with a formatted reporting sentence.

Use the calculator

Pitfalls

Six mistakes that cost marks

1. Claiming a difference in medians without checking distribution shape

Only valid when the two distributions have similar shapes. Otherwise the claim is about one group tending to score higher.

2. Reporting means alongside a Mann-Whitney

Report medians and interquartile ranges — the statistics that match the test you chose.

3. Using it on paired data

Mann-Whitney requires independent groups. For before-and-after measurements use the Wilcoxon signed-rank test.

4. Choosing the test based on a normality test alone

Normality tests are underpowered in small samples and oversensitive in large ones. Decide on measurement level and distribution shape.

5. Running it on three or more groups pairwise

That inflates the false positive rate. Use Kruskal-Wallis, then follow up with corrected pairwise comparisons.

6. Omitting the effect size

A p-value alone says nothing about magnitude. Report the rank-biserial correlation or the common language effect size.

Reporting

Reporting Mann-Whitney in APA style

SituationHow to write it
Large samplesU = 412.50, z = −2.31, p = .021, r = .28
Small samples, exactU = 6, p = .222 (exact)
With descriptivesMdn = 24 (IQR 15–31) vs Mdn = 28 (IQR 22–35)
Very small pp < .001
Report U, and z as well when using the normal approximation
Give medians and IQRs for both groups, not means
State exact or asymptotic p-value
Include the effect size
Give both group sizes
Say why you chose a non-parametric test
A sentence that earns marks

“As task scores were markedly right-skewed, a Mann-Whitney U test was used. Scores were significantly higher in group B (Mdn = 28, IQR 22–35) than group A (Mdn = 19, IQR 15–24), U = 412.50, z = −2.31, p = .021, r = .28. As the two distributions differed in shape, this is interpreted as a tendency for group B to score higher rather than a difference in medians.”

Have your non-parametric analysis checked

Send your dataset and draft results. A named statistician confirms the test fits the measurement level, runs it with the correct tie handling, and returns APA tables.

See SPSS data analysis

Answers

Frequently asked questions

When should I use the Mann-Whitney U test instead of a t-test?

Use it when your outcome is ordinal, when a continuous outcome is heavily skewed, when the sample is too small to assess normality, or when outliers you cannot justify removing would distort the means. Decide on measurement level and distribution shape rather than on the result of a normality test.

Does the Mann-Whitney test compare medians?

Only when the two distributions have a similar shape and spread. Strictly it tests whether a randomly selected observation from one group tends to exceed one from the other. If the shapes differ, report it as one group scoring higher rather than as a difference in medians.

What is the difference between Mann-Whitney U and Wilcoxon?

Mann-Whitney U and the Wilcoxon rank-sum test are the same test with different statistics reported. The Wilcoxon signed-rank test is a different test entirely, used for paired data such as before-and-after measurements on the same participants.

How do I handle tied values?

Each tied observation receives the average of the ranks they would have occupied. Ties reduce the variance of the rank sums, so a correction to the standard error is needed. Software applies this automatically; hand calculation does not, so with many ties let your software do the work.

What effect size should I report?

The rank-biserial correlation, r = z / √N, with .10 small, .30 medium and .50 large. The common language effect size, U divided by the product of the two group sizes, is often easier to explain: it gives the probability that a randomly chosen member of one group scores higher than one from the other.

Can I use Mann-Whitney for more than two groups?

No. Running it on every pair inflates the false positive rate. Use the Kruskal-Wallis test for three or more independent groups, then follow up with pairwise comparisons that correct for multiplicity.

Should I report means or medians with a Mann-Whitney test?

Medians with interquartile ranges. If you chose a rank-based test because the data are skewed or ordinal, reporting means alongside it contradicts that reasoning and reviewers will query it.

Send the data. Get a fixed quote.

Attach your dataset or just describe the project. A named statistician replies with a price and a deadline, usually within one working day.