T-Test Calculator
One-sample, two-sample, or paired — paste your data and get the p-value, confidence intervals, and effect size. Runs in your browser, no install needed.
Open the calculator →What's a t-test, really?
A t-test answers one simple question: "Are these two groups different, or is this just noise?" It was invented by William Gosset in 1908 — he worked at a brewery, hence the pen name "Student." (The Guinness connection is real — look it up.)
Here's how it works: the test calculates a t-statistic, which is basically the ratio of "how far apart are these groups" to "how noisy is the data." Big ratio = big difference = low probability it happened by chance.
The three flavors of t-test
1. One-sample t-test
You've got one group and want to compare its mean to some known value. Like: "Is the average pipette volume actually 1000 μL, or is this one calibration off?"
- Input: One column of numbers + the value you're testing against (μ₀)
- Output: t-statistic, p-value, 95% CI for the difference
- Real use: QC labs checking if equipment is calibrated, comparing sample means to reference ranges
2. Two-sample independent t-test
The classic. Two separate groups — treatment vs. control, male vs. female, before vs. after (different subjects). You want to know if their means are genuinely different.
- Input: Two columns of numbers (Group A and Group B)
- Output: t-statistic, p-value, 95% CI, Cohen's d
- Watch out: The groups have to be independent. If you're measuring the same people twice, that's paired — use test #3 instead.
- Real use: Comparing gene expression in treated vs. untreated cells, drug efficacy trials
3. Paired t-test
Same subjects, two time points or conditions. Before and after. Left arm and right arm. This test accounts for the fact that person #1's "after" is related to their "before" — which makes it more powerful than the independent test for repeated measures.
- Input: Two columns (Time 1 and Time 2), same subjects
- Output: t-statistic, p-value, 95% CI for the mean difference
- Real use: Weight loss studies, pre/post interventions, crossover designs
Reading your results
Most people look at the p-value and stop there. Don't. Here's what each number actually means:
| Metric | What It Means | Rule of Thumb |
|---|---|---|
| p-value | Probability of observing this difference if the null hypothesis is true | p < 0.05 = significant |
| t-statistic | Ratio of signal (difference) to noise (variability) | |t| > 2 generally significant |
| 95% CI | Range of plausible values for the true difference | If CI excludes 0, result is significant |
| Cohen's d | Standardized effect size (difference / pooled SD) | 0.2 = small, 0.5 = medium, 0.8 = large |
A p-value of 0.001 with n=10,000 can still mean a tiny, clinically irrelevant effect. Cohen's d tells you the magnitude of the difference independent of sample size. Always report both.
Assumptions to Check
- Normality: Data in each group should be approximately normally distributed. Check with Shapiro-Wilk test or Q-Q plot. The t-test is robust to mild violations when n > 30.
- Independence: Observations should be independent of each other (for independent t-test).
- Homogeneity of variance: Groups should have similar variances. If variances are unequal, use Welch's t-test (our calculator applies this automatically when needed).
- Scale: Dependent variable should be continuous (interval or ratio).
Let's try it with real data
Here's a simple experiment: does a new drug lower blood pressure? 8 patients on the drug, 8 on placebo. After 4 weeks:
Group A (Drug): 128, 132, 125, 130, 127, 135, 129, 131
Group B (Placebo): 138, 142, 135, 140, 137, 145, 139, 141
t = −4.21, df = 14, p = 0.0008, Cohen's d = −2.11 (large effect)
The drug group had significantly lower systolic BP than placebo (mean difference: −10.5 mmHg, 95% CI [−15.8, −5.2]). The large effect size (d > 0.8) indicates a clinically meaningful difference.
Where people go wrong
- Using paired on independent data. If the subjects are different in each group, a paired test inflates your Type I error. It's treating between-subject noise as within-subject signal.
- Ignoring normality. With n < 10, skewed data will give you unreliable p-values. Check with Shapiro-Wilk or just switch to Mann-Whitney U.
- Statistical significance ≠ clinical significance. p = 0.04 with d = 0.1 is technically significant. It's also meaningless in practice. Always check the effect size.
- Forgetting to look at outliers. One extreme value can swing the entire t-statistic. Plot your data first. Seriously.
Run your own t-test
Paste your data, pick the test type, and get results in a few seconds. P-value, confidence intervals, effect size — all of it. No login needed.
Open the calculator →