Math calculator

Tukey HSD Calculator

Which pairs differ, after the F said something does.

Which pairs differ, after the F said something does

Two groups separate clearly and two do not — which is exactly what an F alone cannot tell you.

3 groups, 15 observations, 12 degrees of freedom, q* = 3.77293

2 of 3 pairs differ

The design is balanced, so one threshold applies: any gap above 2.66786 is honestly significant.

Critical q

3.772929

3 groups, 12 df

HSD threshold

2.667864

smallest honest gap

Within-group MSE

2.500000

the ANOVA error term

Comparisons

3

k(k−1)/2

Every pairwise comparison with its difference, q statistic, adjusted p-value and confidence interval
PairDifferenceqAdjusted p95% interval
ControlDrug A-10.000014.14211.00e-6-12.668 to -7.332differs
ControlDrug B-1.00001.41420.590771-3.668 to 1.668
Drug ADrug B9.000012.72793.08e-66.332 to 11.668differs
Testing these 3 pairs uncorrected would carry a 14.26% chance of at least one false positive. That is the whole reason this test exists. Tukey raises the threshold from the two-group critical value of 3.0813 to 3.7729, which is exactly the amount needed to hold the error rate across the family of comparisons at 5.0% rather than at each one separately. Running t tests on every pair instead controls nothing.
The intervals are the more useful output. A pair is significant exactly when its interval excludes zero, so the table above says the same thing twice — but the interval also says how large the difference might be, and a significant pair whose interval runs from 0.1 to 9.8 is a very different finding from one running 4.8 to 5.1. These are simultaneous intervals: all 3 of them hold together with 95% confidence, which is why they are wider than 3 separate ones would be.

What this tool shows

Every other Tukey calculator interpolates a printed q table. This one integrates the studentized range, so any group count, any degrees of freedom and any level works. The check needs no table: at two groups the critical q is exactly √2 × the critical t, and it agrees to nine decimal places.

  • Every pairwise difference with its q statistic and adjusted p-value
  • Simultaneous confidence intervals that all hold together at your level
  • The studentized range computed by quadrature, at any k, df and alpha
  • Tukey-Kramer for unequal group sizes, with no single HSD pretended
  • The family-wise error rate you would be running without the correction
  • The √2 × t identity printed when there are two groups
Every pair q integrated, not looked up Simultaneous intervals Tukey-Kramer

14.26% at three groups, 40.13% at five — uncorrected.

Updated 12 September 2026 · Works in any browser, no installation

Tukey’s HSD compares every pair of group means while holding the error rate across the whole family of comparisons. It is what to run after a significant one-way ANOVA, which says something differs and never says what — and it uses the studentized range distribution rather than a t, because the largest of several differences is larger than any one of them by construction.

At a glance

Formula shown
For each pair, q = |x̄ᵢ − x̄ⱼ| ÷ √(MSE/2 · (1/nᵢ + 1/nⱼ)), compared against the studentized range critical value q*(α, k, df). On a balanced design that gives one threshold, HSD = q*·√(MSE/n). The studentized range is the distribution of (max − min) of k standard normals divided by an independent estimate of σ, and its CDF is a double integral rather than a closed form.
Scenario support
After a significant one-way ANOVA, when you need to know which groups differ rather than only that some do — comparing treatments, sites, batches, conditions or time points, with any number of groups and any group sizes.
Educational estimate
Planning support from the values you enter — not professional advice.

Why not just run t tests on every pair

It is the obvious thing to do after a significant F, and it is the thing the whole apparatus exists to prevent.

Each test at 5% means each test is wrong 5% of the time. Run three and the chance of at least one false positive is 1 − 0.95³ = 14.26%. Run ten, for five groups, and it is 40.13%. With ten groups there are 45 pairs and the figure is 90.06% — a false positive is close to certain.

Eyeballing the largest gap is worse, not better. Picking the biggest difference and testing that one is an uncorrected multiple comparison with the selection hidden. The maximum of several differences is larger than any single one by construction, which is exactly what the studentized range distribution describes.

So Tukey raises the threshold by the right amount. On the three-treatment preset the two-group critical value would be 3.081 and Tukey’s is 3.773. That gap is not conservatism; it is the correction needed to hold the family-wise rate at 5%.

The tool prints the uncorrected rate for your design, because the number is more persuasive than the argument. At five groups it says 40.13% before you have tested anything.

