Mann-Whitney U Test Calculator

Non-parametric alternative to the independent samples t-test - no normality assumption required.

U Mann-Whitney U Test Calculator

Rank Sums

n₁ (Group 1)
-
n₂ (Group 2)
-
R₁ (Rank Sum 1)
-
R₂ (Rank Sum 2)
-

U Statistics & Test

U₁
-
U₂
-
Z-statistic
-
p-value (two-tailed)
-
Rank-biserial r
-

📖 What is the Mann-Whitney U Test?

The Mann-Whitney U test (also called the Wilcoxon rank-sum test) is a non-parametric statistical test that compares two independent groups to determine whether one group tends to have higher values than the other. Unlike the independent samples t-test, which compares means and requires normally distributed data, the Mann-Whitney test operates on ranks - making it valid for ordinal data, non-normal distributions, and small samples where the central limit theorem cannot be relied upon.

The test was developed by Henry Mann and Donald Whitney in 1947 as an extension of Frank Wilcoxon's 1945 rank-sum test. It addresses the question: given two groups, is one group stochastically larger than the other? More precisely, it tests whether P(X₁ > X₂) = 0.5 - whether a randomly chosen value from group 1 is equally likely to exceed a randomly chosen value from group 2. Under the null hypothesis, both groups come from the same distribution and U₁ ≈ n₁n₂/2.

The U statistic is computed by ranking all observations across both groups combined, computing the rank sum for each group, and deriving U from the formula U₁ = n₁n₂ + n₁(n₁+1)/2 − R₁. For large samples, the test uses a normal approximation: Z = (U − μ_U) / σ_U, with a tie correction to the variance. The rank-biserial correlation r = 1 − 2U_min/(n₁n₂) provides an interpretable effect size analogous to Cohen's d.

Common applications include comparing pain scores, quality of life ratings, satisfaction surveys, reaction times, income distributions, test scores, and any outcome measured on an ordinal or non-normal continuous scale. The test is standard in clinical trials for patient-reported outcomes, in psychology for Likert-scale data, and in ecology for comparing species counts across habitats.

📐 Formulas

U₁ = n₁n₂ + n₁(n₁+1)/2 − R₁

U₂: U₂ = n₁n₂ − U₁ (note: U₁ + U₂ = n₁n₂)

Rank assignment: Combine both groups, sort ascending. Assign rank 1 to the smallest. Ties get the average rank.

Z-statistic (normal approximation with tie correction):

μ_U = n₁n₂/2

σ²_U = n₁n₂/12 × [(n+1) − ΣT/(n(n−1))] where T = Σtᵢ(tᵢ² − 1) for each tie group of size tᵢ

Z = (U_min − μ_U) / σ_U

p-value (two-tailed): p = 2 × Φ(Z), where Φ is the standard normal CDF.

Rank-biserial correlation (effect size): r = 1 − 2U_min / (n₁n₂)

Variables: R₁ = sum of ranks assigned to group 1 observations; n = n₁ + n₂ total observations.

📖 How to Use This Calculator

1
Type your Group 1 values (treatment or condition A) as comma-separated numbers. These should be independent observations - not paired data (use Wilcoxon signed-rank for paired data).
2
Type your Group 2 values (control or condition B). Groups can have different sizes (unequal n is fine).
3
Click Calculate. Compare the rank sums R₁ and R₂: the group with the higher rank sum tends to have larger values. Check the p-value for significance and r for effect size.
4
If p < 0.05, there is a statistically significant difference between groups. The rank-biserial r tells you how large the effect is: |r| > 0.5 is a large effect.

💡 Example Calculations

Example 1 - Pain scores: treatment vs control (significant difference)

1
Group 1 (treatment): 2, 3, 4, 4, 5, 6, 6, 7. Group 2 (control): 5, 6, 7, 7, 8, 8, 9, 10. Pain measured on 1-10 scale (lower = better). Normal distribution unlikely for pain scores.
2
Combined ranks (1=lowest pain): All 16 values ranked. R₁ = 47 (treatment), R₂ = 89 (control). U₁ = 8×8 + 8×9/2 − 47 = 64 + 36 − 47 = 53. U₂ = 64 − 53 = 11. U_min = 11.
3
Z = (11 − 32) / 9.52 ≈ −2.21. p = 0.027 - significant at 5%. Treatment group has significantly lower pain scores.
4
Rank-biserial r = 1 − 2×11/64 = 0.66 - a large effect. In 66% of all treatment-control pairs, the treatment patient had lower pain than the control patient.
U₁ = 53, U₂ = 11, Z = −2.21, p = 0.027, r = 0.66 (large effect)
Try this example →

Example 2 - Customer satisfaction ratings (not significant)

