A/B tests · For studentsMann–Whitney U test calculator
An online Mann–Whitney U test solved step by step: a ranking table of both samples, ties with the mean rank, rank sums and U, an exact p for small samples without ties and the normal approximation with corrections. Effect size r, group medians, and Python and R code. For skewed data, outliers and ordinal scales.
Your numbers stay in the browser and are never sent anywhere
The test compares distributions, not means: it checks whether the values of one group tend to be higher. It suits skewed data, outliers and ordinal scales.
Numbers separated by spaces, semicolons, “, ” or new lines — you can paste a column from Excel. The samples may differ in length.
α = 0.05 · two-sided test
Significance level α
Choose it only if you decided in advance that B cannot be worse and a negative result does not interest you.
02
Result
The distributions differ
Values in B tend to be higher than in A: U = 24.5, p = 0.0160 (asymptotic). Effect size r = 0.76, large.
U statistic for B
24.5
for A: 0.5
p-value
0.0160
asymptotic, with corrections
Effect size r
0.76
large
Median of A
13
n = 5
Median of B
17
n = 5
Normal approximation, z
2.410
with continuity correction
03
Ranking table
Both samples together in ascending order. Equal values share the mean rank
ValueGroupRank
11A1
12A2
13A3
14A4
15A5.5
15B5.5
16B7
17B8
18B9
24B10
Ties (highlighted): 15 ×2 → rank 5.5.
04
Step by step
1
Ranking
Rank 10 values in ascending order; ties get the mean rank.
2
Rank sums
RA = 15.5RB = 39.5(check: they add up to 15.5 + 39.5 = 10·11/2 = 55)
3
The U statistic
UA = RA − nA(nA + 1)2 = 15.5 − 5 · 62 = 0.5UB = nAnB − UA = 5 · 5 − 0.5 = 24.5
4
Normal approximation and p-value
With ties or large samples — the normal approximation with a tie correction in σ and a continuity correction in z.μ = nAnB2 = 12.5σ = 4.773z = |UB − μ| − 0,5σ = 2.410p = 2 · (1 − Φ(|z|)) = 0.0160
5
Conclusion
p = 0.0160 < 0.05 — reject H₀: the distributions differ, values in B are higher. Effect size r = 0.76, large.
When the data are skewed, have outliers or sit on an ordinal scale: time on site, order value, ratings from 1 to 5. The test works on ranks, so one huge value does not outweigh the rest. In the time-on-site problem Mann–Whitney finds a difference, p = 0.0499, while Welch's t-test on the same numbers does not, p = 0.151: the outliers of 120 and 300 seconds break it.
Pool both samples, sort the values in ascending order and number them from one. Equal values get the mean of their ranks: in the example 15 appears in A and in B at places five and six, so both get 5.5. Then add up the ranks by group. Check: the sum of all ranks equals N(N + 1)/2, which is 55 for ten values.
Tied values get the mean rank, and the variance of U shrinks by a tie correction: from N + 1 subtract the sum of t³ − t over tie groups divided by N(N − 1). The exact distribution of U no longer applies with ties, so p comes from the normal approximation. For 12, 15, 11, 14, 13 against 16, 18, 15, 17, 24 a single tie of 15 and 15 gives an asymptotic p = 0.016.
The number of pairs “a value from A, a value from B” in which B is larger, plus half the equal pairs. There are n_A · n_B pairs in total, and U_A + U_B equals that number. For 12, 15, 11, 14, 13 against 16, 18, 15, 17, 24, B is higher in 24 of 25 pairs and one pair is equal, so U = 24.5. The further U is from n_A · n_B / 2, the stronger the difference.
Exact when there are no ties and at least one sample has at most eight values: all rank arrangements are enumerated. For 12, 15, 11, 14, 13 against 16, 18, 19, 17, 24 only one of 252 arrangements gives U = 0, so p = 2 · 1 / 252 = 0.0079. With ties or large samples the normal approximation with tie and continuity corrections is used.
Only if the two distributions have the same shape and differ by a shift. In general the test checks whether the values of one group tend to be higher: whether a random value from B is more often larger than a random value from A. Two groups with equal medians but different spread can give a significant result. The calculator shows the medians alongside, for description.