Professor Digitalfor studentsSign in

t-Test Explained: Independent, Paired and One-Sample, With Examples

Reviewed by Prof. Dr. Alexander Holtermann · Updated 16 October 2026 · 6 min read

A t-test checks whether two means differ significantly: two independent groups, two paired measurements, or one mean against a fixed value.

Key takeaways

  • Three variants: the independent-samples t-test (two separate groups), the paired-samples t-test (same people measured twice) and the one-sample t-test (one mean against a known value).
  • Assumptions: a metric outcome, independent observations, and approximately normal values per group (or differences); from about 30 per group the test is robust.
  • For independent groups, use Welch’s t-test by default. It does not assume equal variances and loses almost no power when variances are equal.
  • APA style: t(df) = value, p = value, d = value, for example t(13.46) = 3.42, p = .004, d = 1.71.
  • For three or more groups use ANOVA; for small, clearly non-normal samples use the Mann-Whitney U test or the Wilcoxon signed-rank test.

What does a t-test do?

The t-test (Student’s t-test, after the pen name of W. S. Gosset) checks whether a difference between means is larger than you would expect from random sampling alone. The null hypothesis states that the population means are equal.

The test statistic relates the observed difference to its standard error:

t = difference between means / standard error of the difference

A larger difference, less variability and a larger sample all make t larger and the p-value smaller. The t-value is compared with a t-distribution whose shape depends on the degrees of freedom (df), roughly the sample size minus the number of estimated means.

VariantQuestionExampledf
Independent samplesDo two separate groups differ?Students with vs. without a study plann₁ + n₂ − 2 (Student) or Welch estimate
Paired samplesDoes a value change within the same people?Exam anxiety before vs. after a trainingn − 1 (pairs)
One sampleDoes a mean differ from a fixed value?Study hours vs. the 20 planned hoursn − 1

Assumptions of the t-test

Check these points before you run the test and mention briefly in your methods section how you checked them.

  • Level of measurement: the dependent variable is metric (interval or ratio), or a scale score from several Likert items.
  • Independence: each person contributes one value per group; in the paired test, the pairs are independent of each other.
  • Normality: values in each group (in the paired test: the differences) are approximately normal. From about 30 per group the test is robust; check small samples with a Q-Q plot and Shapiro-Wilk.
  • Equal variances: only required for Student’s classic t-test (check with Levene’s test). Welch’s t-test does not need it.
  • No extreme outliers: single extreme values can distort means and standard deviations.

Worked example: independent-samples t-test

You compare exam points of eight students with a study plan and eight without one.

With plan: 14, 16, 15, 18, 17, 19, 16, 17 → M = 16.50, SD = 1.60 Without plan: 13, 14, 12, 15, 16, 13, 14, 15 → M = 14.00, SD = 1.31

Welch’s test estimates the standard error from both variances separately: SE = √(s₁² / n₁ + s₂² / n₂). The degrees of freedom come from the Welch-Satterthwaite formula and are usually not a whole number.

StepCalculationResult
Mean difference16.50 − 14.002.50
Standard error√(2.571 / 8 + 1.714 / 8)0.73
t-value2.50 / 0.733.42
Degrees of freedom (Welch)Welch-Satterthwaite13.46
p-value (two-sided)t-distribution.004
95% CI of the difference2.50 ± 2.153 × 0.73[0.92, 4.08]
Cohen’s d2.50 / 1.46 (pooled SD)1.71

Worked example: paired-samples t-test

Six students fill in an exam-anxiety questionnaire before and after a relaxation training. Because the same people are measured twice, you analyze the difference for each person. This removes stable differences between people and often makes the paired test much more powerful than a group comparison.

Formula: t = D̄ / (s_D / √n) with df = n − 1.

StudentBeforeAfterDifference
122184
225214
319172
430246
527252
624195
Mean24.5020.673.83

Worked example: one-sample t-test

Here you compare a sample mean with a known or specified value μ₀, such as a norm, a manufacturer’s claim or the workload stated in the course handbook. Formula: t = (M − μ₀) / (s / √n) with df = n − 1; effect size d = (M − μ₀) / s.

Welch’s t-test or Student’s t-test?

Student’s classic t-test assumes equal variances in both groups. The traditional recipe was to run Levene’s test first and pick the t-test depending on its result. Many methodologists now recommend always using Welch’s t-test: with equal variances it gives practically the same result, and with unequal variances, especially combined with unequal group sizes, it protects you from wrong p-values. The two-step procedure with a preliminary test also distorts error rates.

In your methods section you can simply write: “Because of its robustness to unequal variances, Welch’s t-test was used.” Report the Welch degrees of freedom with two decimals. Many programs, including R’s default t.test(), already use Welch.

How to report a t-test in APA style

A complete report contains the means and standard deviations of both groups, the test statistic with degrees of freedom, the exact p-value, an effect size and ideally the confidence interval of the difference. In the final document, t, p, d, M and SD are italicized.

Running a t-test in SPSS, R, JASP or Excel

Every statistics program gives the same t, df and p for the same variant of the test. Watch the defaults: R uses Welch’s test unless you set var.equal = TRUE, while SPSS prints both rows. A full walkthrough with output is in our article on the t-test in SPSS.

ProgramHow to run it
SPSSAnalyze → Compare Means → Independent-Samples / Paired-Samples / One-Sample T Test
Rt.test(score ~ group, data = df); paired: t.test(x, y, paired = TRUE)
JASP / jamoviT-Tests → Independent Samples, Paired Samples or One Sample T-Test
ExcelFunction T.TEST(range1, range2, tails, type) or Analysis ToolPak (gives no effect size)

Frequently asked questions

When should I use a t-test?

When you compare exactly two means of a metric variable: two groups, two time points, or one mean against a fixed value. For three or more groups use ANOVA.

What is the difference between a paired and an independent t-test?

In the independent t-test the values come from different people. In the paired t-test both values come from the same people or from matched pairs, for example before and after an intervention.

What if my data are not normally distributed?

From about 30 people per group the t-test is robust. With small groups and clear violations, use the Mann-Whitney U test (independent) or the Wilcoxon signed-rank test (paired).

What are the degrees of freedom in a t-test?

For Student’s t-test n₁ + n₂ − 2; for the paired and the one-sample test n − 1. For Welch’s test they are estimated from the variances and are usually not a whole number.

Which t-test should I use for unequal group sizes?

Welch’s t-test. Unequal variances distort the classic t-test most when the groups also differ in size.

Sources and further reading

  • Howell, D. C. (2013). Statistical Methods for Psychology (8th ed.). Wadsworth Cengage Learning.
  • Gravetter, F. J., & Wallnau, L. B. (2017). Statistics for the Behavioral Sciences (10th ed.). Cengage.
  • Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences (2nd ed.). Lawrence Erlbaum.

Your university’s examination regulations and style guide always take precedence.

Related articles