Mann-Whitney U Test Calculator - Non-Parametric Test

Calculate Mann-Whitney U test for comparing two independent samples without assuming normal distribution.

Results

Calculated
Result
—

What the Mann-Whitney U test does and when to use it

The Mann-Whitney U test, also called the Wilcoxon rank-sum test, checks whether two independent groups tend to have different values without assuming the data follow a normal distribution. Instead of comparing means, it pools every observation, ranks them from smallest to largest, and asks whether the ranks in one group are systematically higher than in the other. This makes it a good choice for skewed measurements, ordinal ratings, small samples and data with outliers.

Use this calculator to compare, for example, recovery times under two treatments, test scores from two classes or satisfaction ratings from two products. Paste each sample into its box separated by commas, spaces or semicolons. The calculator ranks the combined data with average ranks for ties, and returns U1, U2, the smaller U, the z-score with a continuity correction, and a two-tailed p-value from the normal approximation, with a tie-corrected standard deviation.

The formulas and variables

  • n1, n2 are the sample sizes and N = n1 + n2. R1 is the sum of the ranks in sample A.
  • U1 = R1 − n1(n1 + 1)/2 and U2 = n1n2 − U1. The test statistic U is the smaller of the two.
  • Mean of U: μU = n1n2/2.
  • Standard deviation: σU = √[ (n1n2/12) × ( (N + 1) − Σ(t3 − t) / (N(N − 1)) ) ], where t is the size of each group of tied values.
  • z = (U − μU + 0.5) / σU when U is below the mean, and the two-tailed p-value comes from the standard normal distribution.

Worked example with the default data

Sample A: 12, 15, 18, 14, 20, 16. Sample B: 22, 19, 25, 21, 24, 23.

  • Sorted, the combined values are 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 24, 25. Sample A holds ranks 1, 2, 3, 4, 5 and 7, so R1 = 22.
  • U1 = 22 − 6 × 7 / 2 = 1, and U2 = 36 − 1 = 35, so U = 1.
  • μU = 18, σU = √(36/12 × 13) = √39 = 6.245 (no ties).
  • z = (1 − 18 + 0.5) / 6.245 = −2.642, giving a two-tailed p of about 0.0082.

The calculator reports the same values and states that the difference is significant at α = 0.05. With only 6 observations per group, an exact test would give p = 4/924, about 0.0043, so the normal approximation is a little conservative here.

Common mistakes and how to interpret the result

  • Saying it compares medians. It compares whole distributions; it tests medians only when the two groups have the same shape and spread.
  • Using it on paired data. Before-and-after measurements on the same subjects need the Wilcoxon signed-rank test.
  • Trusting the normal approximation with tiny samples. With fewer than about 10 observations per group, exact tables or software give more reliable p-values.
  • Equating significance with importance. A small p-value says the groups differ; the rank-biserial correlation or the common-language effect size tells you by how much.

Frequently Asked Questions

When should I use Mann-Whitney instead of a t-test?
Use it when the data are ordinal, strongly skewed, contain outliers, or the samples are too small to check normality. If the data are roughly normal, the t-test is slightly more powerful.
How are ties handled?
Tied values receive the average of the ranks they would have occupied, and the standard deviation is adjusted with the tie-correction term shown above.
What does U mean?
U counts how many times a value from one group beats a value from the other across all pairings. U1 + U2 always equals n1 times n2, and a very small U means one group is consistently lower.
Is the p-value one-tailed or two-tailed?
It is two-tailed. It tests whether the groups differ in either direction.

Related calculators