T-Test Calculator
One-sample and two-sample t-tests with t-statistic, degrees of freedom, and p-value.
df = 8.76 · two-tailed p = 0.0026
A one-sample t-test is t = (x̄ − μ₀) ÷ (s ÷ √n). For a sample mean of 52 against μ₀ = 50 with s = 4 and n = 16, the standard error is 1, so t = 2.0 on 15 df — below the 2.131 critical value, so it’s not significant at 0.05 (p ≈ 0.064).
Comparing means
A t-test asks whether a difference in means is larger than you’d expect from random sampling alone. It divides the observed difference by its standard error, giving a t-statistic: the bigger the t, the less likely the gap is pure chance. Use a one-sample test to compare one group against a known value, and a two-sample test to compare two independent groups.
one-sample t; the denominator s ÷ √n is the standard error
Worked example
One-sample test: sample mean 52, hypothesized μ₀ = 50, sample SD 4, n = 16.
- 1 Compute the standard error. SE = s ÷ √n = 4 ÷ √16 = 4 ÷ 4 = 1.
- 2 Form the t-statistic. t = (52 − 50) ÷ 1 = 2.0, with df = n − 1 = 15.
- 3 Compare to the critical value. At df = 15, the two-tailed 0.05 critical t is 2.131. Since 2.0 < 2.131, the result is not significant (p ≈ 0.064).
Two-tailed critical t-values (α = 0.05)
Reject the null when |t| exceeds the value for your degrees of freedom.
| df | Critical t | Note |
|---|---|---|
| 5 | 2.571 | small sample |
| 10 | 2.228 | |
| 15 | 2.131 | example above |
| 30 | 2.042 | |
| ∞ | 1.960 | converges to the z-value |
Choosing the test and reading the result
Why Welch’s test. The two-sample mode uses Welch’s t-test, which does not assume the two groups share the same variance. It is the safer default and reduces to Student’s t-test when variances and sample sizes are equal.
One-tailed or two-tailed. This reports a two-tailed p-value, testing for a difference in either direction. Halve it for a one-tailed test, but only if you predicted the direction before collecting data.
Assumptions. The t-test assumes roughly normal data (or a large enough sample for the means to be normal) and independent observations. It is fairly robust to mild non-normality but sensitive to strong outliers.
Paired data. For before/after measurements on the same subjects, don’t use the two-sample test — run a one-sample test on the per-subject differences against μ₀ = 0.