Two-Sample t-Test Calculator (Welch & Pooled)

A two-sample t-test asks whether two independent groups have different population means, using each group's mean, standard deviation and size. This two-sample t-test calculator runs Welch's unequal-variance test by default, or the classic pooled Student's t-test, and returns the t statistic, degrees of freedom and two-tailed and one-tailed p-values.

calculated
calculated
calculated
calculated
calculated
calculated
calculated
Type in any field to change it. Press × on a value to calculate that field instead.

How to use the two-sample t-test calculator

Choose Welch or pooled, then enter the mean, standard deviation and size of each group. The calculator returns the difference in means, its standard error, the degrees of freedom, the t statistic and the p-values. If p is below your significance level α (commonly 0.05), the difference between the group means is statistically significant.

Two-sample t-test formulas

Welch: t = (x̄₁ − x̄₂) ÷ √(s₁²/n₁ + s₂²/n₂)

df = (s₁²/n₁ + s₂²/n₂)² ÷ [ (s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1) ]

Pooled: sp² = [(n₁−1)s₁² + (n₂−1)s₂²] ÷ (n₁+n₂−2)  ·  t = (x̄₁ − x̄₂) ÷ √(sp²(1/n₁ + 1/n₂))  ·  df = n₁+n₂−2

Worked example

Group 1: n = 30, mean 78.4, SD 6.2. Group 2: n = 25, mean 74.1, SD 8.9. Welch’s test:

  • Difference in means = 78.4 − 74.1 = 4.3
  • Standard error = √(6.2²/30 + 8.9²/25) = 2.1094
  • t = 4.3 ÷ 2.1094 = 2.0385, df = 41.69
  • Two-tailed p-value = 0.0479, so the difference is significant at α = 0.05

Welch vs pooled for the same data

Method SE df t p (two-tailed)
Welch (unequal variances) 2.1094 41.69 2.0385 0.0479
Pooled (equal variances) 2.0427 53.00 2.1050 0.0400

Here group 2 has the larger SD but the smaller n, so the pooled test understates the standard error and gives a smaller p-value than Welch’s test.

Effect of sample size (same means and SDs as the example)

n₁ n₂ t Welch df p (two-tailed)
5 5 0.886 7.1 0.4042
10 10 1.254 16.1 0.2279
20 20 1.773 33.9 0.0852
30 30 2.171 51.8 0.0345
50 50 2.803 87.5 0.0062
100 100 3.964 176.8 0.0001

The same 4.3-point difference is not significant with 5 per group but highly significant with 100 per group — plan the sample size before collecting data.

Practical notes

  • Groups must be independent — different people, batches or machines in each.
  • Each group should be roughly normal, or large enough (about 30+) for the central limit theorem to help.
  • For more than two groups use ANOVA rather than repeated t-tests, which inflate the false-positive rate.

Frequently asked questions

Should I use Welch's t-test or the pooled t-test?

Welch's test is the safer default. It does not assume equal variances, loses almost no power when the variances are equal, and avoids misleading p-values when they are not — especially with unequal group sizes. Use the pooled test only when equal variances are justified.

How are the Welch degrees of freedom calculated?

With the Welch–Satterthwaite equation, df = (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)]. It is usually not a whole number and lies between the smaller n − 1 and n₁ + n₂ − 2.

Can I use this for before-and-after measurements?

No. Measurements on the same subjects are paired, not independent. Take the difference for each subject and use the one-sample t-test on the differences with a hypothesised mean of 0.

What does the p-value mean here?

It is the probability of seeing a difference in means at least as large as yours if the two population means were actually equal. It is not the probability that the null hypothesis is true.

Embed this calculator

Free to use on your website or blog. Copy this code: