Statistics & probability

Mann–Whitney U test calculator with ties

Compare two independent samples using pooled midranks and an exact conditional permutation p-value that retains tied observations.

Your numbers

Enter comma- or space-separated finite numbers. Values are limited to ±10¹²; missing observations are not silently removed.
Enter comma- or space-separated finite numbers. Values are limited to ±10¹²; missing observations are not silently removed.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

The Mann–Whitney statistic counts pairwise orderings between two independent samples, giving half credit to ties. This calculator pools the observations, assigns average ranks to equal values and calculates U for each group. Its two-sided p-value counts all assignments of the observed pooled values to groups of the original sizes, using distance from the null rank-sum center. Wilcoxon rank-sum refers to the same two-sample procedure here, so it is kept on this page.

THE FORMULAU_X = R_X − n_X(n_X+1)/2; U_Y = n_X n_Y − U_X.

A worked example

For X = 1,2,2 and Y = 3,4,5, the pooled X ranks are 1,2.5,2.5. Their sum is six and U_X = 6−3×4/2 = 0. There are twenty assignments of three observations to X. Only the lowest-rank and highest-rank assignments are this far from the null center, giving the two-sided conditional p-value 2/20 = 0.1.

Good to know

The combined sample size is at most 24. Observations must be independent and labels exchangeable under the distributional null. The exact calculation conditions on the pooled observed values; ties remain distinct observations with identical ranks. This is not a paired test and is not generally a test of medians alone. No normal approximation, continuity correction or automatic one-sided selection is used.

Tied values still represent separate observations

The two observations equal to two receive the same rank, but they are not collapsed into one record. Either individual can be assigned to a group during the conditional permutation calculation. Counting only distinct numerical arrangements would change their multiplicities and produce a different probability distribution. The rank table preserves the original group membership so that this distinction can be checked against the entered samples.

The smaller of U_X and U_Y is sometimes displayed as a summary statistic in other software. This page labels the U belonging to X and also returns its complement. Swapping the sample labels exchanges the two U values while leaving this two-sided p-value unchanged. A large or small U therefore needs its group label; reporting a bare number without its convention can make two correct implementations appear inconsistent.

Pooled ranks put all three X observations below the Y observationsPooled ranks, with tied midranksX1X2.5XY4Y5Y6R_X = 6; U_X = 6 − 6 = 0
X = (1,2,2) receives ranks 1,2.5,2.5; Y = (3,4,5) receives 4,5,6. X has rank sum six and U = 0. The tied twos remain separate observations.

The Wilcoxon signed-rank calculator with zero differences handles paired differences. The Mann–Whitney samples here must instead be independent.

Distributional evidence needs a study-design interpretation

Under a location-shift model with comparable distribution shapes, a rank difference can support a location interpretation. With different spreads or shapes, the same statistic can respond to broader distributional differences. Describe what the measurements mean and inspect their distributions before translating the result into a statement about medians. Statistical significance also does not measure the practical size or importance of a difference.

Repeated measurements on the same subjects violate the independent-sample setup. For paired differences, use the signed-rank page and consider its symmetry assumption instead. The Kruskal–Wallis calculator is the related multi-group rank procedure. Choosing among these tools should follow the sampling design and research question, rather than trying several tests and retaining the smallest p-value.

A few questions, answered

Is this the usual no-ties exact U table?

No. It computes a conditional pooled-label permutation distribution for the actual observed ranks, including ties. This avoids treating a no-ties lookup distribution as tie-corrected.

Does p=0.1 prove the samples are equivalent?

No. A non-small p-value supplies limited evidence against the stated null; equivalence requires a separately specified margin and suitable design.

Find your calculator

Start typing to explore the library.