Bell Statistics

Wilcoxon test calculator

Two tests on one page: rank-sum — Mann-Whitney U — for independent samples, and signed-rank for pairs. Size the study, then get U or W with an exact p-value at small n and an effect size that says what the test genuinely estimates, which is not what most calculators claim.

Allon Korem

Written by Allon Korem

Chief Executive Officer

Last updated

Calculator

The shift in SD units. Turned into P(A > B) below.

Required sample size for a rank test
Per group (Noether)130
Per group (efficiency cross-check)The t-test's own sample ÷ 0.955. Plan on the larger.129
Total observations2n either way — two groups, or two per pair.260
Relative effect, P(A > B)The only quantity Noether's formula depends on.0.6005
Noether, before rounding129.60
Equivalent t-test sizeWhat the parametric test would need on normal data.123

Noether's formula asks for 130 per group; dividing the equivalent t-test's own sample by the 0.955 relative efficiency asks for 129. The two routes agree to within a few per cent, which is the reassurance worth having: Noether's formula is derived for small shifts, and agreement means this shift is still in that range. The effect you entered means a randomly chosen value from the first group beats one from the second 60.0% of the time — that probability, not a difference in means, is what this test is powered to find.

  • Noether's formula needs only the probability that one observation exceeds another. Turning your effect size into that probability assumed a normal shift — if that assumption is why you were reaching for a rank test, enter the probability you actually believe instead.
Required per group against effect size (cohen's d)Detecting 0.05 takes 6,579 and 1.20 takes 15. At the 0.36 currently entered it is 130 — the requirement falls roughly as the square of the effect.1001,0000.200.400.600.801.001.20Effect size (Cohen's d)Required per group (log scale)0.36 → 130

