T-Test Calculator
Is That Difference Real, or Just Noise?
Whenever you compare a sample mean against a target, or compare two groups' means against each other, the t-test is the standard tool for deciding whether the difference you're seeing is large relative to the natural variability in the data — or small enough that it could plausibly be chance. This calculator handles all three common variants: one-sample, two-sample (Welch's), and paired.
The Formulas
Two-sample (Welch's): t = (x̄1 − x̄2) ÷ √(s1²÷n1 + s2²÷n2)
Paired: t = d̄ ÷ (s_d ÷ √n)
The two-sample version uses Welch's formula, which does not assume the two groups have equal variance — a safer default than the classic pooled-variance t-test. The paired version works on the differences between matched observations (before/after measurements on the same subject, for example).
Worked Example: One-Sample T-Test
Testing whether a group of 8 measured heights (in cm) differs from a hypothesized population mean of 170:
| Sample mean | t-statistic | df | Two-tailed p-value |
|---|---|---|---|
| 172.5 | 1.410 | 7 | 0.2013 |
With p = 0.2013, well above 0.05, there isn't enough evidence in this sample to conclude the group's true mean differs from 170.
Critical T-Values (Two-Tailed, α = 0.05)
| df | t critical |
|---|---|
| 5 | 2.571 |
| 10 | 2.228 |
| 15 | 2.131 |
| 20 | 2.086 |
| 30 | 2.042 |
| 60 | 2.000 |
| 120 | 1.980 |
Where This Matters
- Clinical trials — comparing a treatment group's outcomes against a control group or a benchmark value.
- A/B testing — testing whether a metric genuinely differs between two variants.
- Before/after studies — the paired t-test is the standard tool for measuring change within the same subjects over time.
- Manufacturing — testing whether a process's average output has shifted from a target specification.
How to Use This Calculator
- Choose One-Sample, Two-Sample (Welch's), or Paired from the dropdown.
- For one-sample: enter your values and the hypothesized mean.
- For two-sample or paired: enter both groups' comma-separated values.
- Select Calculate to get the t-statistic, degrees of freedom, and two-tailed p-value.
Related Calculations
To compare more than two group means at once, use the ANOVA Calculator. To check whether the two groups' variability is comparable first, see the F-Test Calculator.