T-Test Calculator
One-sample and two-sample t-tests with t-statistic, p-value, and rejection regions.
t-distribution with observed |t| and critical region
Use a t-test to ask whether a mean differs from a hypothesised value (one-sample) or whether two group means differ (two-sample). The result tells you the t statistic, the degrees of freedom, the two-tailed p-value, and whether to reject the null at your chosen significance level.
One-sample, pooled two-sample, and Welch
One-sample t: tests H₀: μ = μ₀. t = (x̄ − μ₀) / (s/√n), df = n−1. Use when you have a single sample and a benchmark value.
Pooled two-sample t: tests H₀: μ₁ = μ₂ assuming equal variances. Uses the pooled SD sₚ. df = n₁ + n₂ − 2.
Welch's two-sample t: same hypothesis without assuming equal variances. SE = √(s₁²/n₁ + s₂²/n₂), df from the Satterthwaite approximation. Modern recommendation: default to Welch unless you've explicitly verified equal variances.
Assumptions
Independent observations within each group.
Approximately normal sampling distribution of the mean — automatic for n ≥ 30 by the CLT; check for skew/outliers in smaller samples.
Random sampling — or at least exchangeable conditions across groups.
Equal variances (pooled t only). Welch's t drops this assumption and is essentially always safe.
Worked example — battery life
Manufacturer claims a battery lasts 22 hours. You test 10 units and get a mean of 23.4 hours, s = 1.7.
t = (23.4 − 22) / (1.7 / √10) = 1.4 / 0.5376 ≈ 2.604. df = 9.
Two-tailed p ≈ 0.029 — significant at α = 0.05. The sample provides evidence the true mean differs from 22 (likely higher).
The 95% CI on the mean is 23.4 ± t₀.₉₇₅,₉ · 0.5376 ≈ 23.4 ± 1.216 → (22.2, 24.6), consistent with rejecting 22.
Reading the p-value
The p-value is the probability, under H₀, of seeing a t at least as extreme as the one observed.
Small p (≤ α): reject H₀. The observed difference is unlikely under the null.
Large p: fail to reject H₀. The data don't refute the null — but they don't prove it either; absence of evidence is not evidence of absence.
Always report the effect size alongside p. A statistically significant difference of 0.2 hours of battery life is probably not practically meaningful.
Common pitfalls
Multiple testing: running 20 t-tests at α = 0.05 will produce one false positive on average. Use a correction (Bonferroni, Holm, FDR).
Using pooled t when the variances obviously differ. Welch is the safe default.
Paired data treated as independent. If each subject is measured twice, use a paired t-test (or one-sample t on the differences).
Reporting only p with no CI. The interval shows the magnitude of the effect, which is what decisions need.
Frequently asked questions
When should I prefer a non-parametric test?
When n is small AND the data is strongly skewed or ordinal. Mann-Whitney U replaces two-sample t; Wilcoxon signed-rank replaces paired t.
Why two-tailed by default?
Two-tailed asks 'is there any difference?', the question almost everyone actually has. Use one-tailed only when you've pre-committed to a direction.
How big a sample do I need?
Depends on the effect size and desired power. Cohen's d = 0.5, α = 0.05, 80% power needs about 64 per group. See our sample-size calculator.
Does this handle paired data?
Use the one-sample mode on the within-subject differences (post − pre). That's mathematically identical to a paired t-test.
More in Statistics & Probability
From z-scores and confidence intervals to t-tests, chi-square, correlation, regression, and the binomial/Poisson distributions — textbook-grade tools with worked examples.
- Z-Score Calculator
Convert a value to a z-score, percentile, and tail probabilities using the standard normal distribution.
- Normal Distribution Calculator
Find P(X<x), P(X>x), and between-range probabilities for any normal distribution with mean μ and SD σ.
- Binomial Distribution Calculator
Compute P(X=k), cumulative probabilities, mean, and variance for n trials with success probability p.
- Poisson Distribution Calculator
Model rare events with rate λ — get P(X=k), cumulative probability, mean, and variance.
- Permutations & Combinations Calculator
Compute nPr (order matters) and nCr (order doesn't) with full counting-principle explanation.
- Bayes' Theorem Calculator
Update prior beliefs with new evidence using Bayes' rule — posterior probability with tree diagram.
Related calculators
Browse all Education →Chi-Square Calculator
Goodness-of-fit and independence tests with expected counts, chi-square statistic, and p-value.
Standard Deviation Calculator
Mean, median, mode, range, sample/population standard deviation, variance, quartiles, IQR, and SEM for any list of numbers.
Scientific Calculator
Free online scientific calculator with trig, logs, exponents, square roots, parentheses, and constants pi and e.
Cone Volume Calculator
Volume, slant height, and surface area of a cone from base radius and height using V = (1/3) × π × r² × h.
Percentage Increase / Decrease Calculator
Percent change between any old and new value, with the formula and direction shown.
Bayes' Theorem Calculator
Update prior beliefs with new evidence using Bayes' rule — posterior probability with tree diagram.
Confidence Interval Calculator
Compute z or t confidence intervals for a mean, with margin of error breakdown.
Sample Size Calculator
Required sample size to estimate a proportion or mean at a chosen confidence level and margin of error.