Kruskal–Wallis Test Calculator

Nonparametric one-way ANOVA on ranks

Perform a Kruskal–Wallis H test to compare two or more independent groups when normality or equal variances cannot be assumed. The tool pools and ranks all observations, applies tie correction, and computes the H statistic, degrees of freedom, p-value (chi-square approximation), and a clear decision.

Suitable for ordinal outcomes, skewed data and small samples. For formal analyses, always report your full study design and consult a statistician when needed.

1. Enter your data

From 2 to 10 independent groups.

Common choices: 0.05, 0.01.

Change k and click to resize inputs. Empty groups are ignored.

Load example:

2. Test results summary

The Kruskal–Wallis H statistic is compared to a chi-square distribution with \(k-1\) degrees of freedom. For small samples (especially with ties), the chi-square approximation is only approximate.

H statistic
with tie correction if enabled
Degrees of freedom
df = k − 1
p-value (chi-square)
right-tail probability P(χ² ≥ H)
Decision at \(\alpha\)
reject / do not reject H₀
The interpretation of the test will appear here after computation.

3. Group descriptive statistics and ranks

For each group, the table reports the sample size \(n_i\), basic descriptive statistics, and the sum and mean of ranks after pooling all observations.

Group n Min Max Mean Median Sum of ranks Ri Mean rank
(useful for verifying ranks and ties)

Definition of the Kruskal–Wallis test

The Kruskal–Wallis test is a nonparametric method for testing whether several independent samples (groups) come from the same population. It is often described as a rank-based one-way ANOVA, because it applies ANOVA logic to the ranks of the data instead of the raw values.

Suppose we have \(k\) groups, with sample sizes \(n_1, n_2, \dots, n_k\) and total sample size \(N = n_1 + n_2 + \dots + n_k\). All \(N\) observations are pooled and ranked from 1 to \(N\), with ties receiving the average of their ranks. Let \(R_i\) be the sum of ranks in group \(i\).

The Kruskal–Wallis H statistic (without tie correction) is

\[ H = \frac{12}{N(N+1)} \sum_{i=1}^{k} \frac{R_i^2}{n_i} - 3(N+1). \]

Under the null hypothesis that all group distributions are identical, and for sufficiently large samples, \(H\) approximately follows a chi-square distribution with \(k-1\) degrees of freedom.

Tie correction

When there are ties in the data, a tie correction factor improves the accuracy of the chi-square approximation. If the data contain tie groups of sizes \(t_1, t_2, \dots\), the correction factor \(C\) is

\[ C = 1 - \frac{\sum_j (t_j^3 - t_j)}{N^3 - N}. \] \[ H_{\text{corrected}} = \frac{H}{C}. \]

This calculator applies tie correction by default and reports the corrected \(H\) statistic.

Null and alternative hypotheses

  • Null hypothesis \(H_0\): all groups come from the same distribution (typically interpreted as equal medians).
  • Alternative hypothesis \(H_1\): at least one group tends to have larger or smaller values than the others.

If the p-value is below the chosen significance level \(\alpha\), we reject \(H_0\) and conclude that there is evidence of a difference between groups. To identify which groups differ, post-hoc tests are required.

FAQ: using and interpreting this Kruskal–Wallis calculator

1. When should I use Kruskal–Wallis instead of one-way ANOVA?

Use Kruskal–Wallis when the response variable is ordinal or clearly non normal, when there are strong outliers, or when the homogeneity of variances assumption of ANOVA is violated. If data are approximately normal with equal variances, one-way ANOVA is more powerful.

2. How many observations per group do I need?

The test can be computed with small samples, but the chi-square approximation improves with larger group sizes (e.g. \(n_i \geq 5\)). With very small groups, treat p-values with caution and interpret them as approximate.

3. How do I perform post-hoc comparisons?

After a significant Kruskal–Wallis test, use pairwise nonparametric tests such as Dunn's test, Wilcoxon rank-sum (Mann–Whitney) with multiple-comparison corrections (Bonferroni, Holm, FDR, etc.) to identify which groups differ.

4. What effect size measures can I report?

Common effect sizes for Kruskal–Wallis include \(\eta^2\) or \(\epsilon^2\) based on the H statistic. For example, a simple option is \(\epsilon^2 = \dfrac{H - k + 1}{N - k}\). This calculator does not compute effect size automatically, but you can plug in H, k and N into the formula.