Key takeaways
- Use a one-sample t-test to compare one mean with a fixed value, an independent-samples t-test for two separate groups, and a paired-samples t-test for the same people measured twice.
- Every t statistic is a mean difference divided by its standard error; degrees of freedom depend on the test (n − 1, or n₁ + n₂ − 2).
- Welch’s t-test does not assume equal variances and is a sensible default for independent groups.
- A significant t-test says the difference is unlikely to be zero; the effect size (Cohen’s d) and confidence interval say how big it is.
- APA format: t(48) = 2.31, p = .025, d = 0.65, 95% CI [0.73, 10.47].
What is a t-test?
A t-test is an inferential test that compares means. It asks whether the difference you observed (between two groups, two time points, or a sample and a benchmark) is large relative to the variability in your data. If it is, the p value is small and you reject the null hypothesis that the true difference is zero.
All three versions share one structure: t = (observed difference) / (standard error of that difference). A t of 2 means the difference is about twice as large as the noise you would expect from sampling alone. The name comes from the t distribution, introduced by William Gosset under the pen name “Student”, which allows for the extra uncertainty of estimating the standard deviation from a small sample.
Independent, paired or one-sample: which t-test?
| Test | Use when | Example | Degrees of freedom |
|---|---|---|---|
| One-sample t-test | Comparing one group’s mean with a known or target value | Do first-year students sleep less than the recommended 7 hours? | n − 1 |
| Independent-samples t-test (two-sample) | Comparing two separate groups | Do students taught with method A score higher than those taught with method B? | n₁ + n₂ − 2 (Student); adjusted, often non-integer (Welch) |
| Paired-samples t-test (dependent, matched-pairs or repeated-measures t-test) | The same people measured twice, or naturally matched pairs | Does anxiety drop from before to after a mindfulness course? | n − 1, where n is the number of pairs |
The key question is whether the two sets of scores are linked. If each score in one set has a natural partner in the other (same person, twin, matched case), use the paired test. Treating paired data as independent throws away information and usually makes it harder to detect a real effect. For three or more groups, move to ANOVA; see our guide to choosing a statistical test.
t-test formulas
One-sample:
t = (x̄ − μ₀) / (s / √n)
where μ₀ is the comparison value and s is the sample standard deviation.
Independent samples, equal variances assumed (Student):
t = (x̄₁ − x̄₂) / [ sₚ · √(1/n₁ + 1/n₂) ], with pooled SD sₚ = √{ [(n₁ − 1)s₁² + (n₂ − 1)s₂²] / (n₁ + n₂ − 2) }
Independent samples, unequal variances (Welch):
t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂), with degrees of freedom from the Welch–Satterthwaite approximation.
Paired samples: compute each person’s difference score d, then
t = d̄ / (s(d) / √n)
where d̄ is the mean difference and s(d) the standard deviation of the differences. A paired t-test is simply a one-sample t-test on the difference scores against zero.
Assumptions and requirements
- Continuous outcome measured on an interval or ratio scale (a multi-item scale score is usually fine).
- Independence of observations within groups, and between groups for the independent test. This comes from your design.
- Approximate normality of the outcome in each group (independent test) or of the difference scores (paired test). With about 30 or more per group the test is fairly robust to moderate skew; with small samples, check histograms and Q–Q plots.
- Equal variances (Student’s independent test only). Rather than relying on Levene’s test, many statisticians report Welch’s test by default; it loses very little when variances are equal and protects you when they are not.
- No extreme outliers that are data errors. Investigate before removing anything, and report what you did.
If normality is badly violated with a small sample, use the Mann–Whitney U test (independent) or the Wilcoxon signed-rank test (paired) instead.
Want a second pair of eyes? Stuck on which t-test to run or how to read the output? We can go through your data and explain every number. See statistics help.
Worked example: independent-samples t-test
A lecturer compares end-of-module scores for two seminar groups of 25 students. Group A used retrieval practice (M = 72.4, SD = 8.1); Group B re-read their notes (M = 66.8, SD = 9.0).
- Pooled SD: sₚ = √[(24 × 65.61 + 24 × 81.00) / 48] = √73.305 ≈ 8.56.
- Standard error of the difference: 8.56 × √(1/25 + 1/25) = 8.56 × 0.283 ≈ 2.42.
- t = (72.4 − 66.8) / 2.42 = 5.6 / 2.42 ≈ 2.31, with df = 25 + 25 − 2 = 48.
- Two-tailed p = .025, below α = .05.
- 95% CI for the difference: 5.6 ± 2.011 × 2.42 = [0.73, 10.47].
- Cohen’s d = 5.6 / 8.56 ≈ 0.65, a medium-to-large effect.
Welch’s version gives the same t here (the groups are equal in size) with df ≈ 47.5 and p = .025, so the conclusion does not depend on the equal-variance assumption.
Worked examples: paired and one-sample t-tests
Paired. Twelve participants complete an anxiety scale before and after an eight-week course. The mean reduction is d̄ = 3.5 points with s(d) = 4.2.
- Standard error = 4.2 / √12 = 1.212.
- t(11) = 3.5 / 1.212 ≈ 2.89, p = .015.
- 95% CI: 3.5 ± 2.201 × 1.212 = [0.83, 6.17].
- Effect size dz = 3.5 / 4.2 ≈ 0.83.
One-sample. Thirty-six first-year students average M = 6.62 hours of sleep (SD = 0.90), compared with a recommended 7 hours.
- Standard error = 0.90 / √36 = 0.15.
- t(35) = (6.62 − 7) / 0.15 ≈ −2.53, p = .016.
- 95% CI for the mean: 6.62 ± 2.030 × 0.15 = [6.32, 6.92] hours, which excludes 7.
- d = −0.38 / 0.90 ≈ −0.42.
How to read t-test output
Software output for an independent-samples test usually shows group statistics, a variance test, then two rows of results. Read it in this order:
- Group statistics: check n, means and SDs are what you expect. This catches coding errors.
- Which row: SPSS gives “Equal variances assumed” and “not assumed”; the second is Welch’s test. Decide in advance which you will report.
- t, df and Sig. (2-tailed): the test statistic, degrees of freedom and p value. SPSS prints “.000” for very small p; report this as p < .001.
- Mean difference and 95% CI: the estimated size of the effect and its plausible range.
- Effect size: recent SPSS versions print Cohen’s d; otherwise calculate it.
A significant test statistic tells you the data would be unlikely if the true difference were zero. It does not tell you the difference is large or important. That judgement comes from the effect size, the confidence interval and your field’s context, as discussed in our guide to hypothesis testing and p-values.
Common t-test mistakes
- Running several t-tests where one model is needed. With three or more groups, use ANOVA with corrected follow-up comparisons rather than every possible pair of t-tests.
- Using the independent test on paired data. Pre/post scores from the same participants need the paired test; the independent version ignores the correlation between the two measurements.
- Reporting “t = 2.31, p < .05” and nothing else. Without degrees of freedom, means, an effect size and a confidence interval, readers cannot judge the result.
- Mixing up effect sizes. For paired designs, say which version of Cohen’s d you used. dz (mean difference divided by the SD of differences) is often larger than d based on the average SD of the two time points.
- Calling a non-significant result “no difference”. Write “no statistically significant difference was found” and point to the confidence interval, which shows how large a difference the data still allow.
When groups are very unequal in size and variances differ, the Student test can be badly misleading in either direction, which is another reason Welch’s test is a safe default.
Reporting a t-test in APA style
Include the descriptive statistics, t with its degrees of freedom, the exact p value, an effect size and a confidence interval. Italicise statistical symbols and round to two decimals.
Students who used retrieval practice scored higher (M = 72.4, SD = 8.1) than students who re-read their notes (M = 66.8, SD = 9.0), t(48) = 2.31, p = .025, d = 0.65, 95% CI [0.73, 10.47].
Anxiety scores fell from before to after the course, with a mean reduction of 3.50 points (SD = 4.20), t(11) = 2.89, p = .015, dz = 0.83, 95% CI [0.83, 6.17].
If you used Welch’s test, report its adjusted degrees of freedom, for example t(47.48) = 2.31. State in your method section whether tests were one- or two-tailed. If you would like someone to check your t-tests before submission, our SPSS help and dissertation statistics help explain each step so you can defend it.