The Kruskal-Wallis H test compares three or more independent groups when the outcome is ordinal or when the assumptions of a one-way ANOVA are badly violated. It is the nonparametric counterpart of the one-way ANOVA and the extension of the Mann-Whitney U test to more than two groups.
In this guide
When to use it
- Three or more independent groups, with different people in each.
- An ordinal outcome (a single Likert item, a pain rating, a ranking), or a continuous outcome that is strongly skewed or has outliers in small groups.
- For repeated measurements on the same people, use the Friedman test instead.
How it works
All observations are ranked together, from lowest to highest, ignoring group membership. The test then asks whether the average rank differs between groups more than chance would allow. The statistic H follows approximately a chi-square distribution with k − 1 degrees of freedom, where k is the number of groups.
Only if the groups have distributions of the same shape and spread. In general the Kruskal-Wallis test detects whether values in one group tend to be higher than in another (stochastic dominance). Report medians and IQRs as descriptives, but describe the result as a difference in distributions or ranks unless the shapes are similar.
Assumptions
- Independent observations, each person in one group only.
- An outcome that is at least ordinal.
- For interpreting the result as a median difference, similarly shaped distributions in each group.
Worked example
A hospital compares patient satisfaction (a 1–10 rating) across three wards, with 20 patients each (N = 60). The ratings are skewed, with many 9s and 10s, so ANOVA is not ideal.
| Ward | n | Median | IQR | Mean rank |
|---|---|---|---|---|
| A | 20 | 8 | 7–9 | 37.7 |
| B | 20 | 7 | 5–8 | 21.6 |
| C | 20 | 8 | 6–9 | 32.2 |
The test gives H(2) = 8.78, p = .012. At least one ward differs from the others.
Post hoc test: Dunn's test
A significant H only says that the groups are not all the same. To find which pairs differ, use Dunn's test with a correction for multiple comparisons (Bonferroni or Holm). In this example, Dunn's test with Holm correction shows that ward A rated higher than ward B (padj = .011), while the other pairs did not differ significantly. The free calculator runs Dunn's test automatically.
Effect size
Two common effect sizes for Kruskal-Wallis are:
- Epsilon squared: ε² = H / (n − 1) = 8.78 / 59 = .15
- Eta squared based on H: η²H = (H − k + 1) / (n − k) = (8.78 − 3 + 1) / 57 = .12
Both are interpreted roughly like η² in ANOVA (.01 small, .06 medium, .14 large). For each significant pair, you can also report the rank-biserial correlation or r = z / √n from the pairwise comparison.
How to report it in APA 7
A Kruskal-Wallis test showed that satisfaction differed significantly across the three wards, H(2) = 8.78, p = .012, ε² = .15. Dunn’s post hoc tests with Holm correction indicated that patients on ward A (Mdn = 8) reported higher satisfaction than patients on ward B (Mdn = 7), p = .011. No other pairwise differences were significant.
Kruskal-Wallis or ANOVA?
With roughly normal data and similar variances, ANOVA has more power. With moderate non-normality and 15–20 or more per group, ANOVA is still fairly robust. Kruskal-Wallis is the better choice for ordinal outcomes, strong skew or outliers in small samples. If variances are unequal but the data are roughly normal, Welch's ANOVA is often a better alternative than Kruskal-Wallis.
Frequently asked questions
What is the Kruskal-Wallis test used for?
It compares three or more independent groups on an ordinal or non-normal continuous outcome, as a nonparametric alternative to one-way ANOVA.
What post hoc test should I use after Kruskal-Wallis?
Dunn’s test with a Bonferroni or Holm correction. Running multiple Mann-Whitney tests without correction inflates the Type I error rate.
How do I report Kruskal-Wallis in APA?
Report H with its degrees of freedom, the exact p-value, an effect size such as ε², medians for each group and the significant post hoc comparisons.
What sample size do I need?
There is no strict minimum, but each group should have at least 5 observations for the chi-square approximation to work. For good power, aim for 15–20 or more per group.


