Kruskal-Wallis Calculator

Comparing Three or More Groups Without Normality Assumptions

ANOVA compares three or more group means, but it leans on the assumption that each group's data is roughly normal with similar variance. When that assumption doesn't hold — skewed data, ordinal ratings, or the presence of outliers — the Kruskal-Wallis H test provides a rank-based alternative that tests whether the groups come from the same underlying distribution.

The Formula

H = [12 / (N(N+1))] × Σ(Ri² / ni) − 3(N+1), corrected for ties
where N = total observations, k = number of groups, Ri = sum of ranks in group i, ni = size of group i
df = k − 1, tested against the chi-square distribution

Worked Example

Three groups: (1, 2, 3), (4, 5, 6), (7, 8, 9) — a case with no overlap between groups at all.

Kruskal-Wallis H test result
QuantityValue
k (groups), N (total observations)3, 9
H statistic7.20
df2
p-value0.0273

Computed directly from the calculator's rank-sum formula and chi-square approximation.

With p = 0.027, below the conventional 0.05 threshold, the test correctly detects that these three non-overlapping groups don't share the same distribution.

Where This Calculation Matters

  • Comparing multiple treatment arms — when a study has three or more independent groups (e.g., three dosage levels or three marketing variants) and the outcome data is skewed or ordinal.
  • Small or unbalanced group sizes — rank-based tests are less sensitive to unequal variances across groups than standard ANOVA.
  • Screening before deeper analysis — a significant Kruskal-Wallis result indicates at least one group differs, prompting pairwise post-hoc rank tests such as Mann-Whitney U with a correction for multiple comparisons.

How to Use This Calculator

  1. Enter each group's values as a comma-separated list, with groups separated by semicolons (e.g., 1,2,3; 4,5,6; 7,8,9).
  2. Enter at least two groups, each with at least two values.
  3. Select Calculate to get the H statistic, degrees of freedom, and p-value.

Related Calculations

When group data is well-approximated by a normal distribution, use the parametric ANOVA Calculator instead. For comparing just two independent groups, see the Mann-Whitney U Test Calculator.