T-Test Calculator
Run a one-sample, two-sample (independent), or paired t-test. Get the t statistic, degrees of freedom, p-value, critical value, and a clear reject / fail-to-reject decision — with full step-by-step working.
Group 1
Group 2
Enter one pair per line, separated by a comma or space (e.g. before, after). The calculator computes each difference automatically, then d̄, sd, and n.
One-Sample: Comparing one sample's mean to a known or hypothesized value (e.g., "Is the average box weight different from the labeled 500g?").
Two-Sample (Independent): Comparing the means of two separate, unrelated groups (e.g., "Do Group A and Group B test scores differ?"). Use Pooled if variances are similar; use Welch's if sample sizes or variances differ noticeably (Welch's is the safer default).
Paired: Comparing two related measurements on the same subjects (e.g., "before vs after" or "left foot vs right foot").
Test Results
—
—
Tests whether a sample mean differs from a known or hypothesized population mean μ₀. The denominator s/√n is the standard error of the mean — it scales the difference by how much sample means naturally vary.
t = (x̄ − μ₀) / (s/√n) | df = n − 1
Assumes both groups share a common population variance, combined into a single pooled estimate sp².
sp² = ((n₁−1)s₁² + (n₂−1)s₂²) / (n₁+n₂−2)
t = (x̄₁−x̄₂) / √(sp²(1/n₁+1/n₂)) | df = n₁+n₂−2
Does not assume equal variances. Degrees of freedom are computed via the Welch-Satterthwaite equation and are often non-integer.
df = (s₁²/n₁ + s₂²/n₂)² / [ (s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1) ]
Reduces two related measurements to a single set of differences, then runs a one-sample t-test on those differences against a hypothesized mean of 0.
t = d̄ / (sd/√n) | df = n − 1
Degrees of freedom determine how "fat-tailed" the t-distribution is. Low df → heavier tails → larger critical values needed for significance. As df grows, the t-distribution converges to the standard normal (z) distribution.
The p-value is the probability of observing a t statistic this extreme (or more) if the null hypothesis were actually true. Small p-values are evidence against the null hypothesis.
An equivalent decision rule to the p-value method: reject the null hypothesis if your computed t-statistic falls beyond the critical value(s) for your chosen α and tail type. Compare your t-statistic directly using the Critical Value Calculator.
Two-tailed tests split α across both tails (α/2 each) and detect a difference in either direction. One-tailed tests place all of α in a single tail and only detect a difference in the pre-specified direction.
Statistical significance (p-value) tells you whether a difference likely exists; effect size tells you how large that difference is in practical terms. Cohen's d of 0.2/0.5/0.8 are conventionally small/medium/large.
T-tests assume: (1) the sampled data are approximately normally distributed (or n is large enough for the Central Limit Theorem to apply), (2) observations are independent (except paired differences, which must themselves be independent across pairs), and (3) data are measured on an interval/ratio scale.
Click any row to load that degrees of freedom into the One-Sample calculator (n = df + 1). Search by df.
| df | α=0.10 (one-tail) | α=0.05 (one-tail) | α=0.025 (one-tail) | α=0.05 (two-tail) | α=0.01 (two-tail) |
|---|
What Is a T-Test?
This t-test calculator determines whether an observed difference — between a sample and a known value, between two groups, or between paired measurements — is statistically significant or could plausibly be explained by random chance alone. A t-test is used specifically when the population standard deviation is unknown and must be estimated from the sample itself, which introduces extra uncertainty that the t-distribution accounts for (unlike the normal/z-distribution).
Every t-test compares a calculated t statistic against a reference distribution to produce a p-value — the probability of seeing a result this extreme if there truly were no effect. If that probability is small enough (below your chosen significance level α, commonly 0.05), you have statistically significant evidence of a real difference.
T Statistic Formula Explained
Every version of the t statistic follows the same structural idea: a signal (the difference you're measuring) divided by noise (how much that difference would naturally vary from sample to sample).
| Test Type | t Formula | df |
|---|---|---|
| One-Sample | (x̄−μ₀)/(s/√n) | n−1 |
| Two-Sample (Pooled) | (x̄₁−x̄₂)/√(sp²(1/n₁+1/n₂)) | n₁+n₂−2 |
| Two-Sample (Welch's) | (x̄₁−x̄₂)/√(s₁²/n₁+s₂²/n₂) | Welch-Satterthwaite |
| Paired | d̄/(sd/√n) | n−1 |
The denominator of every t-test formula (s/√n, √(sp²(1/n₁+1/n₂)), etc.) is the standard error of the estimate. If you need to compute or understand a standard error in isolation, use the Standard Error Calculator.
One-Sample vs Two-Sample vs Paired T-Test
- One-Sample t-test: Compares a single sample mean to a known/hypothesized value. Example: "Is the average delivery time different from the advertised 30 minutes?"
- Two-Sample (independent samples) t-test: Compares the means of two separate, unrelated groups of subjects. Example: "Do students taught with Method A score differently than those taught with Method B?"
- Paired t-test: Compares two related measurements taken on the same subjects. Example: "Did blood pressure change after treatment, measured on the same patients before and after?"
Choosing the wrong test type is one of the most common statistics errors. If your two sets of numbers came from the same subjects (matched pairs, before/after, left/right), always use the paired test — it is more powerful because it removes subject-to-subject variability from the comparison.
How to Find t in Statistics — Step-by-Step
- Step 1 — State the hypotheses: H₀ (null: no difference) and H₁ (alternative: there is a difference).
- Step 2 — Choose α and tail type: Commonly α=0.05, two-tailed unless you have a directional prediction.
- Step 3 — Calculate the t statistic: Use the formula matching your test type (see table above).
- Step 4 — Find degrees of freedom: n−1, n₁+n₂−2, or the Welch-Satterthwaite value.
- Step 5 — Find the p-value or critical value: Either look up/compute the p-value for your t and df, or find the critical t-value for your α and df.
- Step 6 — Make a decision: Reject H₀ if p < α (equivalently, if |t| exceeds the critical value).
Reading the p-Value
The p-value answers: "If the null hypothesis were true, how likely is it I'd see a t-statistic this extreme just by random sampling variation?" A small p-value means your observed result would be unusual under the null hypothesis — evidence to reject it.
| p-value | Interpretation |
|---|---|
| p < 0.01 | Very strong evidence against H₀ |
| 0.01 ≤ p < 0.05 | Strong evidence against H₀ (typical "significant" threshold) |
| 0.05 ≤ p < 0.10 | Weak/marginal evidence against H₀ |
| p ≥ 0.10 | Little to no evidence against H₀ |
Important: A p-value is not the probability that H₀ is true, and failing to reject H₀ does not prove H₀ is true — it simply means you don't have sufficient evidence to reject it.
One-Tailed vs Two-Tailed Tests
A two-tailed test asks "is there any difference (in either direction)?" and splits α across both tails of the distribution (α/2 in each tail). A one-tailed test asks a directional question — "is the sample mean specifically greater than μ₀?" (right-tailed) or "specifically less than μ₀?" (left-tailed) — and places all of α in a single tail.
Only use a one-tailed test when you have a strong, pre-registered directional hypothesis before seeing the data. Choosing the tail direction after looking at your results inflates your false-positive rate and is considered poor statistical practice.
Worked Examples
1. One-Sample: Coffee Shop Wait Times
A café claims average wait time is 5 minutes. A sample of n=20 customers has x̄=5.6 min, s=1.2 min. Test at α=0.05, two-tailed.
- t = (5.6−5)/(1.2/√20) = 0.6/0.2683 ≈ 2.236
- df = 20−1 = 19
- p ≈ 0.0378 (two-tailed)
- Decision: p < 0.05 → Reject H₀. Wait time is significantly different from 5 minutes.
2. One-Sample: One-Tailed Quality Control
A factory wants to confirm rods average more than 50cm. Sample: x̄=51.2, s=3, n=30. Right-tailed test, α=0.05.
- t = (51.2−50)/(3/√30) = 1.2/0.5477 ≈ 2.191
- df = 29, one-tailed p ≈ 0.0184
- Decision: p < 0.05 → Reject H₀. Rods are significantly longer than 50cm.
3. Two-Sample Pooled: Teaching Methods
Method A: x̄₁=78, s₁=8, n₁=25. Method B: x̄₂=74, s₂=9, n₂=25. Assume equal variances, α=0.05 two-tailed.
- sp² = (24×64 + 24×81)/48 = (1536+1944)/48 = 72.5
- t = (78−74)/√(72.5×(1/25+1/25)) = 4/√5.8 ≈ 1.661
- df = 48, p ≈ 0.1034
- Decision: p ≥ 0.05 → Fail to reject H₀. No significant difference detected between methods.
4. Two-Sample Welch's: Unequal Sample Sizes
Group 1: x̄₁=100, s₁=15, n₁=10. Group 2: x̄₂=90, s₂=25, n₂=40. Variances look unequal — use Welch's.
- t = (100−90)/√(225/10+625/40) = 10/√(22.5+15.625) = 10/√38.125 ≈ 1.619
- df via Welch-Satterthwaite ≈ 12.9
- p ≈ 0.130 (two-tailed) → Fail to reject H₀ at α=0.05
5. Paired T-Test: Before/After Training
10 employees tested before and after a training program. Mean difference d̄=6.2 points, sd=5.1, n=10, α=0.05 two-tailed.
- t = 6.2/(5.1/√10) = 6.2/1.6127 ≈ 3.845
- df = 9, p ≈ 0.00392
- Decision: p < 0.05 → Reject H₀. Training produced a statistically significant improvement.
6. Paired T-Test: No Significant Change
8 patients' cholesterol before/after a mild dietary change. d̄=−2.5, sd=8.9, n=8, α=0.05 two-tailed.
- t = −2.5/(8.9/√8) = −2.5/3.147 ≈ −0.794
- df = 7, p ≈ 0.4525
- Decision: p ≥ 0.05 → Fail to reject H₀. No significant change detected.
Common Mistakes
Mistake 1 — Using an Independent-Samples Test on Paired Data
- ❌ Wrong: Running a two-sample test on before/after measurements from the same subjects.
- ✅ Correct: Use the paired t-test — it accounts for the correlation between matched observations and is more statistically powerful.
Mistake 2 — Choosing a One-Tailed Test After Seeing the Data
- ❌ Wrong: Running a two-tailed test, seeing p=0.08, then switching to a one-tailed test to get p<0.05.
- ✅ Correct: Decide tail direction (and α) before collecting/analyzing data.
Mistake 3 — Ignoring Unequal Variances
- ❌ Wrong: Always defaulting to the pooled t-test regardless of how different the two sample variances look.
- ✅ Correct: When in doubt, use Welch's t-test — it performs nearly as well as the pooled test when variances are equal, and much better when they aren't.
Mistake 4 — Confusing Statistical and Practical Significance
- ❌ Wrong: Assuming a tiny p-value automatically means the effect is large or important.
- ✅ Correct: Always check effect size (Cohen's d) alongside the p-value — with large samples, even trivially small differences can be "statistically significant."
Mistake 5 — Forgetting the t-Test Assumes Rough Normality
- ❌ Wrong: Applying a t-test blindly to heavily skewed data with a tiny sample size.
- ✅ Correct: For small, non-normal samples, consider a non-parametric alternative (e.g., Wilcoxon signed-rank or Mann-Whitney U test) instead.
Frequently Asked Questions
Related Calculators
Share This Tool
Share the T-Test Calculator with your class or team!