T-Test vs ANOVA: Which Should You Use?

A t-test compares exactly two groups; ANOVA compares three or more. Understand why running multiple t-tests instead of one ANOVA can mislead you, and when post-hoc tests become necessary.

Key takeaway: If you have more than two groups, use ANOVA, not multiple pairwise t-tests. Running many t-tests inflates the false-positive rate—the more tests you run, the higher the chance you'll find a difference that doesn't really exist.

§1 The core difference

T-test: Compares the means of exactly two groups. Answers: "Are these two group means significantly different?" There is one null hypothesis (H₀: μ₁ = μ₂) and one test statistic.

ANOVA (analysis of variance): Compares the means of three or more groups simultaneously. Answers: "Is there a significant difference among all these group means?" There is one global null hypothesis (H₀: μ₁ = μ₂ = … = μk) and one test statistic (the F ratio).

Both test whether observed differences in means are larger than we'd expect by chance alone. Both assume the data within each group follow a normal distribution and have equal variance across groups (homogeneity of variance).

§2 Why multiple t-tests don't work

Suppose you have four treatment groups and want to know if any pair differs. There are C(4,2) = 6 possible pairwise comparisons. If you run six separate t-tests, each at α = .05, your actual false-positive rate is not 5%—it's much higher.

Why? Each test has a 5% chance of producing a false positive *if the null is true*. But when you run multiple tests, at least one of them is more likely to give a false positive just by chance. This is called family-wise error rate (FWER) inflation.

The formula is: FWER = 1 − (1 − α)c, where c is the number of comparisons and α is your significance level.

Compute your family-wise error rate

Select the number of groups. Watch the FWER jump as you run more pairwise comparisons:

Comparisons 3
FWER (α=.05) 14.3%

If you ran 3 separate t-tests on these groups, your actual false-positive rate is 14.3% — nearly triple the nominal .05.

Groups Pairwise comparisons FWER @ α=.05
2 1 5.0%
3 3 14.3%
4 6 26.5%
5 10 40.1%
6 15 53.7%

§3 How ANOVA fixes this

ANOVA tests the global null hypothesis (all means are equal) in a single test. If you reject this null, you know at least one mean differs from at least one other—but you don't yet know which pairs differ. Importantly, this single global test maintains your α = .05 false-positive rate for the entire family of comparisons.

The ANOVA test statistic, F, is the ratio of between-group variance to within-group variance:

F = MS_between / MS_within

If groups have truly equal means, between-group differences are just random noise, and F ≈ 1. If one or more groups differ, between-group variance swells, and F grows large. The p-value tells you the probability of seeing an F this large *if all means were actually equal*.

§4 Comparison table

Feature Independent samples t-test One-way ANOVA
Groups compared Exactly 2 3 or more
Hypotheses tested 1 (μ₁ = μ₂) 1 (μ₁ = μ₂ = … = μk)
Test statistic t F
FWER controlled? Yes (one test) Yes (one global test)
Post-hoc tests needed? No (only 1 comparison) Yes, if p < .05 (to find which pairs differ)
Common post-hoc N/A Tukey's HSD, Bonferroni, Scheffé
Tool T-test calculator ANOVA calculator

§5 Visualization: Why ANOVA is the safer choice

Conceptual diagram showing a t-test comparing two groups (left) versus ANOVA comparing three groups (right), with ANOVA highlighted as the correct choice Multiple t-tests G1 G2 G3 t₁ t₂ t₃ 3 tests = 14.3% FWER High false-positive risk One ANOVA G1 G2 G3 F-test 1 test = 5% FWER Correct error rate
Fig. 1 — Multiple t-tests (left) require three comparisons, inflating false-positive risk. One ANOVA (right) tests all groups at once, keeping error rate at α = .05.

§6 Assumptions and when ANOVA fails

ANOVA assumes:

  • Normality: Each group's data is approximately normally distributed. If you have large samples (n > 30 per group), this is fairly robust to violations.
  • Homogeneity of variance: All groups have roughly equal variance. Violating this can inflate Type I error. Test with Levene's test; if variances differ greatly, use Welch's ANOVA instead.
  • Independence: Observations within and across groups are independent (not paired, not repeated measures).