And it controls the rate exactly, not approximately. Unlike Bonferroni, which bounds the rate and overshoots, Tukey’s is exact for all pairwise comparisons on a balanced design — so it is more powerful while controlling the same thing.

The studentized range, computed rather than looked up

q is not a t and it has no closed form. Its CDF is a double integral, which is why it has been distributed as printed tables for eighty years and why almost every calculator still interpolates one.

q is the range of k standard normals over an estimate of sigma. Conditioning on that estimate gives P(Q < q) = ∫ f(s)·P(W < qs) ds, where W is the range of k normals and is itself an integral. Two nested integrations, neither of which collapses.

A table costs you everything that is not on it. Printed q tables carry a fixed grid of group counts and degrees of freedom at two significance levels. Interpolating between rows is not exact, and a level other than 0.05 or 0.01 is simply unavailable.

This tool integrates it directly, by Gauss-Legendre quadrature on both levels, so any k, any degrees of freedom — including fractional ones — and any alpha work.

The result is checked against nine published table entries, with a worst gap of 0.0034 against values printed to two decimals. That is agreement at table precision.

And against an identity with no table in it. At two groups the range is |Z₁ − Z₂|, which is √2 times a standard normal, so q must equal √2·t exactly. It does, to 1e-9, across eight degrees of freedom and three levels. A table cannot verify itself; this can.

At two groups it is the t test

This is worth stating plainly because it settles a question people ask constantly: whether a post-hoc test is somehow a different, stricter kind of comparison.

With k = 2 the correction does nothing, because there is nothing to correct. One comparison is one comparison; the family-wise rate and the per-comparison rate are the same number.

And the arithmetic follows exactly. q = √2 × t at every degrees of freedom and every level. Load the two-group preset and the tool prints both figures side by side.

So a post-hoc test is not a stricter test. It is the same test with the threshold raised in proportion to how many comparisons are being made — and at one comparison, not raised at all.

It also means Tukey and a t test cannot disagree on two groups. If your software reports different p-values for the two, one of them is one-tailed or is using a different error term.

The same relation runs through the whole family. The F distribution satisfies F(1, ν) = t(ν)² for the same reason: with two groups every omnibus statistic collapses back to the pairwise one it generalises.

Unequal group sizes, and the HSD that does not exist

“The HSD” is a single threshold: any gap larger than it is significant. That is true only when every group is the same size.

With unequal sizes each pair has its own standard error, built from the harmonic mean of the two group sizes. A pair involving two large groups is easier to separate than one involving a small group, so they cannot share a threshold.

That is the Tukey-Kramer modification, and it is what this tool applies automatically. It is slightly conservative — the true family-wise rate comes in below alpha rather than at it — which was conjectured in 1956 and proved in 1984.

A tool that prints one HSD for an unbalanced design is printing a number that applies to no pair. This one returns the threshold only when the design is balanced and says so plainly otherwise, reporting each pair’s own interval instead.

Balance is worth designing for, where you can. It maximises power for a fixed total n, makes the HSD a single interpretable number, and makes the test’s error control exact rather than conservative.

Badly unequal variances are a separate problem entirely. Tukey assumes a common within-group variance, which is where the pooled MSE comes from. If the spreads differ visibly, the Games-Howell procedure is the right post-hoc — it uses each pair’s own variances and its own degrees of freedom, in the way Welch’s t test does.

The intervals are simultaneous, which is why they are wide

The tool reports a confidence interval for every pairwise difference, and they are not ordinary intervals.

They hold together. A 95% simultaneous set means the probability that all of them contain their true differences is 95% — not that each one separately does.

Which makes them wider than individual intervals, by exactly the factor the critical q exceeds the critical t by. That extra width is the correction, expressed as an interval rather than as a threshold.

A pair is significant exactly when its interval excludes zero. The table says the same thing twice, and deliberately: the interval also says how large the difference might be, and a significant pair whose interval runs 0.1 to 9.8 is a very different finding from one running 4.8 to 5.1.

Report the intervals rather than the p-values. An adjusted p-value says whether a gap cleared a threshold; the interval says what the gap plausibly is, which is almost always the question that was actually being asked.

And they inherit the assumptions. Normal residuals, equal variances, independent observations. The residual plot from the ANOVA is the right place to check the first two, and nothing checks the third.

When another post-hoc is the right one

Tukey is the default for all pairwise comparisons on a balanced, equal-variance design. Change any of those and something else fits better.

Comparing every group against one control: use Dunnett. That is k − 1 comparisons rather than k(k−1)/2, so the correction needed is smaller and Dunnett is meaningfully more powerful. Using Tukey there pays for comparisons you never made.

