Home » Statistics & Probability Calculators » Kruskal-Wallis Test Calculator (H Test)

Kruskal-Wallis Test Calculator (H Test)

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

H = 2.8538
p = 0.2401

df = 2, N = 18.

Fail to reject H₀ at α = 0.05. The groups are not significantly different in their distributions.
  1. Rank all 18 values together
    Smallest = rank 1; tied values share the average rank.
  2. Rank sums by group
    GroupnMedianRank sum RMean rank
    Method A68396.5
    Method B620.56510.833
    Method C626.56711.167
  3. H statistic
    H = [12 ÷ (N(N + 1))] × Σ(Ri² ÷ ni) − 3(N + 1) = 2.8538
  4. Tie correction
    No ties, so no correction is needed.
  5. p-value
    P(χ²2 ≥ 2.8538) = 0.2401; critical χ² at α = 0.05 is 5.9915
  6. Decision
    p = 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.

Scroll to Top