Kruskal Wallis test calculator
Paste three or more independent groups of observations. The script ranks every value across all groups together, computes the Kruskal Wallis H statistic with the standard correction for ties, and reports the upper tail p value of the chi-square distribution with k minus 1 degrees of freedom. Everything runs in your browser, nothing is uploaded.
Calculator
Enter your data and press Calculate. The script computes the ranks, the H statistic, the tie corrected H, the degrees of freedom and the p value from the values you entered.
What the test answers
The Kruskal Wallis test is a rank based method for comparing two or more independent samples of equal or different sizes (Wikipedia, Kruskal Wallis test). This calculator takes three or more groups. SciPy states that it tests the null hypothesis that the population median of all of the groups are equal (SciPy kruskal documentation). The NIST Dataplot reference states the alternative as at least one of the populations tends to yield larger observations than at least one of the other populations (NIST Dataplot reference). NIST describes the procedure as a nonparametric test for comparing population medians that assumes underlying continuous distributions (NIST Engineering Statistics Handbook).
A significant H tells you the groups are not all the same. It does not tell you which pair differs, it does not prove one group causes higher values, and a non significant H does not show the groups are equal. Kruskal and Wallis introduced the rank based statistic in their 1952 paper 'Use of ranks in one-criterion variance analysis', Journal of the American Statistical Association, 47(260), pages 583 to 621 (Kruskal and Wallis, Journal of the American Statistical Association, 1952).
The formula the script uses
Rank all N observations together, averaging ranks for ties. Then
H = 12 / (N(N+1)) * Σ Rᵢ²/nᵢ − 3(N+1)
where Rᵢ is the sum of ranks in group i and nᵢ its sample size. When ties are present the statistic is divided by
C = 1 − Σ(tⱼ³ − tⱼ)/(N³ − N)
where tⱼ is the size of tie group j (Wikipedia, Kruskal Wallis test). H approximately follows a chi-square distribution with k minus 1 degrees of freedom under the null, provided the sample sizes are not too small, say more than 4 in every group (NIST Engineering Statistics Handbook). The p value is the upper tail probability of that chi-square distribution. NIST notes that the rejection region of the test is one sided, because only a large H rejects the null hypothesis (NIST Engineering Statistics Handbook). The SciPy documentation gives a typical rule that each sample must have at least 5 measurements (SciPy kruskal documentation).
Effect size and pairwise tests
The page reports eta2[H] = (H - k + 1)/(N - k) and epsilon2 = H/(N - 1). The rstatix documentation gives both formulas and the bands 0.01 to below 0.06 small, 0.06 to below 0.14 moderate, and 0.14 or more large for eta2[H] (rstatix kruskal_effsize documentation). The page sets a negative eta2[H] to 0, as rstatix does.
The pairwise table uses the Dunn (1964) z test on mean ranks with the tie correction, as scikit-posthocs does (scikit-posthocs posthoc_dunn documentation). The Holm column is the step-down method using Bonferroni adjustments (statsmodels multipletests documentation). The page does not compute an exact p value for small samples.
Assumptions
The NIST handbook states that the test assumes that the variables have underlying continuous distributions (NIST Engineering Statistics Handbook). The SciPy documentation states that the test works on 2 or more independent samples, which may have different sizes (SciPy kruskal documentation). Independence is the one this calculator cannot check for you. Each subject should appear once, in one group only.
Worked example, computed on this page
The defaults in the form above are 15 made-up values in three groups. They only show how the page works. They are not the NIST example and not data of this site. Group A holds 4.2, 4.6, 4.9, 4.4 and 4.8. Group B holds 3.3, 3.7, 4.1, 3.5 and 3.9. Group C holds 5.1, 5.5, 5.3, 5.4 and 5.2. Press Calculate and the script prints the size of each group, H, the tie correction, the degrees of freedom, the p value, two effect sizes and the Dunn pairwise table. For these defaults SciPy 1.13.1 gives H = 12.5 and p = 0.0019304541362277095, and the page gives H = 12.500000 and p = 0.001930. Change any number and the output panel changes, because the script computes each result from the values in the boxes.
How it compares to the alternatives
Wikipedia names the one-way analysis of variance (ANOVA) as the parametric equivalent of the Kruskal Wallis test, and states that the test extends the Mann-Whitney U test, which compares only two groups (Wikipedia, Kruskal Wallis test). For two groups of raw values, use the Mann-Whitney U test calculator. For a one-sample, two-sample or paired t-test, use the t-test calculator. If your outcome is a count per category and not a raw value, use the chi-square test calculator or the Fisher Freeman Halton exact test.
Where these numbers come from
Every result in the output panel is computed by the page script from the values you paste in. The only results typed into this text are the SciPy and page values of the worked example above. The page fetches no dataset and sends no value anywhere. The calculation runs in JavaScript in your browser. The ranking and the H formula follow the NIST Engineering Statistics Handbook (NIST Engineering Statistics Handbook). The tie correction C is the formula in the Wikipedia article on the test (Wikipedia, Kruskal Wallis test). SciPy documents its kruskal statistic as the H statistic, corrected for ties, with a p value from the chi-square distribution, so you can check the page against it (SciPy kruskal documentation). The source code for this site is open and MIT licensed at github.com/theluckystrike/abwex.com, so you can read the routine behind every published number.
Questions
When is the sample too small for the chi-square approximation?
The approximation degrades with small samples. The NIST handbook gives n above 4 per group as the working condition for the chi-square approximation (NIST Engineering Statistics Handbook). As a working rule, treat the asymptotic p value with suspicion below five observations per group, and say so in any writeup.
Why did my H change after I edited one value?
Ranks are computed across all groups jointly. Changing one value can shift many ranks, so H is not a per group quantity. The output panel prints the size, the rank sum and the mean rank of each group, so you can check the ranks.
Does a small p value mean group A beats group B?
No. A p value is the probability of seeing data this extreme if the null hypothesis is true, it is not the probability that any variant is better, and the omnibus test does not identify which pair differs.
Disclaimers
Results are statistical estimates and not business or financial advice.
The Kruskal Wallis test assumes independent samples. Count each visitor once, in one group only.
A p value is the probability of seeing data this extreme if the null hypothesis is true, it is not the probability that the variant is better.
A statistically significant difference is not the same as a lift that is worth shipping.
The worked example uses 15 made-up values that illustrate the calculation, not observed customer data.
By Michael Lip, builder and maintainer of ABWex, open source at github.com/theluckystrike/abwex.com. Profile.
ABWex is a free A/B test statistics calculator from Zovo Tools. The calculation runs in your browser in JavaScript. The page does not send the numbers that you enter to a server. Updated 2026-11-08.