Unequal variances: Games-Howell. It drops the pooled MSE in favour of each pair’s own variances and Welch-style degrees of freedom, which is the same fix Welch applies to the two-sample t test.

Rank-based data: Dunn’s test. After a Kruskal-Wallis, Dunn compares mean ranks using the pooled ranking from the original analysis rather than re-ranking each pair separately, which is what running separate Mann-Whitney tests would do.

A small, pre-specified set of comparisons: Bonferroni or Holm. If you planned three specific contrasts before seeing the data, correcting for three is right and correcting for all pairs is needlessly strict. The correction calculator handles that case.

Comparisons chosen after seeing the data: Scheffé. It covers every possible contrast, not just pairwise ones, which makes it the most conservative option and the only honest one when the comparison was suggested by the data.

And the F itself is not a gate. Tukey controls the family-wise rate on its own, so it does not require a significant ANOVA first — the two can disagree, and running Tukey only after a significant F makes the combined procedure slightly conservative rather than more rigorous.

Sources and methodology

References for the procedure and the distribution behind it.

Method. The studentized range CDF is integrated by Gauss-Legendre quadrature on both nested levels rather than interpolated from a printed q table, so any group count, any degrees of freedom and any significance level is available. The critical value comes from bisecting that CDF, memoised so a re-render costs nothing. Unequal group sizes get the Tukey-Kramer standard error from the harmonic mean of each pair’s sizes, and the single HSD threshold is returned only when the design is balanced. The suite checks the quadrature against nine published table entries with a worst gap of 0.0034, against the exact identity q = √2·t at two groups across 24 combinations, against the closed form for the range of two normals, and against the requirement that the CDF is monotone and that the critical value rises with every added group. That engine is verified on every change against 47 assertions. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

One-Way ANOVAThe full F table with eta and omega squared, plus every pairwise gap — because a significant F says something differs and never says which, and ten groups tested pairwise carry a 90% false-positive rate.
Bonferroni CorrectionAdjusts p-values by Bonferroni, Holm, Šidák, Holm-Šidák and Benjamini-Hochberg at once — and shows that Holm controls exactly what Bonferroni controls while never rejecting fewer, which makes plain Bonferroni dominated.
Kruskal-WallisApplies the tie correction and shows it against the uncorrected value, because on ordinal data it moves p from 0.054 to 0.027 — across the conventional threshold, on identical data.
F-DistributionUpper and lower critical values at any degrees of freedom — including the lower tail printed tables omitted, because F(a,b;p) = 1/F(b,a;1−p) — plus F(1,v) against t(v)² computed both ways, which agree exactly.
t-testOne-sample, two-sample and paired t-tests defaulting to Welch, with Student's pooled version printed beside it — and a warning when the two disagree on the verdict.
Effect SizeCohen d, Hedges g and the overlap between groups, with a sample-size control that moves the p-value while leaving the effect size fixed — the same d gives t = 1.29 at n=30 and 23.57 at n=10,000.

More in Math, or browse all calculators.

Educational use disclaimer

An educational tool. Tukey’s HSD assumes independent observations, normal residuals and a common within-group variance; with visibly unequal variances the Games-Howell procedure is more appropriate, and comparisons suggested by the data need Scheffé rather than any pairwise method.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (4 updates)

Published 12 September 2026

  1. Published a Tukey HSD that INTEGRATES the studentized range rather than interpolating a printed q table. Every other online Tukey calculator interpolates, which is why they all stop at the same group counts and degrees of freedom and offer alpha = 0.05 and 0.01 only. This one takes any k, any df including fractional, and any level.
  2. The quadrature is checked against an identity with no table in it: at two groups the studentized range critical value is exactly sqrt(2) times the two-sided t critical value, because the range of two observations is their absolute difference. Agreement is 1e-9 across eight degrees of freedom and three levels. It also matches nine published table entries to within 0.0034, which is table precision.
  3. States the family-wise error rate you would run WITHOUT the correction — 14.26% at three groups, 40.13% at five, 90.06% at ten — because that number is the whole reason a post-hoc test exists. On the three-treatment preset it raises the threshold from a two-group 3.081 to 3.773.
  4. Applies the Tukey-Kramer modification automatically when group sizes differ, and refuses to print a single HSD threshold in that case, because with unequal sizes each pair has its own standard error and one quoted threshold applies to no pair. Simultaneous intervals are reported for every comparison.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.