Math & Geometry
Two-Sample t-Test Calculator (Welch, from Summary Statistics)
The two-sample t-test is one of the most widely used statistical tests. It asks whether the difference between the average values of two independent groups, such as patients on two treatments, students taught by two methods or products from two production lines, is larger than would be expected from random variation alone. The classic version, Student's t-test, assumes that both groups have the same underlying variance. Welch's t-test, developed by Bernard Welch in 1947, removes that assumption by estimating the standard error from each group's own variance and adjusting the degrees of freedom with the Welch–Satterthwaite formula. Because it performs well whether or not the variances are equal, many statisticians now recommend it as the default. This calculator works from summary statistics, so you only need each group's mean, standard deviation and sample size, the figures commonly reported in papers and reports. It computes the standard error of the difference, the t statistic, the Welch degrees of freedom, the two-sided p-value from the t distribution and a 95 percent confidence interval for the difference in means, and states whether the result is significant at the conventional 5 percent level. For a group of 30 with mean 20 and standard deviation 5 compared with a group of 35 with mean 18 and standard deviation 6, the difference of 2 gives a t of about 1.47 with about 63 degrees of freedom and a two-sided p-value of about 0.148; the 95 percent confidence interval, from about minus 0.73 to 4.73, includes zero, so the difference is not statistically significant. The test assumes independent observations and approximately normal sampling distributions of the means, which holds well for moderate sample sizes even when the data themselves are somewhat skewed.
How to use this calculator
- Enter the mean, standard deviation and size of the first group.
- Enter the same for the second group.
- Read the t statistic, degrees of freedom and p-value.
- Check the 95% confidence interval for the difference.
- Interpret the effect size and context, not only the p-value.
Statistical and practical significance
A p-value below 0.05 is conventionally called statistically significant, but it does not mean the difference is large or important. With very large samples, tiny differences become significant; with small samples, important differences may not reach significance. The confidence interval shows the range of differences consistent with the data and is often more informative.
Reporting effect sizes, such as the difference in means with its interval or a standardised measure like Cohen's d, alongside p-values helps readers judge practical importance.
Choosing the right test
If the same subjects are measured twice, for example before and after a treatment, the observations are paired and a paired t-test is needed instead. For three or more groups, analysis of variance avoids the inflated error rate of running many t-tests.
For very skewed data or small samples with outliers, non-parametric alternatives such as the Mann–Whitney U test, or analysing transformed data, may be more appropriate. Consult a statistician for important analyses.
Formula & method
Standard error SE = √(s₁² ÷ n₁ + s₂² ÷ n₂)t = (mean₁ − mean₂) ÷ SEWelch–Satterthwaite df = (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)² ÷ (n₁ − 1) + (s₂²/n₂)² ÷ (n₂ − 1)]Two-sided p-value from the t distribution; 95% CI uses the critical t value for dfSE = √(s₁²/n₁ + s₂²/n₂). t = (x̄₁ − x̄₂)/SE. df = (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1)]. p = 2 × P(T > |t|). CI = difference ± t₀.₉₇₅,df × SE.
Worked example
Comparing two groups
- SE = √(25/30 + 36/35) = √1.8619 = 1.3645.
- t = 2 ÷ 1.3645 = 1.4657; df = 62.96.
- Two-sided p = 0.1477; 95% CI = −0.727 to 4.727.
Answer: The difference is not significant at the 5% level.
Frequently asked questions
What is Welch's t-test?
A two-sample t-test that does not assume equal variances in the two groups.
What does the p-value tell me?
How likely a difference at least this large would be if the true means were equal.
Why are the degrees of freedom not whole numbers?
The Welch–Satterthwaite formula gives an approximate, usually fractional, value.
Can I use this for paired data?
No. Use a paired t-test for before-and-after or matched measurements.
What sample size do I need?
It depends on the effect you want to detect; a power analysis can estimate it.
Is this one-sided or two-sided?
Two-sided; halve the p-value for a pre-specified one-sided test in the observed direction.