What if these assumptions are violated?

  • Normality violated: With larger samples, ANOVA is robust. For smaller samples, consider a Kruskal-Wallis test (the nonparametric alternative).
  • Unequal variances: Use Welch's ANOVA instead of the standard one-way ANOVA.
  • Repeated measures: Use repeated-measures ANOVA (beyond the scope of this guide).

§7 Post-hoc tests: the follow-up

If your ANOVA p-value is less than .05, you reject the null and conclude that at least one pair of means differs. But ANOVA does not tell you which pairs. That's where post-hoc tests come in.

A post-hoc test (also called a pairwise comparison test) controls the FWER while testing all possible pairs. Common choices:

  • Tukey's HSD (Honestly Significant Difference): The most popular. Assumes equal sample sizes and equal variances. Balances power and strictness.
  • Bonferroni: Very conservative. Divides α by the number of comparisons. Good when you want to be very sure, but loses power.
  • Scheffé: Conservative but flexible. Works even with unequal sample sizes.

Do not run post-hoc tests unless your ANOVA p < .05. If ANOVA fails to reject the null, pairwise tests are unnecessary and will only inflate error.

§8 When to use each test

  • Exactly 2 groups, continuous outcome, independent samples: Use independent-samples t-test.
  • 3+ groups, continuous outcome, independent samples: Use one-way ANOVA (or Welch's ANOVA if variances are unequal).
  • 2 groups, same subjects measured twice (or paired): Use paired t-test.
  • 3+ groups, same subjects measured at each level: Use repeated-measures ANOVA (not covered here; consult a statistics textbook or specialist).
  • Outcome is categorical (e.g., pass/fail, disease/healthy): Use chi-square test, not t-test or ANOVA.

§9 FAQ

Can I run three separate t-tests instead of ANOVA?

Not if you want to maintain your false-positive rate. Three pairwise t-tests have a 14.3% family-wise error rate at α = .05, not 5%. ANOVA tests all groups in one global test, preserving the 5% rate. If you insist on t-tests, use a Bonferroni correction (divide α by the number of tests), but this makes the test very conservative and you'll lose power to detect real differences.

What is Tukey's HSD and when do I need it?

Tukey's Honestly Significant Difference test is a post-hoc test that compares all pairs of group means after ANOVA. You run it only if your ANOVA p < .05. It controls family-wise error rate while letting you compare specific pairs. For example, if you have treatment groups A, B, and C and ANOVA is significant, Tukey's test tells you whether A differs from B, A differs from C, or B differs from C (or some combination).

What if I have only 2 groups but 3+ measurement timepoints?

That is a repeated-measures design. If you measure the same subjects at baseline, week 4, and week 8, use a repeated-measures ANOVA (not a one-way ANOVA and not a t-test). Repeated-measures ANOVA accounts for the fact that measurements from the same person are not independent. This guide does not cover repeated-measures ANOVA in detail; consult a methods paper or specialized calculator.

Does ANOVA assume equal sample sizes?

No. ANOVA works with unequal group sizes, though it is most powerful and precise when sizes are equal. If sample sizes are very different, report the range (e.g., "n ranged from 15 to 42 across groups").

What if my data is very non-normal?

If data are heavily skewed or have extreme outliers, and your sample size per group is small (n < 30), ANOVA may not be reliable. Instead, use the Kruskal-Wallis test, a nonparametric alternative that ranks the data and does not assume normality. After a significant Kruskal-Wallis result, use pairwise Mann-Whitney U tests with a Bonferroni correction for follow-up.

Can I report the p-value from ANOVA exactly (e.g., p = .0347) or should I round?

Report to 4 decimal places (e.g., p = .0347 or p = .1203). If p < .0001, write "p < 0.0001" rather than a string of zeros. In the main text, you might write "F(2, 57) = 4.21, p = .019"; the numbers in parentheses are the numerator and denominator degrees of freedom.

§10 Sources