About the T-Test Calculator
This t-test calculator tests whether a mean, or the difference between two means, is statistically significant. It supports the four t-tests used most often: the one-sample t-test (compare a mean with a target value), the paired t-test (before/after measurements on the same subjects), Welch’s two-sample t-test (independent groups, unequal variances — the safer default) and Student’s pooled two-sample t-test (independent groups with equal variances).
Paste raw data, one group per box, or switch to summary statistics and enter each group’s mean, standard deviation and sample size — handy when you only have numbers from a paper or report. You get the t statistic, degrees of freedom, the p-value for a two-tailed or one-tailed alternative, the critical t value, a confidence interval for the mean difference and a plain-English decision at your chosen significance level.
T-tests assume the observations are independent and that each group (or the paired differences) is roughly normally distributed; with larger samples (about 30+ per group) the test is robust to moderate non-normality.
With the default inputs, the t statistic is 3.6578. Change any value above to recalculate instantly.
How to use the t-test calculator
- 1Choose the test: Welch for two independent groups, paired for before/after data, one-sample to compare with a target.
- 2Paste your raw data or switch to summary statistics.
- 3Set the hypothesized value (usually 0 for differences).
- 4Pick a two-tailed or one-tailed alternative and a significance level.
- 5Read t, the p-value and the decision; check the confidence interval for effect size.
Formula and method
Every t-test divides an observed difference by its standard error. The one-sample and paired tests use the mean (of the data, or of the pairwise differences) and s/√n with n − 1 degrees of freedom. Welch’s test uses each group’s own variance and the Welch–Satterthwaite degrees of freedom, df = (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1)]. The pooled test combines both variances into sₚ² = [(n₁−1)s₁² + (n₂−1)s₂²] ÷ (n₁+n₂−2) and uses n₁ + n₂ − 2 degrees of freedom.
The p-value is the probability, under H₀, of a t statistic at least as extreme as the one observed, taken from Student’s t distribution (computed here with the regularized incomplete beta function). Standard deviations are sample standard deviations (n − 1 denominator).
- x̄
- Sample mean (or mean difference for paired data)
- μ₀
- Hypothesized mean or difference under H₀
- s
- Sample standard deviation
- n
- Sample size
- df
- Degrees of freedom
Worked examples
Welch t-test on two small groups
Group 1 averages 13.125 and group 2 averages 10. With sample SDs of about 2.03 and 1.31, the standard error of the difference is 0.854, so t = 3.125 ÷ 0.854 ≈ 3.66 on about 11.96 degrees of freedom. The two-tailed p-value of 0.0033 is well below 0.05, so the means differ significantly.
Paired before/after test
The differences (8, 4, 10, 1, 7, 6) have mean 6 and SD 3.1623, so the standard error is 1.2910 and t = 6 ÷ 1.2910 ≈ 4.65 on 5 degrees of freedom. The p-value of about 0.0056 shows a significant average drop.
One-sample test from summary statistics
The standard error is 6.1 ÷ √25 = 1.22, so t = (52.3 − 50) ÷ 1.22 ≈ 1.885 with 24 degrees of freedom. The two-tailed p-value is about 0.072, which is above 0.05, so the mean is not significantly different from 50.
Pooled two-sample test, right-tailed
The pooled variance is about 123.75, giving a standard error of 2.768 and t ≈ 2.17 on 63 degrees of freedom. The one-tailed p-value of 0.017 supports the claim that group 1’s mean is higher.
Frequently asked questions
Which t-test should I use?+
Use a one-sample t-test to compare one group’s mean with a known value, a paired t-test when the same subjects are measured twice (before/after), and a two-sample t-test for two independent groups. For two independent groups, Welch’s version is recommended by default because it does not assume equal variances.
What is the difference between Welch and Student’s t-test?+
Student’s (pooled) t-test assumes both groups have the same population variance and uses n₁ + n₂ − 2 degrees of freedom. Welch’s t-test estimates each variance separately and adjusts the degrees of freedom, so it stays accurate when variances or sample sizes differ, and loses little power when they are equal.
What does the p-value mean in a t-test?+
It is the probability of seeing a t statistic at least as extreme as yours if the null hypothesis were true. A p-value below your significance level (commonly 0.05) is taken as evidence against H₀. It is not the probability that the null hypothesis is true.
Should I use a one-tailed or two-tailed test?+
Use two-tailed unless you decided before seeing the data that only one direction matters. A one-tailed p-value is half the two-tailed value when the effect is in the predicted direction, so choosing it after looking at the data inflates false positives.
How large a sample does a t-test need?+
A t-test can be run with as few as 2 observations per group, but power will be low. With roughly 30 or more observations per group the test is robust to non-normal data; for small samples check that the data (or paired differences) look roughly symmetric without extreme outliers.