T-Test Calculator
A t-test tells you whether a sample mean is really different from what you expected — or whether two groups genuinely differ. This calculator runs one-sample tests from summary statistics or raw data, and two-sample tests with Welch’s or Student’s method, and gives you the t-statistic, the p-value and the 95% confidence interval.
A t-test asks whether the difference between two averages is real or just chance. Choose the test that matches your data, enter your numbers, and get the t-statistic, degrees of freedom, p-value and 95% confidence interval instantly.
Result
How It Works
A t-test turns the gap between what you observed and what the null hypothesis predicts into a t-statistic, then asks how surprising that value is under the t distribution. For a one-sample test, t = (x̄ − μ₀) ÷ (s ÷ √n), where x̄ is the sample mean, s the sample standard deviation, n the sample size and μ₀ the hypothesized mean. The degrees of freedom are n − 1.
For two samples, the t-statistic is the difference in means divided by the standard error of that difference, and the degrees of freedom depend on the method: Welch’s version uses the Welch–Satterthwaite equation (a fractional value), while Student’s pooled version uses n₁ + n₂ − 2. With three or more groups, the right tool is an ANOVA calculator — running a t-test on every pair inflates the false-positive rate.
The p-value comes from the t distribution’s cumulative distribution function, computed here with the regularized incomplete beta function — accurate to about 1e-12, the same method used by R and SciPy. The 95% confidence interval is the estimate plus or minus the critical t-value (the 97.5th percentile of the t distribution) times the standard error. If the interval excludes the null value, the test is significant at α = 0.05 — the two always agree.
Worked Example
One-sample, summary: a sample of 25 students has a mean score of 105 and a standard deviation of 15. Testing against a hypothesized mean of 100: t = (105 − 100) ÷ (15 ÷ √25) = 5 ÷ 3 = 1.6667, with 24 degrees of freedom, a two-tailed p-value of 0.1086 (one-tailed 0.0543) and a 95% confidence interval of 98.8083 to 111.1917 — not significant at α = 0.05. One-sample, data: the values 2, 4, 6, 8, 10 have mean 6 and sample SD 3.1623; against μ₀ = 5, t = 0.7071, df = 4, two-tailed p = 0.5185.
Two-sample: group A (22, 25, 27, 24, 26) has mean 24.8 and SD 1.9235; group B (18, 20, 19, 21, 17) has mean 19.0 and SD 1.5811. Welch’s test gives t = 5.2086, df = 7.7111, two-tailed p = 0.0009 — significant at α = 0.05. The pooled (Student) version gives t = 5.2086, df = 8, p = 0.0008.
Assumptions
- Near-normal data. The t-test assumes the underlying population is roughly normally distributed. With small samples, strong skew or heavy outliers make the p-value unreliable — with large samples (n > 30 or so) the central limit theorem covers most cases.
- Independent observations. Each value must come from a separate, independent observation. Paired or repeated measurements on the same subjects need a paired t-test, not the two-sample test here.
- Welch vs Student. Welch’s test makes no assumption about equal variances and is the safer default. Student’s pooled test assumes the two populations have the same variance — if they don’t, its p-value can mislead.
- Zero variance has no t-value. If every value in a sample is identical, the standard deviation is zero and the t-statistic is undefined — the calculator shows a clear message instead of a number.
- Significance is not importance. A small p-value says the difference is unlikely to be pure chance; it says nothing about whether the difference is large enough to matter. Read it together with the confidence interval.
- Education and quick checks. Results are computed from the numbers you enter and are not a substitute for professional statistical advice.
Last reviewed: 15 November 2026.
Built and tested by SumKitTool — see how we check our numbers.
How to Use This Calculator
Pick a test type, enter your data, and the result updates live as you type.
- Choose the test type — one-sample from summary statistics (mean, SD, n), one-sample from raw data, or two-sample to compare two groups.
- Enter your numbers — paste data separated by commas, spaces or new lines, and set the hypothesized mean (one-sample) or the method, Welch or Student (two-sample).
- Read the answer — the t-statistic, degrees of freedom, two-tailed and one-tailed p-values, the 95% confidence interval and the verdict at α = 0.05.
The Reset button restores the worked example (mean 105, SD 15, n = 25, μ₀ = 100 — t = 1.6667, p = 0.1086).
Tips and Practical Advice
- Start with Welch. Unless you have a good reason to believe the two groups share a variance, Welch’s test is the safer choice — it costs almost nothing when the variances are equal and protects you when they aren’t.
- Report the confidence interval, not just the p-value. The interval shows the plausible range for the true mean or difference — a p-value alone hides whether the effect is big or trivial.
- Check your data before you trust the test. A single mistyped value can move the mean and SD a lot. Paste carefully, and glance at the reported mean and SD to make sure they look right.
- Don’t switch to one-tailed after seeing the result. A one-tailed test is only valid if you chose the direction before looking at the data — picking it afterwards doubles your chance of a false positive.
Frequently Asked Questions
What is a t-test used for?
A t-test checks whether a sample mean differs from a value you expect, or whether two groups differ from each other. Use a one-sample t-test to compare one mean against a known value (for example, is this class's average score different from 100?), and a two-sample t-test to compare two groups (for example, do two teaching methods give different scores?). It is the right test when the population standard deviation is unknown — which is almost always.
What is the difference between a Welch and a Student t-test?
Welch's t-test does not assume the two groups have equal variances, and it adjusts the degrees of freedom for that — it is the safer default, and what this calculator uses unless you choose otherwise. Student's t-test pools the two variances into one estimate and assumes they are equal; if that assumption is wrong, its p-value can be misleading. When the groups are the same size the two tests often agree closely.
How do I read the p-value from a t-test?
The p-value is the chance of seeing a difference at least this large if there were really no difference at all. If p is below your significance level — usually 0.05 — the result is statistically significant and you reject the null hypothesis. For example, p = 0.1086 is not significant at 0.05, while p = 0.0009 is. A p-value is not the probability that the null hypothesis is true.
What is the difference between a one-tailed and a two-tailed t-test?
A two-tailed test asks whether the mean differs in either direction, and is the standard choice. A one-tailed test asks about one direction only — for example, whether the mean is greater than the hypothesised value. The one-tailed p-value in the observed direction is half the two-tailed p-value: with t = 1.6667 and 24 degrees of freedom, the two-tailed p-value is 0.1086 and the one-tailed p-value is 0.0543. Only use a one-tailed test if you chose the direction before seeing the data.
Last updated: