Statistics & Probability Hypothesis Tests & Statistical Power Welch and pooled Student t-tests

Two-Sample (Independent) T-Test Calculator

This calculator compares the means of two independent groups. Enter each group's mean, standard deviation and sample size, choose Welch (the safer default, which does not assume equal variances) or the classical pooled test, and it returns the t statistic, the degrees of freedom, an exact p-value, the confidence interval for the difference between the means, and Cohen's d as an effect size. It also runs both methods side by side so you can see whether the choice makes any difference to your conclusion.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Group 1 meanThe average of the first group.105
Group 1 standard deviationSample standard deviation, computed with n − 1.12
Group 1 sample sizeNumber of independent observations in group 1.30
Group 2 meanThe average of the second group.99
Group 2 standard deviationSample standard deviation, computed with n − 1.14
Group 2 sample sizeNumber of independent observations in group 2.32
MethodWelch is the recommended default; the pooled test is the version in most textbooks.Welch — no equal-variance assumption
Alternative hypothesisTwo-tailed unless the direction was fixed before the data were collected.μ₁ ≠ μ₂ (two-tailed)
Significance level (α)Sets the verdict and the width of the confidence interval (1 − α).0.05

It returns

  • t statistic — The difference in means divided by its own standard error.
  • p-value
  • Decision at your alpha
  • Degrees of freedom
  • Difference in means
  • Lower limit for the difference
  • Upper limit for the difference
  • Cohen's d — The difference expressed in pooled standard deviations.

The formula

t=x¯1x¯2s12n1+s22n2
sp2=(n11)s12+(n21)s22n1+n22
ν=(a+b)2a2n11+b2n21

In plain text: t = (x̄1 − x̄2) / √(s₁²/n₁ + s₂²/n₂)

  • x̄1, x̄2The two sample means
  • s₁, s₂The two sample standard deviations
  • n₁, n₂The two sample sizes (count)
  • tTest statistic, referred to Student's t with the Welch–Satterthwaite df

The pooled test replaces the two separate variances with one common estimate and uses n₁ + n₂ − 2 degrees of freedom.

Updated Category Hypothesis Tests & Statistical Power Verified against published test cases Reading time 9 min

What the test compares

Two groups, measured once each, with different people or items in each group: treatment and control, variant A and variant B, supplier one and supplier two. The two-sample t-test asks whether the gap between their averages is larger than the noise within them can comfortably explain.

The key word is independent. Every observation in group 1 must be unrelated to every observation in group 2. If the same subjects appear in both — before and after, left hand and right hand, matched pairs — this is the wrong test and it throws away the pairing that makes those designs powerful. Use the paired t-test instead.

The null hypothesis is that the two population means are equal. The test statistic is the observed difference divided by the standard error of that difference, and the standard error is built by adding variances: the uncertainty in x̄1 and the uncertainty in x̄2 combine as s₁²/n₁ + s₂²/n₂. Variances add for independent quantities, standard deviations do not, which is why the formula squares, adds, and takes the square root rather than adding the standard errors directly.

Notice the consequence: the group with the larger variance or the smaller sample dominates the standard error. Adding 200 more observations to an already-large group barely helps if the other group has 12. Balanced designs are efficient for exactly this reason.

Welch or pooled: which to use

The two versions differ in one assumption. The pooled test assumes both populations share a common variance, so it merges the two sample variances into one estimate sₚ², weighted by degrees of freedom, and uses n₁ + n₂ − 2 degrees of freedom. The Welch test makes no such assumption: it keeps the variances separate and pays for that with fractional degrees of freedom from the Welch–Satterthwaite approximation.

Welch is the better default, and this is not a close call in the modern literature. When the variances really are equal, Welch loses almost nothing — with equal sample sizes and equal variances it returns exactly the pooled answer, degrees of freedom included. When they are not equal, the pooled test's actual false-positive rate drifts away from the nominal alpha, and it drifts furthest when the group sizes are unequal and the larger variance sits in the smaller group.

The Welch degrees of freedom always lie between the smaller group's n − 1 and the pooled n₁ + n₂ − 2. They fall as the variances diverge: with two groups of 20, equal variances give 38 degrees of freedom, a 4:1 variance ratio gives 27.9, and a 25:1 ratio gives 20.5. That reduction is the correction — it widens the reference distribution to account for the fact that you cannot pool.

