T-Test Calculator — One-Sample, Paired & Two-Sample
Paste your data and get the t-statistic, degrees of freedom, p-value, confidence interval, and a plain-English verdict in one place. Supports one-sample, paired, and independent two-sample tests (pooled Student's and Welch's), with every step of the working shown.
How it works
A t-test asks whether an observed difference between means is larger than you would expect from random sampling variation alone. Every version reduces to the same shape: a t-statisticequal to the difference you care about divided by its standard error, compared against the Student's t distribution for the right degrees of freedom. The formulas below follow the NIST/SEMATECH e-Handbook of Statistical Methods.
One-sample. To test a sample mean x̄ against a hypothesised value μ₀, compute the sample standard deviation s with the n − 1 denominator, then SE = s / √n and t = (x̄ − μ₀) / SE, with df = n − 1.
Paired. When each value in sample A is matched to one in sample B (before/after the same subject), take the differences dᵢ = aᵢ − bᵢ and run a one-sample test on them against zero: t = d̄ / (s_d / √n), df = n − 1. Pairing removes between-subject variation, which usually makes the test more sensitive.
Two-sample, pooled (Student's). For two independent groups with similar spread, pool the variances: s_p² = [(n₁−1)s₁² + (n₂−1)s₂²] / (n₁+n₂−2). Then SE = s_p · √(1/n₁ + 1/n₂), t = (x̄₁ − x̄₂) / SE, and df = n₁ + n₂ − 2.
Two-sample, Welch's. The default for independent groups, because it does not assume equal variances: SE = √(s₁²/n₁ + s₂²/n₂). The degrees of freedom use the Welch–Satterthwaite formula, which produces a fractional df between the two sample sizes and is shown to two decimals.
The p-valueis read from the Student's t distribution. This tool evaluates that distribution through the regularised incomplete beta function I_x(a, b) — the two-tailed p-value equals Idf/(df+t²)(df/2, ½) — rather than a rounded printed table, so every t and df resolve exactly to display precision. A one-tailed p-value is half of that, in the direction the data point. Each result is cross-checked by computing the p-value a second, independent way; the two agree to machine precision. The displayed values were validated against the NIST table of critical t-values.
Worked examples
Frequently asked questions
Sources & references
- NIST/SEMATECH e-Handbook §1.3.5.3 — Two-Sample t-Test for Equal Means (pooled & Welch)
- NIST/SEMATECH e-Handbook §1.3.5.2 — Confidence Limits / one-sample t statistic
- NIST/SEMATECH e-Handbook §1.3.6.7.2 — Critical Values of the Student's t Distribution
- Abramowitz & Stegun §26.7 — Student's t distribution (CDF via incomplete beta)
The formulas and the p-value engine on this page were last cross-checked against the NIST e-Handbook and critical-value table on 2026-06-11.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.