Comparing two groups · Choose a method

Mann–Whitney U test vs t-test: which should you use?

The t-test compares means; the Mann–Whitney test asks whether one group tends to have larger values. Choose by the question you need answered, not by a normality test.

By Licklider · Published · Last reviewed · How this page was made · Markdown

On this page
  1. What each test answers
  2. Same data, three answers
  3. Choose from the question, not from a normality test
  4. Very small samples: the rank test runs out of room
  5. Unequal spreads affect the rank test too
  6. Check what your software ran
  7. Report it so a reviewer can check it
  8. References

Quick answer. Pick the test that answers your question. If you need the difference in means (for example, how much a dose raises a marker on average), use Welch’s t-test — on a log scale if effects are proportional. If you need to know whether values in one group tend to be larger than in the other, use the Mann–Whitney U test (also called the Wilcoxon rank-sum test). Both are for two independent groups; for the same subjects measured twice, use the paired versions. Read a Mann–Whitney result as “tends to be larger”, not as a difference in medians, and use the Brunner–Munzel test when the spreads differ. With three animals per group, an exact two-sided Mann–Whitney test tops out at p = 0.10, so plan at least four or five per group if you need a rank test.

What each test answers

Welch’s t-test Mann–Whitney U test
Question Do the group means differ? Is a random value from one group likely to be larger than one from the other?
Effect to report Difference in means with 95% CI (or a ratio, on the log scale) Probability of superiority, U ÷ (n₁ × n₂), or a shift estimate
Uses The values themselves Only their ranks
Sensitive to Extreme values, which pull the mean The ordering of values; also differences in spread or shape

More precisely, the Mann–Whitney test asks whether P(X > Y), plus half the probability of a tie, differs from ½ for a value X from one group and Y from the other (Divine et al. 2018).

The Mann–Whitney test equals a comparison of medians only under an extra assumption: that the two distributions have the same shape and differ by a pure shift (Fay & Proschan 2010; Divine et al. 2018, whose counter-examples show it “fails to be a test of medians”). When groups differ in spread — common after a treatment that affects some animals strongly and others not at all — a significant result can occur even when the medians are equal.

Same data, three answers

A constructed example: a cytokine (pg/mL) in 8 control and 8 treated mice. Most treated mice rise modestly; one rises enormously.

Control Treated
Median 12.5 20.5
Mean 12.8 29.9
import numpy as np
from scipy import stats

control = np.array([12, 15, 9, 18, 11, 14, 10, 13])
treated = np.array([16, 22, 14.5, 31, 19, 95, 17, 25])

stats.ttest_ind(treated, control, equal_var=False)                    # means, raw scale
stats.mannwhitneyu(treated, control, method="exact")                  # tends to be larger?
stats.ttest_ind(np.log(treated), np.log(control), equal_var=False)    # ratio of geometric means
Analysis Answers Result
Welch’s t-test, raw values Difference in means: 17.2 pg/mL, 95% CI −5.3 to 39.6 p = 0.11
Mann–Whitney U, exact Probability a treated mouse exceeds a control mouse: 0.94 (U = 60 of 64) p = 0.002
Welch’s t-test, log scale Treated values about 1.95 times control (95% CI 1.16 to 3.27) p = 0.017

R gives the same results: t.test(treated, control) (p = 0.114), wilcox.test(treated, control, exact = TRUE) (W = 60, p = 0.0019) and t.test(log(treated), log(control)) (p = 0.017).

What this shows. The single 95 pg/mL mouse inflates the treated group’s mean and spread, so the raw-scale t-test leaves the mean difference poorly determined. The rank test ignores how extreme that mouse is and sees that almost every treated mouse exceeds almost every control. The log-scale t-test treats the effect as proportional and lands between the two. All three are legitimate — they answer different questions. Write down which question matters before you analyse, and report that test.

Choose from the question, not from a normality test

A common habit is to run a normality test first and switch to Mann–Whitney when it is “significant”. Choose from the question and the measurement instead, for three reasons. For small samples the Shapiro–Wilk test lacks power to detect non-normality (Rochon, Gondan & Kieser 2012), and in large samples it flags trivial departures; a two-stage choice also distorts the final error rate, as testing variances first does (Rasch, Kubinger & Moder 2011). Choose from the question and from what you know about the measurement:

  • Concentrations, fold changes and other positive, proportional measures: compare logs with Welch’s t-test.
  • An ordinal score or values with a floor or ceiling: a rank test is natural.
  • Roughly symmetric measurements: Welch’s t-test.

With larger samples the t-test copes well with skewed data, because the mean of many values is close to normal: for large studies, t-tests and their confidence intervals “can and should be used even for heavily skewed data” (Fagerland 2012). So write the choice into your analysis plan before you see the data.

Very small samples: the rank test runs out of room

Ranks can only be arranged in so many ways. When the groups do not overlap at all — the strongest possible result — the exact two-sided Mann–Whitney p-value is still limited:

Group sizes Smallest possible p (two-sided, exact)
3 vs 3 0.100
3 vs 4 0.057
4 vs 4 0.029
3 vs 5 0.036
5 vs 5 0.008