Do not choose between them by first running a variance test. A preliminary F test for equal variances is itself an inferential procedure, and conditioning the main test on its outcome distorts the error rate of both. Pick Welch in advance and stay with it. The calculator shows both because seeing them agree is reassuring, not because you should choose after the fact.

Worked example: 30 users against 32 users

Two onboarding flows are tested on separate cohorts. Flow A: 30 users, mean time-to-value 105 minutes, s = 12. Flow B: 32 users, mean 99 minutes, s = 14. These are the calculator's defaults. Run Welch, two-tailed, at α = 0.05.

  1. Variance of each mean. a = 12²/30 = 144/30 = 4.800; b = 14²/32 = 196/32 = 6.125.
  2. Standard error of the difference. √(4.800 + 6.125) = √10.925 = 3.3053 minutes.
  3. Difference. 105 − 99 = 6.000 minutes.
  4. t statistic. 6.000 / 3.3053 = 1.8153.
  5. Welch degrees of freedom. (10.925)² / [4.800²/29 + 6.125²/31] = 119.3556 / [0.794483 + 1.210181] = 119.3556 / 2.004664 = 59.54.
  6. p-value. The two-tailed area of t(59.54) beyond 1.8153 comes to about 0.075, which is above 0.05, so you fail to reject.
  7. Confidence interval. t(0.025, 59.54) ≈ 2.0003, so the interval for the difference is 6.000 ± 2.0003 × 3.3053 = 6.000 ± 6.612, or −0.61 to 12.61 minutes.
  8. Effect size. sₚ² = (29×144 + 31×196)/60 = 10,252/60 = 170.867, so sₚ = 13.072 and Cohen's d = 6.000/13.072 = 0.459.

The interval is the honest summary: flow B might be up to 12.6 minutes faster, or half a minute slower. A moderate effect size of d = 0.46 sitting on a non-significant p-value is the signature of an underpowered comparison, not of a null result. Detecting d = 0.46 at 80% power would need roughly 75 users per group.

Reading the output

Read the confidence interval for the difference first. It is in the units you measured — minutes, millimetres, dollars — and it tells you which effects your data rule out. A p-value above alpha with a narrow interval clustered around zero is a genuinely negative result. The same p-value with a wide interval means the study could not tell.

Then read Cohen's d, which strips out the sample size. Cohen's conventional labels put 0.2 as small, 0.5 as medium and 0.8 as large; they are rules of thumb from the behavioural sciences and should give way to whatever benchmark your field uses. Unlike t, d does not grow when you collect more data, which is exactly why it belongs in the report.

Check the sign against your group ordering. A negative t means group 1 has the smaller mean. The one-tailed alternatives in this calculator are stated as μ₁ > μ₂ and μ₁ < μ₂, so “right tail” asks whether group 1 is larger.

Finally, look at the two-method table. If the pooled and Welch rows lead to the same conclusion, the variance assumption is not driving your result and you can report either. If they disagree, report Welch and say so — the disagreement itself tells you the variances differ enough to matter.

How unequal variances cut the Welch degrees of freedom

Two groups of 20 each. The pooled test always claims 38 degrees of freedom; Welch reduces them as the variance ratio grows. Computed from ν = 19(1+r)²/(1+r²) with r the ratio of the two variances.
Variance ratio s₂² : s₁²SD ratioWelch dfPooled df
1 : 11.038.0038
2 : 11.4134.2038
4 : 12.027.9438
9 : 13.023.1738
16 : 14.021.3738
25 : 15.020.5238

With equal group sizes the Welch df never fall below n − 1 = 19, which is the limit the table is approaching.

Pitfalls

  • Using it on paired data. Before-and-after measurements on the same subjects belong in a paired t-test, which removes between-subject variation and is usually far more powerful.
  • Choosing pooled or Welch after seeing which one is significant. Decide in advance. Conditioning the test on a preliminary variance test distorts the error rate.
  • Running many two-group comparisons. With four groups there are six pairwise tests and the family-wise error rate climbs to roughly 1 − 0.95⁶ = 0.265, the exact figure being a little lower because the six comparisons share groups. Use a one-way ANOVA followed by a post-hoc procedure.
  • Reporting only the p-value. The difference, its confidence interval and the effect size carry the information a reader needs; the p-value alone does not.
  • Ignoring badly skewed data at small n. The t-test relies on approximately normal sampling distributions of the means. With small groups and heavy skew, use a rank-based test such as Mann-Whitney.
  • Comparing two groups that were not independently assigned. The arithmetic works on any two columns of numbers; the causal reading requires randomisation.

