Skip to content
CornerTools

T-Test Calculator

Compare means with a one-sample, two-sample (Welch or pooled) or paired t-test, from raw data or summary statistics, with every step.

Test
Data

10 numbers

10 numbers

Separate numbers with commas, spaces or new lines. A comma always separates, so write 1234, not 1,234.

Variances
Alternative hypothesis
APA style

t(16.18) = 3.56, p = .003, d = 1.59

95% confidence interval: 2.1848 to 8.6152

Significant at α = 0.05: p is below α, so the null hypothesis is rejected.

t
3.5572
Degrees of freedom
16.18
Two-tailed p-value
0.002588
Difference in means
5.4
Standard error
1.518
Cohen's dₛ
1.59
Hedges' g
1.52
GroupnMeanSDSE
Group 11021.53.92291.2405
Group 21016.12.76690.875

Normality is not tested.

t = 3.56
Across: t; up: the probability density. Shaded: the rejection region at α = 0.05. Marked: the observed t.

Paste your data, or type each group's mean, standard deviation and size, to test whether a mean differs from a value or two means differ from each other. The result is the t statistic, its degrees of freedom and p-value, a confidence interval for the difference, the effect size and a line ready to paste into a report in APA style, with every step of the working.

How to use it

One sample compares a mean with a hypothesised value. Two samples compares two independent groups, such as a treatment and a control group. Paired compares two measurements of the same people or things, such as before and after, matched in order; paste two spreadsheet columns into the first list and they fill both.

Raw data takes the values, separated by commas, spaces or new lines, up to 100,000 a group. Summary statistics takes each group's mean, standard deviation and n, or for pairs, those of the differences. Two samples use Welch's test unless you choose Pooled. The hypothesised mean or difference is 0 unless you change it; the alternative is two-sided, or one-sided either way; α is 0.05 to start. Nothing you enter leaves your browser.

How it is worked out

t is the distance between the estimate and the hypothesised value in standard errors. Welch's standard error adds the two groups' variances of the mean, and its degrees of freedom come from the Welch–Satterthwaite formula, so they are usually not whole. The pooled test combines the two variances into one and has n₁ + n₂ − 2 degrees of freedom. A paired test is a one-sample test on the differences.

The p-value comes from the t-distribution itself, computed rather than read from a table, as the P-Value Calculator does. The confidence interval is at 1 − α: two-sided for ≠, and a one-sided bound for > or <, matching the test. Effect sizes follow Lakens (2013): d for one sample, d_s with the pooled standard deviation for two, and d_z for pairs, each measured from the hypothesised value. Hedges' g corrects d_s for its small-sample bias with the exact factor J. The effect sizes are shown without confidence intervals.

One sample: t = (x̄ − μ₀) ÷ (s ÷ √n), df = n − 1
Paired: the same on the differences dᵢ
Welch: SE = √(s₁²/n₁ + s₂²/n₂), t = (x̄₁ − x̄₂ − μ₀) ÷ SE
Welch–Satterthwaite: df = (s₁²/n₁ + s₂²/n₂)² ÷ ((s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1))
Pooled: sₚ² = ((n₁ − 1)s₁² + (n₂ − 1)s₂²) ÷ (n₁ + n₂ − 2), SE = sₚ√(1/n₁ + 1/n₂)
CI = estimate ± t(α/2, df) × SE
d = (x̄ − μ₀) ÷ s; d_s = (x̄₁ − x̄₂ − μ₀) ÷ sₚ; d_z = (d̄ − μ₀) ÷ s_d
g = d_s × J, J = Γ(ν/2) ÷ (√(ν/2) Γ((ν − 1)/2)), ν = n₁ + n₂ − 2

Examples

Two groups of 10, Welch's test

Group 1
22, 25, 17, 24, 16, 29, 20, 23, 19, 20
Group 2
18, 16, 15, 19, 17, 13, 21, 14, 16, 12

With the default options the result is t(16.18) = 3.56, p = .003, d = 1.59. The difference in means is 5.4, with a 95% confidence interval of 2.1848 to 8.6152. Pooled, the same data give t(18) = 3.56, p = .002, d = 1.59: with equal group sizes the two tests agree on t and differ only in the degrees of freedom.

  1. The mean and standard deviation of each group. x̄₁ = 21.5, s₁ = 3.9229; x̄₂ = 16.1, s₂ = 2.7669
  2. Welch's standard error adds each group's variance of the mean, s² ÷ n. SE = √(3.9229² ÷ 10 + 2.7669² ÷ 10) ≈ 1.518
  3. t is how many standard errors the difference in means lies from the hypothesised difference. t = (21.5 − 16.1 − 0) ÷ 1.518 ≈ 3.5572
  4. The Welch–Satterthwaite degrees of freedom, from the two variances of the mean. df = (1.5389 + 0.7656)² ÷ (1.5389² ÷ 9 + 0.7656² ÷ 9) ≈ 16.18
  5. The two-tailed p-value is the chance of a t at least this far from 0 either way. p = 2 × P(T₁₆.₁₈ > 3.5572) ≈ 0.002588
  6. The 95% confidence interval is the difference in means ± t × SE, with α ÷ 2 above t. 5.4 ± 2.118 × 1.518 → 2.1848 to 8.6152
  7. Compare p with α. p ≈ 0.002588 < 0.05, so the result is significant

The same values as pairs

Read as before-and-after pairs, matched in order, the differences give t(9) = 3.26, p = .010, d = 1.03, with d_z measured against the spread of the differences.

From means and standard deviations

Group 1 has mean 24.5, SD 4.2 and n = 12; Group 2 has mean 20.1, SD 3.6 and n = 11. Welch's test gives t(20.92) = 2.70, p = .013, d = 1.12; Cohen's dₛ is 1.12 and Hedges' g 1.08.

Sources

The test statistics, pooled variance and Welch–Satterthwaite degrees of freedom follow the NIST/SEMATECH e-Handbook and Welch (1947) and Satterthwaite (1946); Welch as the default follows Delacre, Lakens and Leys (2017); the effect sizes follow Lakens (2013) and Hedges (1981). The APA line follows APA Style's Numbers and Statistics Guide: t and d to two decimals, p to three with no zero before the point, and p < .001 below that.

Sources

Reviewed

Frequently asked questions

Welch, unless there is a reason to know the variances are equal. Student's pooled test gives wrong p-values when the variances differ, above all with unequal group sizes, while Welch's loses almost nothing when they are equal. Testing the variances first and then choosing is not recommended either (Delacre, Lakens and Leys, 2017).
Two-tailed, unless the direction was fixed before the data was collected. A one-tailed test halves the p-value when the difference goes the predicted way and can never find one the other way.
How far apart the means are in standard deviations, whatever the sample size: d = 0.5 is half a standard deviation. Cohen's rough labels, 0.2 small, 0.5 medium and 0.8 large, are a last resort; comparing with effects in your own field says more. Hedges' g is the same measure with the small-sample bias removed, a little nearer 0.
Independent observations, and means that are close to normally distributed, which holds for roughly normal data or larger samples. The tool does not test normality; it notes values beyond Tukey's fences, 1.5 × the interquartile range past the quartiles, which are worth a look in small samples.

See also