Mann-Whitney U test calculator

Paste two lists of raw numbers from two independent groups, for example order value or time on page. The Mann-Whitney U test compares the ranks. You get the U statistic, exact and asymptotic p values, the tie-corrected normal approximation, and the rank-biserial effect size.

Short answer. Enter two independent samples of raw values. The calculator returns U1, U2, the midranks, the rank sums, the exact two-sided p value when there are no ties and each sample has at most 49 values, the asymptotic p value with and without the continuity correction, and the rank-biserial correlation. On the SciPy documentation example the page gives U1 = 17, U2 = 3 and the exact p value 0.1111111111111111, as the SciPy v1.18.0 manual prints. The table below shows each value.

Updated 2026-10-29

Calculator

Two independent samples

Each sample needs at least 1 value. Separate the values with spaces, commas, semicolons or line breaks. Enter whole or decimal numbers from -1000000000 to 1000000000. Do not write thousands separators: 1,250 is read as the two values 1 and 250. Paste one group per box.

The SciPy documentation example

The example data come from the SciPy manual for scipy.stats.mannwhitneyu: the ages at which nine randomly sampled young adults, five males and four females, were diagnosed with type II diabetes. SciPy takes the example from Rosie Shier, "Statistics: 2.3 The Mann-Whitney U Test", Mathematics Learning Support Centre, 2004. The table shows what this page calculates and what the SciPy v1.18.0 manual prints. The two asymptotic p values agree to 12 decimal places. SciPy manual, scipy.stats.mannwhitneyu.

Page output versus SciPy for the documentation example
QuantityThis pageSciPy v1.18.0 manual
U1 (males)1717.0
U2 (females)33.0
p, exact two-sided0.11111111111111110.1111111111111111
p, asymptotic with continuity correction0.111346886533140620.11134688653314041
p, asymptotic without continuity correction0.086410732973700060.0864107329737

With n = 5 and n = 4 there are 126 ways to split 9 ranks into groups of 5 and 4. The ranks of the males are 3, 5, 7, 8 and 9. Their rank sum is 3 + 5 + 7 + 8 + 9 = 32, so U1 = 32 − 5·6/2 = 17. The two-sided exact p value counts the splits with U ≤ 3 or U ≥ 17: 14 of 126, which is 1/9.

Ties and what SciPy does

Effect size, the rank-biserial correlation

Alongside the p value the page reports the rank-biserial correlation r = 1 − 2U2/(n1·n2), which runs from −1 (every value in B is larger) to +1 (every value in A is larger). For the SciPy example r = 1 − 2·3/20 = 0.7. A p value measures the evidence against the null hypothesis that the two samples come from the same distribution; the rank-biserial tells you how strongly one group dominates. Fay and Proschan (2010) discuss the stochastic ordering and the Mann-Whitney functional views of the WMW test in "Wilcoxon-Mann-Whitney or t-test? On assumptions for hypothesis tests and multiple interpretations of decision rules", Statistics Surveys 4:1–39. Fay and Proschan 2010.

The calculator prints the midranks of each sample with every result, so you can verify the rank assignment by hand before you trust the p values.

Another view, the probability of a larger value

Divide U1 by n1·n2 and you get an estimate of p = P(A > B) + 0.5·P(A = B): the probability that a random value from sample A is larger than a random value from sample B, with half of the ties counted. The statsmodels manual defines this p for rank_compare_2indep, and its result object has methods for confidence intervals. For the SciPy example, U1/(n1·n2) = 17/20 = 0.85. statsmodels manual, rank_compare_2indep.

Mann-Whitney U or the two-sample t test?

The SciPy manual says: "When the means of samples from the populations are normally distributed, consider scipy.stats.ttest_ind." statsmodels states that the Mann-Whitney U test assumes equal variance or equal distribution under the null hypothesis. The chi-square test is not an alternative here: it works on category counts, not on raw values. For paired values of the same subjects, the SciPy manual names scipy.stats.wilcoxon.

Limits and accuracy

Disclaimers

By Michael Lip, builder and maintainer of ABWex, open source at github.com/theluckystrike/abwex.com. Profile.

ABWex is a free A/B test statistics calculator from Zovo Tools. The calculation runs in your browser in JavaScript. The page does not send the numbers that you enter to a server. Published 2026-10-29.

Explore ABWex

By the same builder: GitHub, theluckystrike BeLikeNative, Grammar AI EarlyThunder, Dev Blog Bug Bounty Reality Zovo, AI Dev Tools