Mann-Whitney U test calculator
Compare two independent groups without assuming normal data. The Mann-Whitney U test, also called the Wilcoxon rank sum test, ranks all values together and asks whether one group tends to sit higher. Exact p for small samples without ties.
- Exact p when both groups are under 50 with no ties
- Normal approximation with tie and continuity corrections
- Matches R's wilcox.test
Sources checked on November 21, 2026. Results computed by the site's engine and tested against R and SciPy.
Mann-Whitney U test one-sided, greater
At the 5% level, there is no evidence of a difference in location between At term and 12 to 26 weeks.
| Group | n | Median | Mean |
|---|---|---|---|
| At term | 10 | 1.4150 | 1.3130 |
| 12 to 26 weeks | 5 | 0.9000 | 0.9760 |
p from the exact distribution (no ties, both groups under 50). W is R's statistic and equals U for the first group, as SciPy reports it; U1 + U2 = 10 × 5.
Reproduce this result in R or Python
R
x <- c(0.8, 0.83, 1.89, 1.04, 1.45, 1.38, 1.91, 1.64, 0.73, 1.46)
y <- c(1.15, 0.88, 0.9, 0.74, 1.21)
wilcox.test(x, y, alternative = "greater") # W = U for the first samplePython (SciPy)
from scipy.stats import mannwhitneyu
print(mannwhitneyu([0.8, 0.83, 1.89, 1.04, 1.45, 1.38, 1.91, 1.64, 0.73, 1.46], [1.15, 0.88, 0.9, 0.74, 1.21], alternative="greater")) # U for the first sampleWhen to use it
Use the Mann-Whitney test instead of an independent samples t-test when samples are small and clearly skewed, when there are outliers you cannot justify removing, or when the data are ranks or ordered scores rather than measurements. It uses only the order of the values, so one extreme value cannot dominate it. It tests whether values in one group tend to be larger than in the other; it is not a test of means.
Worked example: permeability constants
The calculator opens with the example in R's wilcox.test help page, from Hollander and Wolfe (1973): permeability constants of the human chorioamnion for 10 measurements at term and 5 at 12 to 26 weeks of pregnancy. The question, set in advance, is whether the first group is greater.
Ranking all 15 values together, the first group's ranks sum to 90. Subtracting 10 × 11 / 2 gives W = U = 35. With no ties and small groups the exact distribution applies, and the one-sided p is 0.1272. R prints W = 35, p-value = 0.1272. There is no evidence at the 5% level that the first group is higher. The two-sided p would be 0.2544.
W, U1 and U2
Software labels the statistic differently. R reports W, the rank sum of the first group minus its minimum possible value, which is the number of pairs in which a first-group value beats a second-group value. SciPy's mannwhitneyu reports the same number and calls it U for the first sample. Some textbooks use the smaller of U1 and U2, where U1 + U2 = n1n2; here U2 = 15. The calculator shows both, so you can match any of them.
Exact or approximate p
Like R, the calculator uses the exact distribution when both groups have fewer than 50 values and there are no ties. Otherwise it uses the normal approximation with a correction for ties and, by default, a continuity correction. SciPy chooses between methods with its own rule, so for mid-sized samples with ties its p can differ slightly from R's. The code under the result shows the call for each.
Compared with the t-test on the same data
Welch's one-sided t-test on these data gives t = 2.04 and p = 0.0311, lower than the rank test's 0.1272. With samples this small, the t-test leans on normality that is hard to check, while the rank test does not. Choose the test before seeing the results; running both and reporting the smaller p inflates false positives.
Reporting
Report the statistic, sample sizes and p, and describe the groups with medians: for example, W = 35, n1 = 10, n2 = 5, p = .127 (one-sided, exact). If you need an effect size, the rank-biserial correlation 2U/(n1n2) − 1 is common; here it is 0.40.
Sources
- R reference example output, stats-Ex.Rout.save checked November 21, 2026
- SciPy documentation: scipy.stats.mannwhitneyu checked November 21, 2026