t-Test Calculator (One-Sample, Two-Sample Welch or Pooled, and Paired)
Run a one-sample, two-sample (Welch or pooled Student) or paired t-test from pasted data or summary statistics — t, degrees of freedom, one- or two-tailed p-value, confidence interval, effect size, variance and normality checks, and every step.
How it works
One-sample: t = (x̄ − μ₀) ÷ (s ÷ √n), df = n − 1 · Welch: t = (x̄₁ − x̄₂ − d₀) ÷ √(s₁²/n₁ + s₂²/n₂), df = (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1)] · Pooled: s_p² = [(n₁−1)s₁² + (n₂−1)s₂²] ÷ (n₁+n₂−2), t = (x̄₁ − x̄₂ − d₀) ÷ (s_p √(1/n₁ + 1/n₂)), df = n₁+n₂−2 · Paired: t = (d̄ − d₀) ÷ (s_d ÷ √n) · CI = estimate ± t* × SE · Cohen’s d = difference ÷ SD
A t-test asks whether an observed difference in means is larger than you would expect from sampling noise alone. The one-sample test compares a sample mean with a fixed reference value μ₀. The two-sample test compares two independent groups: Welch’s version does not assume equal variances and estimates the degrees of freedom with the Welch–Satterthwaite formula, while Student’s pooled version assumes equal variances and uses n₁ + n₂ − 2 degrees of freedom. The paired test works on the within-subject differences when the same people are measured twice. Paste raw numbers (commas, spaces or a spreadsheet column) or enter the means, standard deviations and sample sizes. Choose a two-tailed test for any difference or a one-tailed test when only one direction matters, and the significance level α. The calculator reports t, the degrees of freedom, the exact p-value from the Student t distribution (via the regularized incomplete beta function — the same values SciPy gives), the critical value, a confidence interval at 1 − α, Cohen’s d (and Hedges’ g for two groups), and checks of the assumptions: an F test and Levene’s test for equal variances, and a Shapiro–Wilk normality test for raw data. For two groups, a table shows Welch and pooled results side by side, and the full worked steps use your numbers.
Worked example
For the sample 5.1, 4.9, 5.2, 5.0, 4.8, 5.3 tested against μ₀ = 5: the mean is 5.05 and the sample standard deviation is 0.1871, so the standard error is 0.1871 ÷ √6 = 0.07638. Then t = (5.05 − 5) ÷ 0.07638 = 0.6547 on 5 degrees of freedom, giving a two-tailed p-value of 0.5416 — not significant at α = 0.05, and the 95% confidence interval for the mean, 4.8537 to 5.2463, contains 5. For two groups, 5.1, 4.9, 5.2, 5.0, 4.8 against 5.5, 5.7, 5.4, 5.9, 5.6 gives a mean difference of −0.62; Welch’s t = −5.5678 on 7.71 df (p = 0.000603, 95% CI −0.8785 to −0.3615), and the pooled test gives the same t on 8 df (p = 0.00053). Cohen’s d with the pooled SD is −3.52, a very large effect.
Sources: Student's t-test — Wikipedia · NIST/SEMATECH e-Handbook — two-sample t-test for equal means · Welch (1947), The generalization of “Student’s” problem when several different population variances are involved, Biometrika 34:28–35
Frequently asked questions
When should I use a one-sample, two-sample or paired t-test?
One-sample: you compare one group’s mean with a known or target value (is the mean fill weight 5 g?). Two-sample: two separate, independent groups (treatment vs control). Paired: the same subjects measured twice, or matched pairs (before vs after) — it analyses the differences and is more powerful when measurements are linked.
Welch or pooled Student t-test?
Welch’s test is the safer default: it stays accurate when the two groups have different variances or sizes, and loses almost nothing when the variances are equal. The pooled test assumes equal variances; it is fine when the SDs are similar and the group sizes are close. The calculator shows both, plus an F test and Levene’s test of equal variances.
What does the p-value mean?
It is the probability, if the null hypothesis (no difference) were true, of getting a t statistic at least as extreme as yours — in either direction for a two-tailed test, or in the chosen direction for a one-tailed test. A p-value below α (usually 0.05) is called statistically significant.
Can I run the test with only means and standard deviations?
Yes. Choose a "from mean, SD and n" option and type the summary statistics. The results are identical to raw data with the same mean, SD and size, except that the normality and Levene checks need the raw values. Make sure you enter the standard deviation, not the standard error (SE = SD ÷ √n).
Should I use a one-tailed or a two-tailed test?
Use two-tailed unless you decided before seeing the data that only one direction matters. A one-tailed p-value is half the two-tailed one when the effect goes the predicted way, so choosing it after looking at the data inflates false positives.
Does a significant t-test prove the effect is important?
No. Significance only says the difference is unlikely to be pure chance. With a large sample even a tiny difference can be significant, so look at the mean difference, its confidence interval and the effect size (Cohen’s d: about 0.2 small, 0.5 medium, 0.8 large).
How do I report the result?
Give the means and SDs, t with its degrees of freedom, the p-value, the confidence interval of the difference and an effect size — for example: Welch’s t(7.71) = −5.57, p < .001, mean difference −0.62 (95% CI −0.88 to −0.36), d = −3.52.
Related calculators
For education — check the test assumptions (independence, sample size, distribution) before drawing conclusions from a p-value.