T-Test Calculator

Run a one-sample, two-sample independent or paired t-test — from raw data or summary stats — and get the t-statistic, degrees of freedom, p-value, critical value and a plain-language conclusion, with a shaded t-distribution diagram.

Sample A
Sample B

T-test explained, step by step

A t-test asks whether an observed difference in means is bigger than random sampling would produce. Each card below covers one variant this calculator runs and shows the formula that drives it.

1. One-sample t-test — mean vs a reference

Use this when you have one sample and want to test whether its mean differs from a specific reference value μ₀. The calculator estimates the standard error from the sample SD and divides the observed gap by it.

t = (x̄ − μ₀) / (s / √n)   df
= n − 1
sample mean·ssample SD·nsample size
Example
Given
x̄ = 52
s = 6
n = 25, μ₀
= 50
Substitute
t = (52 − 50) / (6/√25)
= 2 / 1.2
Answer
t ≈ 1.67
df = 24

2. Two-sample — Welch's (default) vs Student's pooled

Two independent groups: is one mean bigger than the other? Welch's does not assume equal variances and is the safer default. Student's pools the two SDs into one and needs the equal-variance assumption to hold.

Welch: t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂) Pooled: t = (x̄₁ − x̄₂) / √(sₚ² · (1/n₁ + 1/n₂))
sₚ²pooled variance·dfWelch–Satterthwaite (fractional) or n₁+n₂−2
Example
Given
x̄₁=84.6
s₁=4.77
n₁=5 · x̄₂
=77.4
s₂=3.97
n₂=5
Substitute
SE = √(22.8/5 + 15.8/5)
= √7.72
Answer
t ≈ 2.59
df ≈ 7.75

3. Paired t-test — matched pairs

For before/after on the same subjects, twin studies or any matched design, compute the per-pair difference d = x₁ − x₂ and run a one-sample test on those differences against 0. Removing between-subject noise gives extra power.

t = d̄ / (s_d / √n)   df
= n − 1
mean of the pairwise differences·s_dSD of the differences·nnumber of pairs
Example
Given
5 pairs
d̄ = 3.2
s_d = 1.8
Substitute
t = 3.2 / (1.8/√5)
= 3.2 / 0.805
Answer
t ≈ 3.98
df = 4

4. From t to p-value and decision

The p-value comes from the Student t-distribution with the reported df. Compare p to α (usually 0.05): p ≤ α rejects the null. A large p only means the current sample lacks evidence — it never proves the null.

p = 2·(1 − F_t(|t|
df)) for two-tailed · reject if p ≤ α
Example
Given
t ≈ 2.59
df ≈ 7.75
α = 0.05
Substitute
two-tailed p from t CDF
Answer
p ≈ 0.033 → reject H₀

Features of this calculator

  • Three tests on one page — one-sample, two-sample independent, and paired — with the same clean output structure.
  • Accept either raw data (paste from a spreadsheet — supports commas, spaces, tabs, semicolons and mixed line endings) or already-computed summary statistics (mean, SD, n).
  • Welch's t-test is the default for two-sample tests, with an explicit toggle for Student's pooled (equal-variance) t-test when you need it.
  • Exact p-values from the Student t-distribution CDF via the regularised incomplete beta function — no crude table lookups.
  • Shaded t-distribution diagram showing the rejection region and where your observed t falls.
  • Full step-by-step working — pooled or Welch–Satterthwaite degrees of freedom, standard error, t and p — visible with one click.
  • Copy the result panel as text or download it as a PNG.

Frequently asked questions

+One-tailed or two-tailed — which should I choose?
Two-tailed by default. Use one-tailed only when you have a genuine directional hypothesis specified before collecting the data (for example, 'the new drug can only help, not hurt'). Switching to one-tailed after seeing the data inflates the false-positive rate.
+What sample size do I need?
There is no universal minimum. With well-behaved (roughly normal) data, n ≥ 10 per group already works reasonably. For small samples the results are more sensitive to non-normality, so consider checking the data visually first — or use a non-parametric alternative.
+Can I use the t-test if my data are not exactly normal?
The t-test is fairly robust to mild non-normality, especially when both groups have similar sample sizes and the samples are not tiny. It is less robust with small, heavily skewed samples — where a permutation test or a Mann–Whitney U test is safer.
+What does 'degrees of freedom' really mean?
Loosely, df is the number of independent pieces of information you have left after estimating the parameters you need for the test. For one sample of size n we estimate the mean, leaving n − 1 free deviations. Welch's t-test uses a fractional df because it combines two variance estimates rather than pooling them.
+Should I report effect size along with the t-test?
Yes — a p-value tells you whether an effect is detectable, not how big it is. Cohen's d is the standard companion effect size for a two-sample t-test: (x̄₁ − x̄₂) divided by the pooled standard deviation.

Related calculators