Wilcoxon rank-sum (Mann–Whitney U)
2 independent groups, any continuous or ordinal data.
Wilcoxon rank-sum / Mann–Whitney U test with ties, z-score and exact or normal p-values.
Enter your values below to get started.
Samples can have different sizes (n₁ ≠ n₂).
Tied values get the average of the ranks they occupy.
With 20 or fewer values per sample and no ties, the headline p-value is exact.
W reported by R's wilcox.test equals U₁ here; SPSS reports the smaller U.
A rank sum calculator runs the Wilcoxon rank-sum test, known as the Mann–Whitney U test, which compares 2 independent samples by ranking all values together and adding the ranks of each sample. Paste 2 samples to get the rank sums, U, the z-score with tie and continuity corrections, the two-sided or one-sided p-value, an exact p-value for small samples without ties, and the effect size.
A rank sum test is a nonparametric test that compares 2 independent samples by ranking all observations together and checking whether 1 sample's ranks are systematically higher. Frank Wilcoxon introduced the test in 1945, and Henry Mann and Donald Ransom Whitney published the equivalent U statistic in 1947.
The test uses ranks instead of raw values, so the test works for skewed data, outliers and ordinal scales such as 1-to-5 ratings, where a t-test needs approximately normal data.
The rank sum calculator pools both samples, ranks the values from smallest to largest, adds the ranks of each sample and converts the rank sum into U, z and a p-value. Tied values share the average of their ranks, and the variance of U is reduced for ties.
All n₁ + n₂ values are sorted together, keeping track of the sample each value came from.
Ranks run 1 to N. Three values tied at positions 3, 4 and 5 all get rank 4.
R₁ = sum of sample 1's ranks; U₁ = R₁ − n₁(n₁ + 1)/2 and U₂ = n₁n₂ − U₁.
z compares U₁ with its mean n₁n₂/2; the exact distribution of U is used for small samples without ties.
The rank sum test formula converts the rank sum R₁ into U₁ = R₁ − n₁(n₁ + 1)/2, then standardizes U₁ with its mean and standard deviation. U₁ equals the number of pairs (x, y) in which the sample 1 value is larger, counting ties as ½.
t is the size of each tie group; without ties, σU = √(n₁n₂(N + 1)/12).
The rank sum test is the choice for 2 independent groups; 3 related tests cover paired data, 3 or more groups and normal data. Picking the wrong test is the most common error with rank-based statistics.
2 independent groups, any continuous or ordinal data.
2 paired measurements on the same subjects, such as before and after.
3 or more independent groups; reduces to the rank-sum test for 2 groups.
Compares means of normal data. The rank-sum test keeps about 95.5% (3/π) of the t-test's efficiency on normal data.
To do a rank sum test by hand, rank all values together, add the ranks of 1 sample, convert the sum to U and compare U with a critical value or the normal distribution. Here are sample 1 = 68, 72, 75, 80, 85, 90 and sample 2 = 60, 62, 65, 70, 74.
Small samples without ties use the exact distribution of U, while larger samples or tied data use the normal approximation with a tie and continuity correction. The exact distribution counts how many of the C(N, n₁) ways to split the ranks give each value of U.
For 1–5 against 6–10, U = 0 happens in 1 of 252 equally likely splits, so the exact two-sided p is 2/252 = 0.007937, while the normal approximation gives 0.01219. R's wilcox.test uses the exact p for fewer than 50 values per sample without ties.
Paste sample 1 and sample 2, choose the alternative hypothesis and α, and press Calculate. The result shows U, z and p, both rank sums, the exact p-value when available, an effect size, every rank and a rank plot.
1 sample per box, values separated by spaces, commas or new lines.
Two-sided for any difference; one-sided when the direction was fixed in advance.
0.05 is standard; use 0.01 for stricter evidence.
p < α rejects H₀; the steps tab shows ranks, U, σ and z.
The rank sum test compares 2 groups whenever the data are skewed, ordinal or contain outliers. There are 5 common applications:
7 two-sample comparisons with their rank sums, U and p-values (continuity correction on).
| Samples | R₁, R₂ | U₁, U₂ | z | p (normal / exact) | Calculator |
|---|---|---|---|---|---|
| 12 15 17 20 24 26 30 vs. 9 11 13 14 16 18 | 63, 28 | 35, 7 | 1.9286 | 0.0538 / 0.0513 | |
| 68 72 75 80 85 90 vs. 60 62 65 70 74 | 48, 18 | 27, 3 | 2.0996 | 0.0358 / 0.0303 | |
| 1–5 vs. 6–10 | 15, 40 | 0, 25 | −2.5067 | 0.0122 / 0.0079 | |
| 2 4 6 8 vs. 1 3 5 7 9 | 20, 25 | 10, 10 | 0 | 1 / 1 | |
| 3 5 5 8 vs. 5 7 8 9 (ties) | 13.5, 22.5 | 3.5, 12.5 | −1.1907 | 0.2338 / – | |
| Pain scores, 10 vs. 10 (ties) | 140, 70 | 85, 15 | 2.6481 | 0.0081 / – | |
| Response times, 8 vs. 8 | 90, 46 | 54, 10 | 2.2580 | 0.0240 / 0.0207 |
Try each one, then reveal the answer or solve it in the calculator.
Sample 1: 68, 72, 75, 80, 85, 90. Sample 2: 60, 62, 65, 70, 74. Find R₁, U and the exact two-sided p-value.
Sample 1: 1, 2, 3, 4, 5. Sample 2: 6, 7, 8, 9, 10. Find U and the exact two-sided p-value.
Sample 1: 3, 5, 5, 8. Sample 2: 5, 7, 8, 9. Rank with ties and find R₁ and U₁.
Test whether sample 1 (23, 27, 31, 35, 38, 41, 45) tends to be larger than sample 2 (19, 22, 24, 26, 29, 33, 36) at α = 0.05.
Pain scores: placebo 6 7 5 8 6 7 9 5 6 8, drug 4 5 3 6 4 5 7 3 4 6. Find z and the two-sided p-value.
Response times (ms): 120 135 98 160 142 155 130 148 vs. 110 95 125 102 118 99 131 105. Find U and the exact p-value.
Discover 67 free sum calculators across different categories. Find the right calculator for your needs.
Try a different name or choose another category.
A rank sum calculator is an online tool that runs the Wilcoxon rank-sum (Mann–Whitney U) test on 2 independent samples. It ranks all values together, adds the ranks of each sample, and returns U, z and the p-value.
Yes, the Wilcoxon rank-sum test and the Mann–Whitney U test are the same test written with different statistics. U₁ = R₁ − n₁(n₁ + 1)/2, so both give the same p-value.
Give tied values the average of the ranks they occupy, then reduce the variance of U by Σ(t³ − t)/(N(N − 1)), where t is the size of each tie group. Three values tied at positions 2, 3 and 4 all get rank 3.
Use the rank sum test for 2 independent groups when the data are skewed, ordinal or contain outliers, or when the samples are small and normality is doubtful. Use the t-test for approximately normal data.
U₁ is the number of pairs in which a sample 1 value beats a sample 2 value, counting ties as ½. U₁ ÷ (n₁n₂) estimates the probability that a random value from sample 1 is larger than one from sample 2.
Yes, the samples can have different sizes. The formulas use n₁ and n₂ separately, for example 6 values against 5 values.
No, the rank sum test compares whole distributions, not medians alone. The test becomes a test of medians only when both groups have the same shape and spread.
The continuity correction moves U₁ 0.5 toward its mean before computing z, since U takes whole or half values while the normal curve is continuous. The correction makes the normal p-value closer to the exact p-value.
The normal approximation works well once each sample has about 10 or more values. For smaller samples without ties, use the exact p-value, which this calculator reports.
The rank sum test compares 2 independent samples through the ranks of their pooled values, and the rank sum calculator returns the rank sums, U, z, the exact or normal p-value and an effect size in 1 step. Use average ranks for ties, the exact p for small samples and the signed-rank test for paired data.
Not sure the rank sum test fits your data? Answer the questions below.