About the Kruskal-Wallis Test Calculator
This Kruskal-Wallis test calculator checks whether three or more independent groups come from the same distribution, using ranks instead of raw values. Paste each group on its own line, optionally labelled like "Method A: 12, 15, 11", and it pools and ranks all observations, then returns the H statistic (corrected for ties), the degrees of freedom, the p-value, each group’s rank sum, mean rank and median, and the epsilon-squared effect size.
Kruskal-Wallis is the nonparametric alternative to one-way ANOVA. Use it when your outcome is ordinal (pain scores, Likert ratings, rankings), when the data are clearly skewed or contain outliers, or when group sizes are small and normality cannot be checked. It is widely used in medical, ecological, psychology and quality-control studies. With exactly two groups it is equivalent to a two-sided Mann-Whitney U test.
The p-value uses the chi-square approximation with k − 1 degrees of freedom, as in SPSS, R’s kruskal.test and SciPy; it is reliable when each group has at least about 5 observations. A significant result says at least one group differs, but not which; follow up with pairwise Dunn or Mann-Whitney tests with a multiple-comparison correction.
With the default inputs, the p-value is 0.0029. Change any value above to recalculate instantly.
How to use the kruskal-wallis test calculator
- 1Type or paste each group on its own line, optionally starting with a label and a colon.
- 2Separate the values within a group by commas or spaces.
- 3Set the significance level (0.05 is standard).
- 4Read the H statistic, degrees of freedom and p-value, and the conclusion.
- 5Compare mean ranks and medians in the table to see which groups sit higher or lower.
Formula and method
All observations from every group are pooled and ranked from 1 (smallest) to N (largest), with tied values sharing the average of their ranks. If the groups come from the same distribution, each group’s mean rank should be close to the overall mean rank (N + 1) ÷ 2. H measures how far the group rank sums Rᵢ stray from that expectation, weighted by group size.
When there are ties, H is divided by the correction factor C = 1 − Σ(t³ − t) ÷ (N³ − N), where t is the size of each tie group. Under the null hypothesis the corrected H approximately follows a chi-square distribution with k − 1 degrees of freedom, which gives the p-value. Epsilon-squared, H ÷ (N − 1), expresses the effect size on a 0–1 scale.
- N
- Total number of observations across all groups
- nᵢ
- Number of observations in group i
- Rᵢ
- Sum of the ranks in group i
- k
- Number of groups
- t
- Number of observations in a set of tied values
Worked examples
Weight loss (kg) on three diets, 6 people each
Ranking all 18 results, diet B collects the high ranks (rank sum 90) and diet C the low ones (rank sum 27), while diet A sits in between (54). H = 12 ÷ (18 × 19) × (54²/6 + 90²/6 + 27²/6) − 57 = 11.68 on 2 degrees of freedom, so p ≈ 0.003 and the diets differ significantly.
Customer ratings (1–5) for four store branches, with ties
Ratings contain many ties, so each tied group gets an average rank and the tie correction (C ≈ 0.941) raises H from about 12.41 to 13.19. With 3 degrees of freedom the p-value is about 0.004: at least one branch is rated differently, with East and North well above West.
No real difference between three machines
The machines’ outputs interleave closely, so mean ranks are all close to the overall 8 (7.3, 9.0 and 7.7) and H is only about 0.40. The p-value of about 0.82 gives no evidence that any machine differs.
Frequently asked questions
When should I use the Kruskal-Wallis test instead of ANOVA?+
Use Kruskal-Wallis when the outcome is ordinal, when group data are clearly non-normal or have outliers, or when samples are too small to check normality. If ANOVA’s assumptions hold, ANOVA is slightly more powerful.
What does a significant Kruskal-Wallis result mean?+
It means at least one group tends to have larger or smaller values than the others — strictly, that not all groups come from the same distribution. If the groups have similarly shaped distributions, it can be read as a difference in medians.
What post hoc test follows Kruskal-Wallis?+
Dunn’s test is the standard follow-up, comparing mean ranks of each pair of groups. Pairwise Mann-Whitney U tests are another option. Either way, adjust the p-values for multiple comparisons with Bonferroni, Holm or a similar method.
How are ties handled?+
Tied values receive the average of the ranks they occupy, and H is divided by a correction factor based on the number and size of the tie groups. The calculator shows both the uncorrected and corrected H; the corrected value is used for the p-value.
What sample size does the test need?+
The chi-square approximation is generally reliable when every group has at least 5 observations. For smaller groups, exact critical values from published tables or a permutation test are more accurate, especially with three groups.
How do I report a Kruskal-Wallis test?+
Report the H statistic with its degrees of freedom, the sample size and the p-value, plus an effect size and group medians or mean ranks — for example, H(2) = 11.68, p = .003, ε² = 0.69.