Drag the dashed line — or focus it and use the arrow keys — to change effect size (cohen's d).

Show these numbers as a table
Required per group against effect size (cohen's d)
Effect size (Cohen's d)Required per group
0.056,579
0.17586
0.29204
0.40104
0.5264
0.6443
0.7632
0.8825
0.9920
1.1117

When to use it

Reach for a rank test in two situations. The first is an ordinal outcome — a 1-to-5 rating, an NPS bucket, a severity grade — where the numbers label an ordering and their arithmetic mean is not a quantity that exists. The second is a continuous outcome badly enough behaved, at a sample small enough, that the t-test's reliance on the Central Limit Theorem is a hope rather than a fact. Use rank-sum when the samples are independent and signed-rank when they are pairs, as you would choose between the two-sample and the paired t-test.

Be precise about what the rank-sum test tests, because the standard description of it is wrong. Its null is that a randomly chosen observation from one group is equally likely to be larger or smaller than one from the other — P(X > Y) = 0.5, stochastic equality. That becomes a statement about medians only under the extra assumption that the two distributions have the same shape and differ by a shift. Without it the test can return a decisive p-value with the medians identical, because a difference in spread or skew is enough to make one group stochastically larger. Mann and Whitney's 1947 title says "stochastically larger", which is exactly what "compares medians" throws away.

Use something else when the estimand matters more than the robustness. If your decision depends on total revenue, ordering is not enough: a rank test can say treatment users tend to spend more without saying whether the business makes any money. There, a t-test on a winsorised outcome or a bootstrap interval is better — see our note on outliers. Three or more groups want Kruskal–Wallis rather than one-way ANOVA; binary outcomes want a proportions test; paired binary outcomes want McNemar's; Spearman's rho lives on the correlation page.

Assumptions

"Non-parametric" means no assumed distributional family. It does not mean assumption-free, and the assumptions that remain are the ones that bite:

  • Independence — between the two samples for rank-sum, across pairs for signed-rank. Ranking does nothing about clustering, repeated measures from the same user, or a unit that appears in both arms.
  • For the shift interpretation only: the two distributions have the same shape. Report "the treatment group is about 12 seconds slower" and you are assuming it. Report "a treatment user is slower than a control user 62% of the time" and you are not. Say which claim you are making.
  • For signed-rank: the paired differences are symmetric about their centre. Rarely stated and often false, since differences from a skewed outcome tend to be skewed too. Under asymmetry the test is still valid, but as a test of the pseudo-median — the Hodges–Lehmann centre — not the median of the differences.
  • Ties are handled but not free. The exact null distribution assumes none; with ties the calculator switches to the tie-corrected normal approximation. On a five-point scale almost everything is tied, and an ordinal model will tell you more than any p-value.
  • The choice of test was not made by looking at the data. Running a normality test and then picking between the t-test and this one is a two-step procedure with a worse combined error rate than either used unconditionally, because the choice is itself an inference nothing downstream accounts for. Decide from the metric's known shape before collection, like the rest of the analysis plan.

How the calculation works

Both tests replace the observations with their ranks and compare the rank total against what random allocation would produce. Up to n = 50 the calculator enumerates the exact null distribution — which matters precisely at the sample sizes these tests are used for — and beyond that uses the tie-corrected normal approximation, since enumeration grows combinatorially and the approximation is by then very good. Sample size uses Noether's formula, which asks for the effect on the scale the test works on, cross-checked against the [t-test's answer](/calculators/two-sample-t-test) divided by 0.955.

Rank-sum statistic
W = Σ ranks in group 1, U = W − n₁(n₁ + 1)/2

U counts how many of the n₁n₂ cross-group pairs have the group-1 observation larger. U and W are one test seen through a constant shift.

Normal approximation, tie-corrected
z = (U − n₁n₂/2) / √( (n₁n₂/12)·[ (N + 1) − Σ(tⱼ³ − tⱼ)/(N(N − 1)) ] )

The tⱼ are the tied-group sizes. Without the correction the variance is overstated and the test turns conservative — badly so on coarse ordinal scales.

Signed-rank statistic
W⁺ = Σ Rᵢ over pairs with dᵢ > 0, E[W⁺] = n(n+1)/4

Zero differences are dropped and n reduced accordingly — conventional, and one reason the test loses power when many pairs tie exactly.

Effect size
p̂ = U / (n₁n₂) = P(X > Y), r = z/√N

The probability of superiority is directly readable and is the parameter the test is about. The correlation-style r journals ask for is a function of the p-value and n, so it adds less than it appears to.

Sample size (Noether)
N = (z₁₋α/₂ + z₁₋β)² / [ 12·c(1 − c)·(p − 0.5)² ], c = n₁/N

With an even split this is (z₁₋α/₂ + z₁₋β)² / [3(p − 0.5)²]. Cost rises steeply as p approaches 0.5: halving the distance from 0.5 quadruples N.

Asymptotic relative efficiency
ARE = 3/π ≈ 0.955 (normal data)

Under 5% more sample, when the t-test's assumptions hold perfectly. Across continuous distributions the ARE never falls below 0.864, and for heavy-tailed ones it exceeds 1 — about 1.5 for the double exponential.

Worked example

You are comparing time-to-first-action between two onboarding flows. The distribution is heavily right-skewed — most users finish inside a minute, a tail wander off and come back — so you would rather not stake the analysis on means. You state the smallest worthwhile effect on the test's own scale: a new-flow user beats an old-flow user 60% of the time.

Test
Rank-sum (Mann-Whitney)
Significance level (α)
0.05, two-sided
Power (1 − β)
0.80
Effect size (Cohen's d)
0.36
Implied P(X > Y)
0.60, on normal data
Tails
Two

About 131 per arm, 262 in total. The cross-check agrees: on normal data P(X > Y) = 0.60 is Cohen's d ≈ 0.36, which the t-test sizes at 124 per arm, and 124 ÷ 0.955 is about 130.

The two routes landing within a couple of percent of each other is the point of running both: the ARE adjustment is doing its job and you have not specified a much larger effect than you meant to. And 0.60 is smaller than it sounds — complete overlap is 0.50, so this is a fifth of the way from no difference to the new flow always winning. What the test will not give you is a duration. If the roadmap needs "14 seconds faster on average", that has to come from a Hodges–Lehmann shift estimate or a mean with a bootstrap interval.

Interpreting the output

Lead with the effect size, because a rank statistic is unreadable on its own. U = 41,208 means nothing to anybody; "a randomly chosen treatment user scores higher than a control user 61% of the time" is immediately usable and is a direct statement about the quantity the test is built on. Where the equal-shape assumption is defensible, add the Hodges–Lehmann estimate — the median of all cross-group differences — with its interval, which puts the result back in original units.

Then be careful about what significance licenses. A small p-value says the two samples are unlikely to have come from the same distribution. It does not say the medians differ, or by how much: if the treatment group is both slightly better and noticeably more variable, the test can be significant with the medians sitting on top of each other. Plot the two distributions before writing the conclusion — a habit worth keeping whether or not the data is well behaved.

Watch the boundary between the exact test and the approximation. Below 50 per group the p-value is exact and the discreteness is real — at very small samples no arrangement of the ranks may produce a p below 0.05, which is a property of the design rather than a finding. Above it the tie-corrected approximation is accurate, but heavy tying degrades the whole approach.

A non-significant rank test is not evidence the two distributions match, and the remedy is awkward: equivalence testing on ranks is not standard practice. The pragmatic route is to define the margin on a scale you can defend — a difference in means, or a bound on P(X > Y) — and run an equivalence test or a non-inferiority test, stating the change of estimand openly.

Frequently asked questions

What is the difference between Mann-Whitney U and the Wilcoxon test?
Mann-Whitney U and the Wilcoxon rank-sum test are the same test, developed independently and reported through statistics that differ by a constant, so they always give identical p-values. The genuinely different test is the Wilcoxon signed-rank test, which is for paired data. The naming collision causes real confusion: if someone says "the Wilcoxon test" without qualification, ask whether their data is paired.
Does the Wilcoxon rank-sum test compare medians?
Only if you are willing to assume the two distributions have the same shape and differ by a shift. Its actual null hypothesis is that a randomly drawn observation from one group is equally likely to exceed or fall below one from the other. When the shapes differ — different spread, different skew — the test can reject decisively with the two sample medians almost identical, because one distribution is stochastically larger without being centred higher. Describing it as a test of medians is the single most common error made about it, and it appears in most online calculators.
When does the calculator use the exact p-value?
For samples up to 50 with no ties, the null distribution is enumerated exactly. Beyond that, or when ties are present, it uses the normal approximation with a tie correction applied to the variance. The exact version matters most at small n, where the approximation can be noticeably off and where the discreteness of the rank distribution means only certain p-values are attainable at all. With ties, the exact conditional distribution no longer applies, which is why the approximation takes over regardless of sample size.
Should I run a normality test and then decide which test to use?
No. Choosing your test based on a normality test is a two-stage procedure, and its overall error rate is worse than committing to either test in advance. It also does the wrong thing at both ends: normality tests have almost no power at small samples, where non-normality actually matters, and reject trivial departures at large samples, where the Central Limit Theorem has already made them irrelevant. Decide from what you know about the metric's shape and the sample size you expect, before you collect anything.
How much power do I lose by using ranks instead of means?
Less than most people expect. When the t-test's assumptions hold perfectly, the rank-sum test needs about 4.7% more sample for the same power — an asymptotic relative efficiency of 3/pi, roughly 0.955. Across any continuous distribution the efficiency never drops below 0.864, and for heavy-tailed data it goes above 1, meaning the rank test wins. The real cost of ranking is not power, it is that the result is a statement about ordering rather than about magnitude.
Can I use this on a 1-5 satisfaction scale?
Yes, and it is a better fit than a t-test, because the mean of an ordinal scale assumes the gap from 1 to 2 equals the gap from 4 to 5. Two caveats. Heavy tying is unavoidable on a five-point scale, so the analysis will use the tie-corrected normal approximation rather than the exact distribution. And when the categories themselves are informative — a shift from 4s to 5s is a different story from a shift from 1s to 2s — an ordinal regression model tells you considerably more than any single p-value.

Related calculators

  • Two-sample t-test

    Compare the average of two independent groups — plan the sample size, then test the result.

  • Paired t-test

    Before-and-after or matched pairs — size the study on the difference SD, then test it.

  • One-way ANOVA

    Three or more independent groups on one continuous outcome — size it, then run the F test.

  • Correlation test

    Pearson r or Spearman rho, with the Fisher-z interval that says how little a small sample knows.

Terms on this page

  • Normal distribution

    The bell curve — and why your skewed revenue data usually does not break the test anyway.

  • Central limit theorem

    Why averages go bell-shaped even when the data do not — the result that makes ordinary tests work.

  • Outlier

    The extreme value that decides your result — and why the rule for handling it must precede the data.

Talk to the people who build these for a living

Skewed metrics and small samples are where test choice actually changes the decision — we make that call before the data arrives. A/B Testing

References

  • Mann, H. B., & Whitney, D. R. (1947). On a test of whether one of two random variables is stochastically larger than the other. The Annals of Mathematical Statistics, 18(1), 50-60.
  • Noether, G. E. (1987). Sample size determination for some common nonparametric tests. Journal of the American Statistical Association, 82(398), 645-647.
  • Divine, G. W., Norton, H. J., Baron, A. E., & Juarez-Colunga, E. (2018). The Wilcoxon-Mann-Whitney procedure fails as a test of medians. The American Statistician, 72(3), 278-286.