1
Group 1 (new website): 4, 4, 5, 3, 5, 4, 5, 4, 3, 5. Group 2 (old website): 3, 4, 4, 5, 4, 3, 4, 5, 4, 3. Likert 1–5 satisfaction ratings - ordinal data, Mann-Whitney is appropriate.
2
Many ties - tie correction applied to variance. Rank sums are similar; U statistics are close to n₁n₂/2 = 50. Z ≈ 0.8, p ≈ 0.42.
3
Conclusion: No significant difference in satisfaction between old and new website. The small sample size and heavy ties reduce power. Collect more data to detect a real difference if one exists.
Z ≈ 0.80, p ≈ 0.42 (not significant) - no meaningful difference detected
Try this example →

❓ Frequently Asked Questions

When should I use the Mann-Whitney U test instead of the t-test?+
Use Mann-Whitney U test when: (1) your data is not normally distributed and your sample is too small for the Central Limit Theorem to rescue the t-test (typically n < 30 per group); (2) you have ordinal data (rankings, Likert scales) where the difference between values is not meaningful; (3) your data has outliers that would heavily distort the mean-based t-test; (4) you are measuring something like pain scores, satisfaction ratings, or reaction times that are inherently non-normal. The t-test is generally preferred when normality holds because it is more powerful. Mann-Whitney is about 95% as efficient as the t-test even for normal data, so the power cost of using it unnecessarily is small.
What does the U statistic measure?+
The U statistic counts the number of times a value from group 1 exceeds a value from group 2, across all possible pairs. U₁ = number of pairs (x₁₍, x₂ₒ) where x₁₍ > x₂ₒ. The minimum possible U is 0 (all group 2 values exceed all group 1 values) and the maximum is n₁×n₂ (all group 1 values exceed all group 2 values). The expected value under the null is n₁n₂/2. A U near 0 or near n₁n₂ indicates a strong separation between groups. The test uses the minimum of U₁ and U₂ for the normal approximation.
What is the difference between Mann-Whitney U and Wilcoxon Rank-Sum test?+
They are mathematically equivalent tests for independent samples and always give the same p-value. The Wilcoxon rank-sum test uses W = R₁ − n₁(n₁+1)/2 (the rank sum of the smaller group, minus its expected value). The Mann-Whitney test uses U₁ = n₁n₂ + n₁(n₁+1)/2 − R₁. The relationship is W = n₁n₂ + n₁(n₁+1)/2 − U₁. Different software (R, SAS, SPSS) and textbooks use different parameterisations but the p-value is identical. Do not confuse Mann-Whitney/Wilcoxon rank-sum (for two independent groups) with the Wilcoxon signed-rank test (for one group or paired data).
How does tie handling work in the Mann-Whitney test?+
When multiple observations share the same value, they receive the average of the ranks they would have occupied. For example, if three observations are tied for ranks 4, 5, and 6, each gets rank 5.0. This average rank assignment ensures the total sum of ranks is correct. Ties also require a correction to the variance formula: Var(U) = n₁n₂/12 × [(n+1) − ΣT/(n(n−1))] where T = Σtᵢ(tᵢ² − 1) for each tie group of size tᵢ. Without the tie correction, the variance is slightly overestimated, making the Z-test slightly conservative.
Is the Mann-Whitney test a test of medians?+
Not exactly - it is often described as a test of medians but that is a simplification. The Mann-Whitney test formally tests whether P(X₁ > X₂) = 0.5, i.e. whether a randomly selected value from group 1 is equally likely to exceed a randomly selected value from group 2 (stochastic equality). The test is a test of medians only if you additionally assume that the two distributions have the same shape and spread. If the distributions have different shapes (one more spread than the other), you can have equal medians but P(X₁ > X₂) ≠ 0.5.
What is rank-biserial correlation as an effect size?+
Rank-biserial correlation (r = 1 − 2U_min/(n₁n₂)) is the recommended effect size for the Mann-Whitney test. It ranges from −1 to +1 and represents the difference between the probability that a random group 1 value exceeds a random group 2 value and vice versa. Interpretation: |r| < 0.1 negligible; 0.1–0.3 small; 0.3–0.5 medium; > 0.5 large. It is analogous to Cohen's d for the t-test but does not require normality.
What sample size do I need for the Mann-Whitney test?+
With n₁ = n₂ = 5 (10 total observations), the minimum achievable p-value is 0.008 - you cannot get p < 0.05 with fewer than 5 per group regardless of how extreme the data is. Practical minimum is n ≥ 5 per group for the test to be useful. For 80% power to detect a medium effect (r = 0.3) at α = 0.05, you need approximately 55 per group (110 total). The Mann-Whitney test is about 95.5% as efficient as the t-test for normal data (ARE = 3/π ≈ 0.955), so for the same power you need about 5% more observations than a t-test.
Can the Mann-Whitney test be used for more than two groups?+
No - Mann-Whitney is a two-group test. For three or more independent groups, use the Kruskal-Wallis H test, which is the non-parametric equivalent of one-way ANOVA. Kruskal-Wallis tests whether at least one group's distribution differs from the others. If the omnibus Kruskal-Wallis test is significant, you can follow up with pairwise Mann-Whitney tests, applying a multiple comparison correction (Bonferroni or Dunn's test) to control the family-wise error rate.