So with three animals per group, the exact two-sided test stops at p = 0.10 however large the effect; if your software reports a smaller p for 3 vs 3, it used a normal approximation that is not valid at this size. Plan four or more per group if a rank test is your analysis, or see t-test with n = 3 for how to analyse three per group.

Unequal spreads affect the rank test too

Switching to Mann–Whitney does not solve unequal variances. In simulations, small differences in variance and moderate skewness produced large departures from the nominal false-positive rate (Fagerland & Sandvik 2009); the test can be conservative or liberal depending on group sizes and spreads (Brunner & Munzel 2000). The Brunner–Munzel test is built for this situation and has been recommended as the default rank-based test (Karch 2021). It is available as scipy.stats.brunnermunzel and in R packages; with small samples, use its permutation version. If you expect one group to be more variable, name Brunner–Munzel in the analysis plan.

Check what your software ran

Software Call Default worth knowing
R wilcox.test(x, y) Exact p-value when the samples contain fewer than 50 values; with ties, R 4.3 falls back to a normal approximation and warns “cannot compute exact p-value with ties” (the R development documentation describes exact conditional p-values with ties)
SciPy stats.mannwhitneyu(x, y) method="auto" uses the exact distribution when one sample has 8 or fewer values and there are no ties, otherwise an asymptotic approximation; alternative="two-sided"

The statistic is labelled differently: R reports W, SciPy and Prism report U. R’s W is the same number as SciPy’s U for the first group listed; listing the groups the other way round gives n₁ × n₂ − U instead. The p-value is unaffected, so compare p-values when checking a result.

Report it so a reviewer can check it

Methods sentence:

Cytokine levels were compared between groups with a two-sided exact Mann–Whitney U test (Wilcoxon rank-sum test), chosen before the data were analysed because [the outcome is ordinal / we were interested in whether values tend to be higher].

Results sentence (the example above):

Cytokine levels were higher in treated mice (median 20.5 pg/mL, n = 8) than in controls (median 12.5 pg/mL, n = 8); the probability that a treated mouse exceeded a control mouse was 0.94 (Mann–Whitney U = 60, exact p = 0.002).

Report the medians with their ranges or interquartile ranges, the U statistic, the exact p-value and an effect size — the probability of superiority, U ÷ (n₁ × n₂), also called Vargha and Delaney’s A (Vargha & Delaney 2000) — and show every data point in the figure.

References

  • Brunner E, Munzel U (2000). The nonparametric Behrens–Fisher problem: asymptotic theory and a small-sample approximation. Biometrical Journal 42(1):17–25. doi:10.1002/(SICI)1521-4036(200001)42:1<17::AID-BIMJ17>3.0.CO;2-U
  • Divine GW, Norton HJ, Barón AE, Juarez-Colunga E (2018). The Wilcoxon–Mann–Whitney procedure fails as a test of medians. The American Statistician 72(3):278–286. doi:10.1080/00031305.2017.1305291
  • Fagerland MW, Sandvik L (2009). The Wilcoxon–Mann–Whitney test under scrutiny. Statistics in Medicine 28(10):1487–1497. doi:10.1002/sim.3561
  • Fagerland MW (2012). t-tests, non-parametric tests, and large studies — a paradox of statistical practice? BMC Medical Research Methodology 12:78. doi:10.1186/1471-2288-12-78
  • Fay MP, Proschan MA (2010). Wilcoxon–Mann–Whitney or t-test? On assumptions for hypothesis tests and multiple interpretations of decision rules. Statistics Surveys 4:1–39. doi:10.1214/09-SS051
  • Karch JD (2021). Psychologists should use Brunner-Munzel’s instead of Mann-Whitney’s U test as the default nonparametric procedure. Advances in Methods and Practices in Psychological Science 4(2). doi:10.1177/2515245921999602
  • Rasch D, Kubinger KD, Moder K (2011). The two-sample t test: pre-testing its assumptions does not pay off. Statistical Papers 52:219–231. doi:10.1007/s00362-009-0224-x
  • Rochon J, Gondan M, Kieser M (2012). To test or not to test: preliminary assessment of normality when comparing two independent samples. BMC Medical Research Methodology 12:81. doi:10.1186/1471-2288-12-81
  • Vargha A, Delaney HD (2000). A critique and improvement of the CL common language effect size statistics of McGraw and Wong. Journal of Educational and Behavioral Statistics 25(2):101–132. doi:10.3102/10769986025002101
  • Software documentation accessed 10 November 2026: SciPy 1.18 scipy.stats.mannwhitneyu and brunnermunzel; R stats::wilcox.test (release and development versions).

How this page was made

  • Written and published by Licklider. Recommendations cite peer-reviewed methods papers and official software documentation listed under References; cited figures were checked against the source text.
  • The worked example uses constructed data. Its numbers were produced by stored code (Python with SciPy 1.18.1; R 4.3.3), and the two implementations agree.
  • Separate review passes checked the statistics, the citations and readability before publication.