Tukey HSD · Post-Hoc After ANOVA
Tukey HSD Calculator
Paste your group data and get every pairwise comparison — q statistic, exact p-value, 95% confidence interval and the compact letter display — with the familywise error rate held at your chosen α.
Q critical · studentized range
—
—
Pairwise comparisons (Tukey–Kramer)
| Pair | Mean diff. | q | p-value | 95% CI | HSD | Significant |
|---|
Group means and compact letter display
| Group | n | Mean | SD | Letter |
|---|
How the numbers were worked out
Group means
Bars sharing a colour share a letter—those groups do not differ significantly.
A significant ANOVA only tells you that some groups differ — not which ones. Tukey's HSD (honestly significant difference) compares every pair of means while holding the familywise error rate at 5%. This calculator handles equal and unequal sample sizes (Tukey–Kramer), and reports the q statistic, p-value and confidence interval for every pair.
How to use the Tukey HSD calculator
- Run an ANOVA first. Tukey HSD is a post-hoc test: it only makes sense after a significant one-way or two-way ANOVA. Use the one-way ANOVA calculator or the two-way ANOVA calculator, and check equal variances with the Levene test first.
- Paste each group's raw values into its own box, separated by commas or spaces. Give every group a name — the names appear in the pair table and the letter display.
- Add or remove groups with the buttons (3 to 6 groups). Sample sizes may differ; the calculator uses the Tukey–Kramer adjustment automatically.
- Choose the familywise significance level (α, default 0.05). This is the chance of even one false positive across all the pairs, not per pair.
- Read the pair table. A pair is significant when q exceeds qcrit — equivalently, when the absolute mean difference exceeds the HSD, or when the 95% confidence interval excludes 0.
Try it now: the three teaching-method groups from the Levene test example are loaded by default. All three pairs differ, and the largest gap is between Group 1 and Group 3 (mean difference −21.00, q = 15.59, p < 0.0001). Use Load Example 2 for four groups with unequal sample sizes.
What Tukey's HSD measures
An ANOVA F-test is an omnibus test: a significant result says that at least one group mean differs from the rest, but it never says which ones. The natural next step — a t-test for every pair — is a trap. With 4 groups there are 6 pairs; running 6 t-tests at 5% each pushes the chance of at least one false positive to about 1 − 0.956 ≈ 26%. With 6 groups (15 pairs) it reaches about 54%. That inflated chance is the familywise error rate, and Tukey's HSD (Tukey, 1949) is built to hold it at your chosen α.
The method compares every pair of means using the studentized range distribution, which describes the range of k sample means at once. Because the critical value grows with the number of groups, the more pairs you test, the higher the bar for any single pair — and the familywise error rate stays at α. The price is a little power: Tukey HSD is slightly conservative when only a few of the pairs matter, but for all pairwise comparisons after ANOVA it is the standard choice.
Tukey HSD is a post-hoc test. It answers a different question from the ANOVA: not 'do the groups differ overall?' but 'which pairs differ?' If the ANOVA is not significant, stop there — running post-hoc tests anyway is fishing, and the p-values will not mean what they seem to.
The q statistic and the HSD
For groups i and j, with means Mi and Mj, sample sizes ni and nj, and the ANOVA mean square error MSE (the pooled within-group variance, with dfw = N − k degrees of freedom), the test statistic is:
q = |Mi − Mj| / √(MSE/2 × (1/ni + 1/nj))
With equal sample sizes this reduces to q = |Mi − Mj| / √(MSE/n). With unequal sizes the formula above is the Tukey–Kramer adjustment (Kramer, 1956), which uses the harmonic-style term 1/ni + 1/nj instead of 2/n.
The critical value qcrit is the 1 − α quantile of the studentized range distribution for k groups and dfw degrees of freedom. The honestly significant difference for a pair is HSD = qcrit × SE, where SE is the denominator of the q formula, and the 95% confidence interval for the mean difference is diff ± HSD. Three equivalent ways to judge a pair:
- q > qcrit — the q statistic beats its critical value.
- |Mean difference| > HSD — the gap between the means is larger than the honestly significant difference.
- The 95% CI excludes 0 — the interval for the difference does not contain zero.
The p-value for each pair comes from the exact studentized range distribution (SciPy's studentized_range), never from a normal or t approximation. That matters most for the small p-values: with q = 15.59 the p-value is far below 0.0001, and an approximation would misstate it.
Tukey HSD vs Bonferroni
| Tukey HSD | Bonferroni | |
|---|---|---|
| Comparisons covered | All pairwise comparisons | Any set you choose (planned or post-hoc) |
| Power for all pairs | Higher — built for exactly this job | Lower — divides α by the number of tests |
| Unequal n | Yes (Tukey–Kramer) | Yes (works with any t-test) |
| When to prefer it | Comparing every pair after ANOVA | Only a few planned contrasts, or non-pairwise comparisons |
When you compare all pairs after an ANOVA, Tukey HSD is the better tool. Reach for Bonferroni (or Holm) when you have a small set of planned comparisons, or when the comparisons are not all pairwise — for example, comparing each treatment against a control (where Dunnett's test is the usual choice).
Run ANOVA first: the workflow
Tukey HSD sits at the end of a short chain. Skip a link and the results stop meaning what they seem to:
- Check the assumptions. Within each group the data should be approximately normal (check with the Shapiro–Wilk test) and the groups should have similar variances (check with the Levene test).
- Run the ANOVA. Use the one-way ANOVA calculator for one factor, or the two-way ANOVA calculator for two factors. If the F-test is not significant, stop — there is nothing to follow up.
- Run Tukey HSD on the significant ANOVA, using the same data and the same MSE. The calculator computes MSE and dfw from your raw values, so the numbers match your ANOVA exactly.
- If variances are unequal (Levene's test significant), Tukey HSD's equal-variance assumption is strained — use the Games–Howell procedure instead, which does not pool the variances.
- If the data are not normal or are ordinal, run the Kruskal–Wallis test instead of ANOVA, and follow it with Dunn's test (with a Bonferroni or Holm correction) rather than Tukey HSD.
- Report the ANOVA first, then the pairs. Give the omnibus F, then the pairwise differences with their confidence intervals — never the pairs alone.
Worked example 1: three teaching methods, equal n
Three teaching methods were compared on test scores (n = 8 per group) — the same data as the Levene test example. The ANOVA summary is MSE = 14.5179 with dfw = 21, and qcrit = 3.5646 at α = 0.05.
| Group | Scores | n | Mean | SD |
|---|---|---|---|---|
| Group 1 | 12, 14, 11, 13, 15, 12, 14, 13 | 8 | 13.0000 | 1.3093 |
| Group 2 | 18, 22, 25, 19, 21, 24, 20, 26 | 8 | 21.8750 | 2.9001 |
| Group 3 | 30, 38, 28, 40, 35, 26, 42, 33 | 8 | 34.0000 | 5.7817 |
With equal n the standard error is the same for every pair: SE = √(14.5179/8) = 1.3471, so the HSD is the same for every pair too: HSD = 3.5646 × 1.3471 = 4.8020.
| Pair | Mean diff. | q | p | 95% CI | HSD | Significant |
|---|---|---|---|---|---|---|
| Group 1 vs Group 2 | −8.8750 | 6.5881 | 0.0004 | [−13.6770, −4.0730] | 4.8020 | Yes |
| Group 1 vs Group 3 | −21.0000 | 15.5888 | < 0.0001 | [−25.8020, −16.1980] | 4.8020 | Yes |
| Group 2 vs Group 3 | −12.1250 | 9.0007 | < 0.0001 | [−16.9270, −7.3230] | 4.8020 | Yes |
Interpretation. All three groups differ from each other (all ps < .001). The compact letter display is Group 1 A, Group 2 B, Group 3 C — no letters are shared, so every pair is significantly different. The largest gap is between Group 1 and Group 3 (21 points). One caution: Levene's test on these groups is significant (F(2, 21) = 8.49, p = .002), so the equal-variance assumption behind Tukey HSD is shaky here — the example shows the mechanics, and in a real analysis you would prefer Games–Howell. The conclusions are so clear-cut that the choice of post-hoc method would not change them.
Worked example 2: four teaching methods, unequal n (Tukey–Kramer)
Four teaching methods were compared with unequal group sizes (n = 5, 6, 7, 6). The ANOVA summary is MSE = 1.8029 with dfw = 20, and qcrit = 3.9583 at α = 0.05. Because the sample sizes differ, the standard error — and therefore the HSD — is different for each pair.
| Group | Scores | n | Mean | SD |
|---|---|---|---|---|
| Lecture | 10, 12, 11, 13, 12 | 5 | 11.6000 | 1.1402 |
| Discussion | 15, 17, 16, 14, 18, 16 | 6 | 16.0000 | 1.4142 |
| Online | 20, 22, 21, 19, 23, 20, 21 | 7 | 20.8571 | 1.3452 |
| Blended | 16, 18, 17, 15, 19, 17 | 6 | 17.0000 | 1.4142 |
| Pair | Mean diff. | q | p | 95% CI | HSD | Significant |
|---|---|---|---|---|---|---|
| Lecture vs Discussion | −4.4000 | 7.6533 | 0.0001 | [−6.6757, −2.1243] | 2.2757 | Yes |
| Lecture vs Online | −9.2571 | 16.6516 | < 0.0001 | [−11.4577, −7.0566] | 2.2005 | Yes |
| Lecture vs Blended | −5.4000 | 9.3927 | < 0.0001 | [−7.6757, −3.1243] | 2.2757 | Yes |
| Discussion vs Online | −4.8571 | 9.1953 | < 0.0001 | [−6.9480, −2.7663] | 2.0908 | Yes |
| Discussion vs Blended | −1.0000 | 1.8243 | 0.5795 | [−3.1698, 1.1698] | 2.1698 | No |
| Online vs Blended | 3.8571 | 7.3022 | 0.0003 | [1.7663, 5.9480] | 2.0908 | Yes |
Interpretation. Only Discussion and Blended do not differ (mean difference −1.00, q = 1.82, p = .580, 95% CI [−3.17, 1.17]). Every other pair differs. The compact letter display is Lecture A, Discussion B, Blended B, Online C — Discussion and Blended share the letter B, so they are the one pair that does not differ. Online scores highest, Lecture lowest, and the Online–Lecture gap (9.26 points) is the largest.
How to read the compact letter display
The compact letter display compresses the whole pair table into one letter per group. Groups that share a letter do not differ significantly; groups with no letter in common do differ. In Example 2, Lecture A, Discussion B, Blended B, Online C tells you at a glance that Discussion and Blended are the only pair that does not differ, and that Online differs from everything else.
The letters are assigned in group order: the first group gets A, and each later group takes the lowest letter it can share — that is, a letter held only by groups it does not differ from — or a new letter if no such letter exists. Two things to keep in mind:
- Sharing a letter means 'not significantly different', not 'equal'. A non-significant pair may still hide a real difference the study was too small to detect.
- The display can use more letters than the minimum. In unusual patterns (A differs from C, but B differs from neither) the simple assignment used here may give B its own letter even though it does not differ from A or C. The pair table is the authority; the letters are a summary.
Assumptions and limitations
- Independent observations — the groups must contain different participants (or units). For repeated measures on the same people, use the repeated measures ANOVA and its post-hoc tests instead.
- Approximately normal data within each group — check with the Shapiro–Wilk test. Tukey HSD is fairly robust to mild non-normality when the group sizes are similar.
- Equal variances — check with the Levene test. With clearly unequal variances, prefer Games–Howell; with unequal variances and unequal n, Tukey–Kramer becomes conservative.
- All pairwise comparisons. Tukey HSD is designed for comparing every pair. For a small set of planned contrasts, or comparisons against a control, Bonferroni, Holm or Dunnett are more appropriate.
- Post-hoc only. Running Tukey HSD without a significant ANOVA inflates the false-positive rate the method is supposed to control.
- Effect sizes are not included. A significant pair can still be a small effect — report the mean difference and its confidence interval alongside the p-value. For standardised effect sizes, the effect size calculator is the companion tool; the one-way ANOVA calculator also reports eta-squared for the overall effect.
How to report Tukey HSD results (APA)
Report the ANOVA first, then the post-hoc pairs. Give the mean difference and its 95% confidence interval for each pair you discuss — a p-value alone does not say how big the difference is. Copyable sentences:
Tukey HSD post-hoc tests showed that all three groups differed significantly from each other (all ps < .001). The largest difference was between Group 1 and Group 3 (M diff = −21.00, 95% CI [−25.80, −16.20]).
For Example 2: Tukey HSD post-hoc tests showed that Online scored significantly higher than Lecture (M diff = 9.26, 95% CI [7.06, 11.46]), Discussion (M diff = 4.86, 95% CI [2.77, 6.95]) and Blended (M diff = 3.86, 95% CI [1.77, 5.95]); Discussion and Blended did not differ significantly (M diff = −1.00, 95% CI [−3.17, 1.17], p = .580).
Template: Tukey HSD post-hoc tests showed that [Group A] scored significantly higher than [Group B] (M diff = X.XX, 95% CI [L, U], p = .XXX). [Group C] and [Group D] did not differ significantly (M diff = X.XX, 95% CI [L, U], p = .XXX).
Cite this tool
APA (7th ed.): Tukey HSD Calculator. (2026). Empirical Rule Calculators. https://empiricalrulecalculators.com/tukey-hsd-calculator/
BibTeX: @misc{tukeyhsd2026, title = {Tukey HSD Calculator}, author = {{Empirical Rule Calculators}}, year = {2026}, url = {https://empiricalrulecalculators.com/tukey-hsd-calculator/} }
Frequently asked questions
When do I run Tukey HSD?
After a significant one-way ANOVA — or after a significant main effect or interaction in a two-way ANOVA — when you want to compare every pair of means. Never as a first step, and never with only two groups: that is a t-test, not a post-hoc test.
Tukey HSD vs Bonferroni — which is better?
For all pairwise comparisons, Tukey HSD. It is more powerful because it uses the studentized range distribution, which is built for exactly that job, while Bonferroni divides α by the number of tests and becomes very conservative with many pairs. Use Bonferroni (or Holm) for a small set of planned comparisons or for contrasts that are not pairwise.
What is the studentized range statistic?
q = (difference between two means) / SE, where SE = √(MSE/2 × (1/ni + 1/nj)). It is the standardised gap between two means, judged against the studentized range distribution, which accounts for the fact that k means are being compared at once. The largest q across all pairs is the studentized range itself.
Can Tukey handle unequal sample sizes?
Yes, through the Tukey–Kramer adjustment (Kramer, 1956): the standard error uses 1/ni + 1/nj instead of 2/n. The test is exact for equal sample sizes and slightly conservative for unequal ones.
What is a compact letter display?
One letter per group: groups sharing a letter do not differ significantly, and groups with no letter in common do differ. Lecture A, Discussion B, Blended B, Online C means only Discussion and Blended fail to differ — Online differs from every other group, and Lecture differs from every other group.
Sources: Tukey, J. W. (1949). Comparing individual means in the analysis of variance. Biometrics, 5(2), 99–114. Kramer, C. Y. (1956). Extension of multiple range tests to group means with unequal numbers of replications. Biometrics, 12(3), 307–310. Hochberg, Y., & Tamhane, A. C. (1987). Multiple Comparison Procedures. Wiley. SciPy 1.11.4 (scipy.stats.studentized_range for exact studentized range p-values and quantiles).
Next steps
Keep going with the tests that pair with Tukey HSD — the ANOVA that comes first, the variance check, and the two-factor follow-up.
📊
One-Way ANOVA Calculator
Run the omnibus F-test first — Tukey HSD only follows a significant ANOVA.
● LiveANOVATry Calculator →
🎲
Levene Test Calculator
Check equal variances before trusting Tukey HSD — the assumption it stands on.
● LiveVariance TestTry Calculator →
📊
Two-Way ANOVA Calculator
Two factors at once — follow a significant main effect or interaction with Tukey HSD.
● LiveANOVATry Calculator →
More Tools to Explore
More free statistics calculators to pair with Tukey HSD.
One-Way ANOVA Calculator
Run the omnibus F-test first — Tukey HSD only follows a significant ANOVA.
● LiveANOVATry Calculator →Levene Test Calculator
Check equal variances before trusting Tukey HSD — the assumption it stands on.
● LiveVariance TestTry Calculator →Two-Way ANOVA Calculator
Two factors at once — follow a significant main effect or interaction with Tukey HSD.
● LiveANOVATry Calculator →Repeated Measures ANOVA Calculator
Same participants, several conditions — the within-subjects ANOVA and its sphericity checks.
● LiveANOVATry Calculator →Kruskal-Wallis Test Calculator
The non-parametric alternative to one-way ANOVA when normality fails — compare three or more groups by rank.
● LiveNonparametricTry Calculator →F-Test Calculator
Compare two variances with an F-test — the two-group case Tukey HSD does not cover.
● LiveVariance TestTry Calculator →