ForHosting KIT · Math

Wilcoxon rank-sum test calculator

Compare two independent groups without assuming a normal distribution: for samples of 5 and 6 values that do not overlap, the rank sum of the first is 45, the equivalent U is 30 and the two-sided p-value falls below 0.05. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Sample1
12, 15, 18, 20, 22
Sample2
5, 7, 8, 10, 11, 9
You get
N1
5
N2
6
N
11
Rank sum
45

The Wilcoxon rank-sum test, also known as the Mann–Whitney U test, compares two independent numeric samples without assuming normality. This calculator ranks every observation in the pooled list, sums the ranks that belong to the first sample, and reports that rank-sum statistic together with a two-sided p-value from the usual normal approximation, including the standard tie correction and a continuity correction.

How the Wilcoxon rank-sum statistic is defined

Start with two independent samples of sizes n1 and n2. Pool all N equals n1 plus n2 observations and assign ranks from one through N, using average ranks when several values are tied so that the ranking does not depend on input order. The Wilcoxon rank-sum statistic W is the sum of the ranks that fall in the first sample.

Under the null that both samples come from the same continuous distribution, the expected value of W is n1 times (N plus one) divided by two, and the variance is n1 times n2 times (N plus one) divided by twelve, reduced by the usual correction that subtracts a function of the tie-group sizes. The Mann–Whitney U statistic is the same information rewritten as W minus n1 times (n1 plus one) divided by two, so textbooks that print U and those that print W are not running different tests.

The approximate two-sided p-value uses a normal z score with a half-unit continuity correction, then twice the standard-normal tail. When every observation is identical the variance collapses to zero and the p-value is one, because no location shift can be seen in a completely tied pool.

Where two-sample rank tests show up in real work

Clinical and A-B product teams compare an independent treatment arm with a control arm on a skewed outcome, reporting the rank-sum, the equivalent U, and an approximate two-sided p-value beside the sample sizes. Laboratory and process engineers compare two independent batches, machines, or suppliers when a paired design is impossible because the units are not the same objects measured twice. Survey and education researchers test whether two independent cohorts differ in location on an ordinal or heavily skewed score without assuming a Gaussian residual.

Data-science notebooks often need a dependency-free Wilcoxon rank-sum when validating a simulation or checking that a reported p-value matches the intended normal approximation, including ties. If you later need a paired t-test on before-and-after scores, a two-sample effect size, or a contingency-table exact test, treat those as separate search intents and landings rather than overloading this Wilcoxon rank-sum page.

Two-group classroom and homework checks

Students and graders verify the Wilcoxon rank-sum W, the equivalent Mann–Whitney U, and an approximate two-sided p-value from two independent lists without scanning printed rank tables.

Two independent batches or machines

Engineers compare two suppliers, lines, or lots that are not matched pairs and report whether the rank-sum shift is distinguishable from noise.

What happens if either sample is empty?

A Wilcoxon rank-sum is undefined for an empty group; the engine does not pad zeros or drop the missing sample.

How is the p-value approximated?

A two-sided normal tail on a continuity-corrected z score. The null mean is n1(N+1)/2 and the variance uses the standard tie correction Σ(t³−t). Small-sample exact enumeration is not used.

How is this different from a paired t-test?

This test needs two independent samples, not matched before/after pairs. Pairing, mean differences, and a Student-t tail belong on the paired t-test landing, not here.

What does it cost?

The browser tool is free and runs locally.

Is the Wilcoxon rank-sum test the same as the Mann–Whitney U test?

Yes, it is the same information written another way: U equals the rank sum minus n1 times (n1 plus one) divided by two. With a first sample of 5 values, a rank sum of 45 corresponds to a U of 30.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/stat/wilcoxon-rank-sum-test

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/stat/wilcoxon-rank-sum-test \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sample1":[12,15,18,20,22],"sample2":[5,7,8,10,11,9]}'
{
  "sample1": [
    12,
    15,
    18,
    20,
    22
  ],
  "sample2": [
    5,
    7,
    8,
    10,
    11,
    9
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "stat.wilcoxon_rank_sum_test",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_n10000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Either sample being empty is a hard error: there is no rank sum of an empty group, so the request fails with invalid_input instead of inventing data. The free browser form and the API share one deterministic function, so homework keys and production scripts never disagree. Successful API calls are billed at the published base of $0.002 per item; invalid input is not charged.

How the Wilcoxon rank-sum statistic is defined

This calculator reports W as rank_sum and also returns U so either convention is easy to check against a solution key.

What you send and what you get back

Send two required non-empty arrays of finite numbers: sample1 for the first independent group and sample2 for the second. Classic checks include a five-versus-six list with complete separation, a small series that shares a tied value, and a deliberate empty first sample that must fail. Classroom aliases x and y, a and b, and group1 and group2 are accepted so homework scripts need not rename columns. Missing fields, empty strings, NaN, Infinity, and an empty array in either sample fail with invalid_input and are not charged. That empty-sample rule is the contract: a rank-sum of nothing is undefined, so the engine refuses rather than padding zeros or dropping the group. On success the response includes n1, n2 and the pooled n, the rank_sum W of sample1, the equivalent Mann–Whitney u_statistic, the null mean_rank_sum and sd_rank_sum after the tie correction, the continuity-corrected z_statistic, the two-sided p_value, a boolean significant_at_05 at the conventional alpha of 0.05, the count of tie_groups, and a short formula string restating the identity. Wire the free browser form for homework and demos, then call the identical contract from scripts when you need bulk two-sample rank tests under one JSON shape. API pricing for successful calls is the published base of $0.002 per item; validation failures do not consume balance and never invent observations to force a result.

Where two-sample rank tests show up in real work

Secondary-school and college statistics courses constantly assign nonparametric two-group drills when normality is doubtful or the rubric forbids a t-test; a single trusted oracle that returns cleaned JSON speeds grading without hand-looking rank tables. Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.

Independent treatment versus control

Clinicians and A-B analysts compare two unpaired arms on a skewed or ordinal outcome and publish rank_sum, z, and p under the classical two-sample rank null.

What is the rank-sum statistic this calculator returns?

rank_sum is W, the sum of the midranks assigned to sample1 after the two samples are pooled. u_statistic is the equivalent Mann–Whitney U = W − n1(n1+1)/2. Both describe the same test.

Read the full KIT documentation →