Two-Sample t-test
Two sample t-test online with Welch correction, effect size and 95 percent confidence interval.
When to use it
Use to compare the means of two independent groups (yield under two fertilisers, scores under two teaching methods). Welch correction is the default and handles unequal variances. Pooled t available when variances are demonstrably equal.
When NOT to use it
Do not use for paired or matched data; use the Paired t-test instead. Do not use for three or more groups; use one-way ANOVA. If residuals are heavily non-normal at small n, switch to Mann-Whitney U. For ratio outcomes (proportions, rates) use a chi-square or Poisson model rather than coercing to a t.
What you get
Group means and SDs, mean difference with its 95 percent confidence interval, t statistic, degrees of freedom (Welch-Satterthwaite when applicable), two-sided p-value, Cohen's d and Hedges' g effect sizes, and a small visual of the two distributions side by side.
Worked example
Welch two-sample t worked illustration, two batches of n = 6 measurements.
30.02, 29.99, 30.11, 29.97, 30.01, 29.99 29.89, 29.93, 29.72, 29.98, 30.02, 29.98
Expected output: Welch t approx 1.959, df approx 7.03, p approx 0.0908
Source: Welch, B. L. (1947). The generalisation of Student's problem when several different population variances are involved. Biometrika, 34(1-2), 28 to 35. Two-batch n = 6 layout reproduced in Snedecor and Cochran (1989), Statistical Methods, 8th ed., ch. 6.
How to interpret the output
Reject H0 of equal means when p is below alpha. The 95 percent CI for the mean difference is more informative than the p alone: a CI excluding zero implies p < 0.05 and the CI bounds quantify the plausible effect. Cohen's d gives a unitless effect size: roughly 0.2 small, 0.5 medium, 0.8 large (Cohen 1988). Cross-checked against R t.test() on the two-batch Welch worked illustration (Welch 1947; reproduced in Snedecor and Cochran 1989 ch. 6) to four significant figures.
Common pitfalls
- Reporting p without the mean difference and its 95 percent CI.
- Confusing paired and independent designs (paired test has different df).
- Using pooled t when Levene rejects equal variance.
- Treating a non-significant t as proof of no difference (run a TOST equivalence test instead).
Try it in StatVeda
The Two-Sample t-test engine runs entirely in the browser. No signup, no install, no data sent to a server. Paste your data, hit Run, copy the output.
Open Two-Sample t-testReferences
- Welch, B. L. (1947). The generalisation of Student's problem when several different population variances are involved. Biometrika, 34(1-2), 28 to 35.
- Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences, 2nd edition. Lawrence Erlbaum Associates, Hillsdale, New Jersey.
- Snedecor, G. W. and Cochran, W. G. (1989). Statistical Methods, 8th edition. Iowa State University Press, Ames.