t-Test Calculator: One-Sample, Two-Sample, Welch, and Paired
Run one-sample, two-sample (Student or Welch), and paired t-tests from raw data or summary stats. Returns the t statistic, df, exact p-value, confidence interval, and Cohen's d.
t-test
Enter your data
A result appears here after you run the test.
| Metric | Value |
|---|
t = (estimate) / SE; p = 2*(1 - F_df(|t|)) [two-sided]
How?
How this is calculated
Each mode forms a t statistic as an estimate divided by its standard error, then reads the p-value from Student's t distribution at the mode's degrees of freedom. One-sample uses t = (mean - mu0) / (s / sqrt(n)) with df = n - 1. The paired test runs the same one-sample math on the within-pair differences. The pooled two-sample test uses the pooled SD and df = n1 + n2 - 2. Welch uses SE = sqrt(s1²/n1 + s2²/n2) and the Welch-Satterthwaite df, kept fractional and fed straight into the t distribution rather than floored.
The confidence interval is estimate ± t_crit * SE, using the two-sided critical value at the chosen level. Cohen's d divides the estimate by the sample SD (one-sample), the difference SD (paired, reported as d_z), or the pooled SD (both two-sample modes).
Formula: t = (estimate) / SE; p = 2*(1 - F_df(|t|)) [two-sided]
Assumptions this t-test makes
Observations are independent. For the paired test, independence applies to the within-pair differences rather than the raw values. The data are roughly normal, or n is large enough for the sample mean to be approximately normal. The SD you enter is a sample SD, computed with the n - 1 denominator. For a small, skewed sample the rank-based Mann-Whitney U test is the more robust alternative.
Which method runs
Welch's two-sample test is pre-selected because it stays valid whether or not the two population variances are equal, so it is the safe default. The pooled Student test is one click away and is the right choice when equal variances are justified. The one-sample test compares a single sample mean against a value you supply; the paired test compares two aligned columns through their per-pair differences.
Conventions shown
Standard deviations are sample SDs with the n - 1 denominator. The Welch-Satterthwaite df is kept fractional through the p-value. The sign convention is group 1 minus group 2 (for one-sample, sample mean minus mu0), matching how the direction labels read. Cohen's d uses the pooled SD for both two-sample modes, the sample SD for one-sample, and the difference SD for paired. The p-value is two-sided by default and shown to four decimals, floored at p < .0001. The confidence interval is reported as a two-sided interval at the chosen level even when the p-value is one-sided, the convention most readers expect from a "95% CI".
Sources
- NIST/SEMATECH e-Handbook 1.3.5.3, One-Sample t-Test. NIST/SEMATECH. Retrieved .
- NIST/SEMATECH e-Handbook 7.3.1, Two-Sample t-Test for Equal Means. NIST/SEMATECH. Retrieved .
- Welch, B. L. (1947), The generalization of Student's problem when several different population variances are involved, Biometrika 34. Biometrika. Retrieved .
- SciPy scipy.stats.ttest_ind. SciPy. Retrieved .