Kruskal-Wallis Test
Compare three or more independent groups without assuming normality. The Kruskal-Wallis test ranks all values together and tests whether at least one group tends to differ, the non-parametric counterpart of one-way ANOVA.
Run Kruskal-Wallis Test →What is the Kruskal-Wallis Test?
The Kruskal-Wallis test is a non-parametric test for comparing three or more independent groups. It is the natural extension of the Mann-Whitney U test to more than two groups, and the non-parametric alternative to one-way ANOVA when the assumption of normality does not hold.
It pools all observations across groups, ranks them from smallest to largest, and compares the average ranks between groups. If the groups came from the same distribution, their average ranks should be similar; a large discrepancy produces a large test statistic, indicating at least one group differs.
Like ANOVA, the Kruskal-Wallis test is an omnibus test: a significant result tells you that at least one group differs from the others but not which ones. To identify the specific differences, follow a significant result with post-hoc pairwise comparisons, such as Dunn's test, with an adjustment for multiple comparisons.
In plain terms: It's one-way ANOVA for data that isn't bell-shaped and three or more groups. It ranks everything together and checks whether some groups sit systematically higher or lower than others. Like ANOVA, it only says 'at least one group differs', so you follow up to find which.
Key Points
Three or More Groups
Extends the Mann-Whitney U test to more than two independent groups, using ranks across all observations.
Non-Parametric ANOVA
The rank-based alternative to one-way ANOVA when normality fails or data is ordinal.
Omnibus, Needs Post-Hoc
A significant result shows some group differs but not which; follow with Dunn's test and a multiple-comparison correction.
Key Formulas
Interpreting the Result
The null hypothesis is that all groups come from the same distribution. A small p-value means at least one group tends to have systematically higher or lower values than the others.
As with ANOVA, this is an omnibus finding. A significant H does not identify which groups differ, so run post-hoc pairwise comparisons (commonly Dunn's test) with a correction such as Bonferroni to control the family-wise error rate across the multiple comparisons.
Assumptions & Validation
Independent Groups
The groups are independent of each other.
If violated: For repeated measures across conditions, use the Friedman test.
At Least Ordinal
The data can be ranked across all groups.
If violated: The test needs a meaningful ordering of values.
Similar Shapes (for medians)
To interpret as a difference in medians, the group distributions have similar shape.
If violated: Otherwise interpret as some group tending higher or lower.
⚠️ Check assumptions first
The Kruskal-Wallis test is an omnibus test, so a significant result must be followed by post-hoc comparisons to locate the differences; stopping at the overall p-value leaves the practical question unanswered. As with Mann-Whitney, the median interpretation is exact only when the groups' distributions have similar shapes. For related (repeated-measures) groups, the Friedman test is the correct choice, not Kruskal-Wallis.
When NOT to Use Kruskal-Wallis Test
Two Groups
For exactly two independent groups, use the Mann-Whitney U test.
Repeated Measures
For related groups or repeated measurements, use the Friedman test.
Normal Data
When groups are approximately normal, one-way ANOVA is slightly more powerful.
Industry Applications
Multi-Group Comparison (Non-normal)
Compare three or more groups on a skewed or ordinal outcome.
Process or Supplier Comparison
Compare a quality metric across several machines, lines, or suppliers robustly.
Ordinal Outcomes
Compare rating-scale outcomes across multiple groups.
Outlier-Resistant Analysis
Compare several groups when outliers would distort ANOVA.
Frequently Asked Questions
When should I use the Kruskal-Wallis test?
Use it to compare three or more independent groups when the data is not normally distributed, is ordinal, or contains outliers that would distort one-way ANOVA. It is the non-parametric counterpart of one-way ANOVA and an extension of the Mann-Whitney U test to more than two groups. Because it works on ranks, it makes no assumption of normality and is robust to outliers.
How does the Kruskal-Wallis test relate to ANOVA and Mann-Whitney?
The Kruskal-Wallis test is to one-way ANOVA what the Mann-Whitney U test is to the two-sample t-test: a rank-based, non-parametric alternative. For exactly two groups, the Kruskal-Wallis test is equivalent to the Mann-Whitney U test. For three or more groups it generalizes that approach, comparing average ranks across all the groups simultaneously.
What does a significant Kruskal-Wallis result tell me?
A significant result, indicated by a small p-value, means that at least one group tends to have systematically higher or lower values than the others. Like ANOVA, it is an omnibus test, so it does not identify which specific groups differ. To locate the differences, you follow it with post-hoc pairwise comparisons and a correction for multiple testing.
What post-hoc test follows a significant Kruskal-Wallis result?
Dunn's test is the most common post-hoc procedure after a significant Kruskal-Wallis result. It performs pairwise comparisons between groups using ranks, with an adjustment such as Bonferroni or Holm to control the family-wise error rate across the multiple comparisons. This step is essential to determine which specific groups differ, since the Kruskal-Wallis test itself only signals that some difference exists.
Does the Kruskal-Wallis test compare medians?
It can be interpreted as comparing medians only when the groups' distributions have similar shapes. When the shapes differ, a significant result indicates that at least one group tends to produce larger or smaller values, which is a statement about stochastic dominance rather than strictly about medians. The conclusion should be worded to match whether the shape assumption is reasonable.
What is the difference between Kruskal-Wallis and the Friedman test?
The Kruskal-Wallis test compares three or more independent groups, where the observations in different groups are unrelated. The Friedman test compares three or more related groups, such as repeated measurements on the same subjects across conditions. Choosing between them depends on whether the groups are independent or the measurements are matched, in the same way that Mann-Whitney and Wilcoxon signed-rank differ for two groups.
Compare Several Groups Without Normality
Run the Kruskal-Wallis test with post-hoc guidance. Free during Beta.
Run Kruskal-Wallis Test →