Home › Statistics & Probability Calculators › Kruskal-Wallis Test Calculator (H Test)
Kruskal-Wallis Test Calculator
The Kruskal-Wallis test compares three or more independent groups without assuming the data are normally distributed. It ranks all observations together and checks whether the average rank differs between groups, making it the non-parametric counterpart of one-way ANOVA.
Enter each group on its own line, optionally starting with a label and a colon. The calculator ranks every value (ties get the average rank), sums the ranks by group and computes H = 12 ÷ [N(N + 1)] × Σ(R² ÷ n) − 3(N + 1). When there are ties, H is divided by the correction factor 1 − Σ(t³ − t) ÷ (N³ − N). The p-value comes from a chi-square distribution with k − 1 degrees of freedom, matching SciPy and R’s kruskal.test.
Use it for ordinal data such as ratings, for small samples, or when outliers make ANOVA unreliable. A significant result says at least one group tends to have larger values; pairwise follow-up with the Mann-Whitney U test (with a Bonferroni-adjusted α) shows which. The ε² effect size is reported beneath the result.
At least 2 groups. Example line: "Group 1: 3, 5, 8, 12".
Result and step-by-step solution
df = 2, N = 18.
- Rank all 18 values togetherSmallest = rank 1; tied values share the average rank.
- Rank sums by group
Group n Median Rank sum R Mean rank Method A 6 8 39 6.5 Method B 6 20.5 65 10.833 Method C 6 26.5 67 11.167 - H statisticH = [12 ÷ (N(N + 1))] × Σ(Ri² ÷ ni) − 3(N + 1) = 2.8538
- Tie correctionNo ties, so no correction is needed.
- p-valueP(χ²2 ≥ 2.8538) = 0.2401; critical χ² at α = 0.05 is 5.9915
- Decisionp = 0.2401 ≥ α = 0.05.
| Effect size ε² = H ÷ (N − 1) | 0.1679 |
|---|
Frequently asked questions
- When should I use Kruskal-Wallis instead of ANOVA?
- When the data are ordinal, clearly non-normal with small groups, or have outliers. With normal data ANOVA has more power.
- What are the degrees of freedom?
- k − 1, where k is the number of groups.
- Does Kruskal-Wallis compare medians?
- Only if the groups have the same shape of distribution. In general it tests whether one group tends to produce larger values than another.
- What post-hoc test follows Kruskal-Wallis?
- Dunn’s test, or pairwise Mann-Whitney U tests with a Bonferroni correction.
Last reviewed: October 7, 2026. Calculations run in your browser and were validated against SciPy.
