T-Test Calculator
Run a one-sample, two-sample (Welch's or pooled) or paired t-test from raw data or from means, standard deviations and sample sizes. You get the t statistic, degrees of freedom, p-value, confidence interval, effect size and a clear reject / fail-to-reject decision with every step shown.
Separate values with spaces, commas or new lines. For paired tests: the 'before' values.
For paired tests: the 'after' values, in the same order.
Usually 0 for two-sample and paired tests
How to use the T-Test Calculator
- Pick the test: one-sample (compare a mean with a value), two-sample (two independent groups) or paired (before/after on the same subjects).
- Choose the input: paste raw data, or enter the mean, standard deviation and sample size of each group.
- Set the hypothesis: the hypothesized mean or difference μ₀ (usually 0), the tail direction and the significance level α.
- Read the results: t, degrees of freedom, p-value, confidence interval and the decision.
- Check the working in the steps and the shaded t-distribution chart, then copy the results.
T-test formulas
| Test | t statistic | Degrees of freedom |
|---|---|---|
| One-sample | t = (x̄ − μ₀) ÷ (s ÷ √n) | n − 1 |
| Paired | t = (d̄ − μ₀) ÷ (sd ÷ √n) | n − 1 (pairs) |
| Two-sample, pooled | t = (x̄₁ − x̄₂) ÷ (sp √(1/n₁ + 1/n₂)), sp² = ((n₁−1)s₁² + (n₂−1)s₂²) ÷ (n₁+n₂−2) | n₁ + n₂ − 2 |
| Two-sample, Welch | t = (x̄₁ − x̄₂) ÷ √(s₁²/n₁ + s₂²/n₂) | (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1)] |
The confidence interval for the mean or difference is estimate ± t* × SE, where t* is the critical value with area α/2 in each tail. Here s is the sample standard deviation (dividing by n − 1).
Critical t values (two-tailed)
| df | α = 0.10 | α = 0.05 | α = 0.01 |
|---|---|---|---|
| 1 | 6.314 | 12.706 | 63.657 |
| 2 | 2.920 | 4.303 | 9.925 |
| 5 | 2.015 | 2.571 | 4.032 |
| 10 | 1.812 | 2.228 | 3.169 |
| 15 | 1.753 | 2.131 | 2.947 |
| 20 | 1.725 | 2.086 | 2.845 |
| 30 | 1.697 | 2.042 | 2.750 |
| 60 | 1.671 | 2.000 | 2.660 |
| 120 | 1.658 | 1.980 | 2.617 |
| ∞ (normal) | 1.645 | 1.960 | 2.576 |
For a one-tailed test at level α, use the two-tailed column for 2α (for example, the one-tailed 0.05 value equals the two-tailed 0.10 value).
Frequently asked questions
Which t-test should I use?
Use a one-sample t-test to compare one group's mean with a known or target value, an independent two-sample t-test to compare the means of two separate groups, and a paired t-test when each value in one sample is matched with a value in the other, such as before-and-after measurements on the same people.
What is the difference between Welch's t-test and the pooled t-test?
The pooled (Student's) t-test assumes both groups have the same population variance and uses df = n₁ + n₂ − 2. Welch's t-test does not assume equal variances and uses the Welch–Satterthwaite degrees of freedom. Welch's test is the safer default and loses very little power when the variances really are equal.
How is the p-value of a t-test calculated?
The p-value is the probability, under the null hypothesis, of a t statistic at least as extreme as yours. For a two-tailed test it is 2 × P(T ≥ |t|) using the t distribution with the test's degrees of freedom. This calculator computes it from the incomplete beta function, so no t-table is needed.
What does it mean if the p-value is below 0.05?
If p is smaller than your significance level α (often 0.05), you reject the null hypothesis: a difference this large would be unlikely if the true difference were zero. It does not tell you the difference is large or important; check the confidence interval and effect size for that.
What are the assumptions of a t-test?
Observations should be independent, measured on a numeric scale, and come from roughly normally distributed populations (or the sample should be large enough, often n ≥ 30 per group, for the central limit theorem to help). The pooled two-sample test also assumes equal variances. Paired tests need the differences to be roughly normal.
What is Cohen's d?
Cohen's d is the difference in means divided by a standard deviation, a scale-free measure of effect size. As a rough guide, 0.2 is a small effect, 0.5 a medium effect and 0.8 a large effect. For the two-sample test this calculator divides by the pooled standard deviation.
Should I use a one-tailed or two-tailed test?
Use a two-tailed test unless you decided before seeing the data that only one direction matters. A one-tailed test puts all of α in one tail, so it finds significance in that direction more easily but can never detect an effect in the other direction.