Related tests and study planning

For one group against a fixed reference value, use the one-sample t-test calculator. For three or more groups, use the one-way ANOVA calculator — with exactly two groups, the ANOVA F equals this test's t squared when variances are pooled, and the p-values match to the last digit. For proportions rather than means, use the two-proportion z-test.

Before running an experiment, decide the smallest difference that would change your decision and check whether your planned sample can detect it. The statistical power calculator and the A/B test sample size calculator handle that, and the Cohen's d calculator converts between raw differences and standardised ones.

Welch's correction dates to a 1947 Biometrika paper, building on Satterthwaite's approximation for the degrees of freedom of a linear combination of variance estimates. Sixty years of simulation studies have since confirmed the practical recommendation: use Welch unless you have a specific reason not to.

Frequently asked questions

Should I use Welch or the pooled t-test?

Use Welch. It does not assume the two populations share a variance, and it costs essentially nothing when they do — with equal sample sizes and equal variances it returns the pooled result exactly. The pooled test's real false-positive rate departs from the nominal alpha when variances differ, especially with unequal group sizes, and there is no reliable way to check the assumption without distorting the test you actually care about.

Why are my degrees of freedom not a whole number?

Because Welch's method approximates the distribution of a difference between two independent variance-scaled means, and the approximation lands on a fractional value. The Welch–Satterthwaite formula produces 59.54 for the calculator's default data. That is correct and expected; software that reports whole-number df for a Welch test has rounded, not corrected.

Can I use this if my groups are different sizes?

Yes. Unequal group sizes are handled correctly by both methods, and Welch handles them better when the variances also differ. Balanced groups are still more efficient: for a fixed total sample size, the standard error of the difference is smallest when the two groups are equal, so an even split detects the smallest effects.

What if my data are paired?

Then this is the wrong test. Paired data — the same subject measured twice, matched pairs, left and right — should go into a paired t-test, which analyses the within-pair differences. Treating paired data as independent leaves the between-subject variation in the error term, inflating the standard error and usually hiding a real effect.

How do I interpret Cohen's d?

It is the difference between the means expressed in pooled standard deviations, so d = 0.5 means the groups are separated by half a standard deviation. Cohen's conventional benchmarks are 0.2 small, 0.5 medium and 0.8 large. Unlike t, d does not change when you collect more data, which makes it the right number to compare across studies and to feed into a power calculation.

My p-value is not significant but the difference looks big. What now?

Look at the confidence interval. If it spans both trivial and large effects, your study is underpowered rather than negative, and the honest report says so. Compute the sample size that would detect the effect you observed, and treat the current result as a pilot. Do not describe a non-significant result as showing no difference when the interval does not exclude one.

Is a two-sample t-test the same as an ANOVA with two groups?

Yes, when the t-test pools variances. The ANOVA F statistic equals t² exactly, the degrees of freedom correspond (1 and n₁+n₂−2), and the p-values are identical. The t-test is preferable for two groups because it reports a signed difference and a confidence interval, which ANOVA does not.

What sample size do I need?

It depends on the effect size you want to detect. Detecting d = 0.5 at 80% power and α = 0.05 two-tailed needs about 64 per group; d = 0.8 needs about 26 per group; d = 0.2 needs roughly 394 per group. Those are the standard published figures for the two-sample t-test, and they show how quickly the cost rises as the effect you are chasing gets smaller.

References

  • B. L. Welch, “The generalization of Student's problem when several different population variances are involved”, Biometrika 34, 1947 — Biometrika Trust
  • F. E. Satterthwaite, “An approximate distribution of estimates of variance components”, Biometrics Bulletin 2(6), 1946 — International Biometric Society
  • Statistical Power Analysis for the Behavioral Sciences, 2nd ed. — Jacob Cohen, Lawrence Erlbaum Associates
  • NIST/SEMATECH e-Handbook of Statistical Methods, Section 7.3.1 (Two-sample t-test)National Institute of Standards and Technology