On this page
When the Kruskal–Wallis test may fit
The Kruskal–Wallis H test is an omnibus rank-based comparison for independent samples. Use it when the outcome can be ordered and the research question compares three or more independent groups. It ranks all observations together and tests whether the group rank patterns are compatible with a common underlying distribution.
This is not a general fix for every assumption problem in ANOVA. The groups must be independent within and across samples. It does not account for repeated measurements, matched observations, clustering, multiple factors, covariates, or a planned model. Choose the method from the design and outcome before looking at the result.
Enter independent groups and review the example
Paste at least three groups, placing a blank line between groups. Within a group, separate numeric observations with spaces, commas, semicolons or line breaks. Each group must contain at least five observations for the chi-square approximation reported here. The constructed example has 15 values and repeated observations, so you can see how tied ranks are handled.
The calculator reads the entered values in this browser tab. It does not infer independence, detect duplicates or know whether the observations represent separate participants, matched units, clusters or repeated time points. Do not paste names, IDs or confidential data.
How pooled ranks, ties and H are calculated
The tool combines all N observations, orders them from low to high and assigns average ranks to equal values. For group i, Rᵢ is its rank sum and nᵢ is its sample size. The uncorrected statistic is H₀ = 12/[N(N + 1)] × Σ(Rᵢ²/nᵢ) − 3(N + 1).
Ties reduce the variability of the ranks. The correction is C = 1 − Σ(t³ − t)/(N³ − N), where each t is the size of one tied set. The reported statistic is H = H₀/C. The chi-square reference uses k − 1 degrees of freedom, where k is the number of groups; the p-value is the upper-tail probability. If every value is tied, the correction is zero and there is no rank variation to test.
Interpret the result without overstating what it says
A small p-value is evidence against the null model of similar group distributions, given the design and approximation. It does not identify which groups differ or measure the practical importance of a difference. The omnibus result is not itself a reason to try every possible pairwise method; choose a justified follow-up and comparison family from the research question and analysis plan.
Kruskal–Wallis is often introduced as a test of medians, but a median or location interpretation needs the group distributions to have reasonably similar shapes and spreads. If shape or spread differs, rank differences can reflect more than a median shift. The table reports each group’s median and an interpolated first-to-third quartile range as descriptive summaries, alongside rank sums and mean ranks; those summaries do not change the test’s scope.
The p-value uses a large-sample chi-square approximation. NIST describes the approximation as suitable when group sizes are not too small (nᵢ > 4); SciPy gives a typical minimum of five per group. This calculator requires at least five. That screen is not proof that every approximation is accurate: strongly tied, sparse or unusual data may require an exact or permutation method and expert review. It does not calculate those alternatives.
Use Dunn’s test for planned pairwise follow-up comparisons
When pairwise follow-up comparisons are justified, Dunn’s test compares each pair using the same pooled ranks as the Kruskal–Wallis analysis. For groups i and j, zᵢⱼ = (R̄ᵢ − R̄ⱼ) / √([N(N + 1)C / 12] × [1/nᵢ + 1/nⱼ]), where R̄ is a group’s mean pooled rank, n is its size, N is the pooled size and C is the tie correction defined above. The two-sided normal-reference p-value is then adjusted across all pairs. Running separate Mann–Whitney tests on each pair re-ranks each subset and does not preserve the pooled ranking used by the omnibus test.
The optional table below adjusts the full set of pairwise p-values with Holm’s step-down procedure. It controls the family-wise error rate under arbitrary dependence among tests. The table uses all k(k − 1)/2 pairs and does not decide whether the comparison family, follow-up method or threshold fits your study. A significant adjusted value indicates evidence of a rank-distribution difference for that pair under the method; it is not automatically a median difference or a practically important effect.
Dunn’s normal-reference calculation is approximate. It is not an exact or permutation procedure and cannot repair dependent groups, unsuitable outcomes or a poorly chosen comparison family. If the result will support a consequential claim, review the study design and have the analysis checked with suitable statistical software or a statistician.
Free rank-based statistics calculator
Compare three or more independent groups
Place a blank line between groups. Separate observations with spaces, commas, semicolons or line breaks. Each group needs at least five observations for the chi-square approximation used here.
Group 1: 1, 1, 2, 2, 3
Group 2: 3, 4, 4, 5, 5
Group 3: 6, 6, 7, 8, 9
Values stay in this browser tab. Avoid entering identifiable or confidential measurements on a shared device.
The constructed example has 3 groups and 15 observations. Edit the values, then calculate.
Kruskal–Wallis test summary
Tie-corrected H
Degrees of freedom
Upper-tail p-value
Tie correction factor
Total observations
| Group | n | Median | Q1–Q3 | Rank sum | Mean rank |
|---|
This omnibus result does not identify a differing pair. The chi-square p-value is approximate, and interpretation depends on independent observations and the distribution shapes.
Dunn pairwise comparisons
Two-sided normal-reference p-values use the pooled ranks and tie correction above. Holm adjustment covers all displayed pairs.
| Groups | Mean-rank difference | Standard error | z | Raw p | Holm-adjusted p |
|---|
These comparisons do not establish median differences when group shapes or spreads differ. Interpret the comparison family and study design before reporting.
Questions about this topic
How many groups does this Kruskal–Wallis calculator accept?
It accepts three to twelve independent groups, with at least five observations per group and up to 5,000 observations total. The minimum supports the chi-square approximation described here; it does not establish that the design or approximation is appropriate.
Is Kruskal–Wallis simply a test of medians?
Not in every setting. It compares rank distributions. A median or location interpretation is reasonable only when the group distributions have similar shapes and spreads; otherwise, rank differences may reflect other distributional changes.
Does the Kruskal–Wallis result tell me which groups differ?
No. It is an omnibus test. When the research question and analysis plan justify pairwise follow-ups, the optional Dunn table compares the pairs using pooled ranks and reports Holm-adjusted p-values. It does not decide whether post-hoc testing is justified.
Why use Dunn’s test instead of separate Mann–Whitney tests?
Dunn’s pairwise method keeps the pooled ranking from the Kruskal–Wallis analysis and adjusts the complete comparison family. Separate Mann–Whitney tests re-rank each pair and do not preserve that shared ranking.
Can I use it for repeated measurements or matched groups?
No. The groups need to be independent. Repeated or paired observations require a method that accounts for their dependence.
How are tied observations handled?
Equal pooled values receive their average rank. The H statistic is then adjusted with the standard tie-correction factor. If every value is tied, there is no rank variation and the calculator returns an explanatory error.
Are my values uploaded?
No. The calculation runs in this browser tab. The tool does not send the entered measurements to AI Essay.
Sources and editorial notes
The supporting reading below informs our editorial guidance. Exercises and scenarios illustrate a method; they do not report a completed product test or measured learning outcome. Read our editorial policy or send a correction with a supporting source to info@ai-essay.com.
- NIST/SEMATECH e-Handbook: Kruskal–Wallis test, pooled ranks and chi-square approximation
- SciPy documentation: Kruskal–Wallis H test, tie correction and sample-size guidance
- CRAN dunn.test manual: pairwise comparisons using rank sums and tie handling
- R stats documentation: Holm adjustment for a family of p-values