Two-Sample t-Test Calculator

Two-Sample t-Test Calculator

Compare the means of two independent groups — from summary statistics or pasted raw data — with Welch’s and the pooled Student t-test, Cohen’s d, Hedges’ g and a 95% confidence interval for the difference.

Assumption checklist: the two samples are independent; each group is roughly normal (or n ≥ 30); equal variances are NOT required — Welch’s test is the default and the pooled test is shown for comparison.
WELCH T · DF 52.93
2.472

Reject H₀ at α = 0.05 — with Welch t = 2.472 and a p-value of 0.0167, the two means differ.

Welch p-value
0.0167
Pooled t / p
2.422 / 0.0189
Cohen’s d
0.656
Hedges’ g
0.647
95% CI (Welch)
[1.13, 10.87]
95% CI (pooled)
[1.03, 10.97]

Calculation

    Shaded t curve — Welch rejection region

    The shaded tails beyond ±2.007 are the rejection region at α = 0.05 (two-tailed, Welch df = 52.93). The dot marks the observed Welch t = 2.472, which falls inside the shaded region.

    Decision rule: reject H₀ when |t| exceeds 2.007. Here |2.472| is larger, so the result is significant — and the 95% confidence interval [1.13, 10.87] excludes 0, which tells the same story.

    A two-sample t-test compares the means of two independent groups — two classes, treatment versus control, men versus women. Enter summary statistics or paste raw data, choose Welch’s or the pooled Student version, and get the t-statistic, degrees of freedom, p-value, Cohen’s d and a 95% confidence interval for the difference.

    This calculator compares the means of two independent groups. If the same subjects were measured twice, use the paired t-test instead. If you have one sample against a claimed value, use the one-sample t-test.

    How to use the two-sample t-test calculator

    Use Summary stats when you already know each group’s mean, standard deviation and sample size: enter x̄₁, s₁, n₁ for group 1 and x̄₂, s₂, n₂ for group 2. Use Raw data when you have the individual values: paste each group’s numbers, separated by commas, spaces or line breaks, and the calculator works out the means, standard deviations and sample sizes for you.

    Then choose your significance level α (0.01, 0.05 or 0.10) and your tail: two-tailed if you are asking whether the means differ at all, or one-tailed if you have a direction in mind (μ₁ > μ₂ or μ₁ < μ₂). The calculator shows the Welch and pooled results side by side, so you can see whether the choice of version changes the answer — it usually does not, and when it does, the Welch result is the one to trust.

    When should you use a two-sample t-test?

    Use a two-sample t-test when you have two groups of different people, items or units, and you want to know whether their population means differ. Typical cases:

    • Two classes take the same test — did one class score higher on average?
    • Treatment versus control in a trial — did the treatment change the outcome?
    • Two products, two regions or two time periods — is the difference in means real, or could it be chance?

    The test assumes the samples are independent, each group is roughly normal (or large, n ≥ 30), and the observations within a group are independent of each other. It does not assume the two groups have equal variances — that is exactly what Welch’s version is for. If the same subjects appear in both groups, the data are paired, not independent, and this test is the wrong one: use the paired t-test instead.

    Welch or pooled — which should I use?

    The pooled (Student) t-test combines the two groups’ variances into one pooled standard deviation sp and assumes the population variances are equal. The Welch t-test does not pool: each group keeps its own variance, and the degrees of freedom are adjusted downwards by the Welch–Satterthwaite formula. Welch’s test is the safer default — it is valid whether or not the variances are equal, and it loses almost no power when they are. The pooled test is shown here for comparison and for the classic textbook case of equal variances.

    WelchPooled (Student)
    Assumes equal variances?NoYes
    Standard error√(s₁²/n₁ + s₂²/n₂)sp × √(1/n₁ + 1/n₂)
    Degrees of freedomWelch–Satterthwaite (usually not a whole number)n₁ + n₂ − 2
    Worked example t2.47162.4218
    Worked example p0.01670.0189

    When the two groups have the same size and the same standard deviation, Welch and pooled give exactly the same answer. When the variances differ a lot, the pooled test can mislead and Welch is the honest one.

    How do I read the p-value, Cohen’s d and the confidence interval together?

    The p-value tells you whether the difference is statistically significant: below α (usually 0.05), reject H₀ and conclude the means differ. Cohen’s d tells you how big the difference is in standard-deviation units: about 0.2 is small, 0.5 is medium and 0.8 is large. The 95% confidence interval for μ₁ − μ₂ tells you the plausible size of the difference: if it excludes 0, the test is significant, and the interval shows how large the difference could plausibly be. A significant p-value with a tiny d is a small effect that happened to be measured precisely; a large d with a wide interval is a big effect measured imprecisely. Report all three.

    Worked example: two classes take the same test

    Two classes take the same test. Class A: n = 25, x̄ = 78, s = 8. Class B: n = 30, x̄ = 72, s = 10. Difference = 6.00.

    Welch’s test

    Welch SE = √(8²/25 + 10²/30) = 2.4276. Welch t = 6.00 / 2.4276 = 2.4716, df = 52.93, two-tailed p = 0.0167 → reject H₀ at α = 0.05.

    Pooled test

    Pooled sp = 9.1487, pooled SE = 2.4775, pooled t = 2.4218, df = 53, p = 0.0189 — the same conclusion.

    Cohen’s d = 0.6558 (medium-to-large). 95% CI for μ₁ − μ₂ = [1.13, 10.87] — it excludes 0, consistent with the test: class A plausibly scores between about 1 and 11 points higher than class B.

    Two-sample t-test in Excel

    In Excel, =T.TEST(array1, array2, tails, type) runs the test on two columns: type 2 is the pooled (Student) test and type 3 is Welch’s test. For the worked example, =T.TEST(A2:A26,B2:B31,2,3) runs the Welch two-sample test on two columns. Use T.DIST.2T for a two-tailed p-value from a t-statistic and T.INV.2T for the critical t value.

    FAQs

    Welch or pooled — which should I use?

    Welch, by default. It does not assume equal variances and is valid either way. Use the pooled test only when you have good reason to believe the population variances are equal — and even then Welch’s answer is usually very close.

    What if my variances are very different?

    That is exactly when Welch’s test matters. The pooled test pools a large variance with a small one and can give a misleading p-value; Welch keeps each group’s variance separate and adjusts the degrees of freedom down.

    Can I use this for paired data?

    No. If the same subjects were measured twice, the two groups are not independent and this test is wrong. Use the paired t-test, which tests the mean of the differences.

    What does the p-value mean here?

    It is the probability of seeing a difference in sample means at least as large as yours, if the two population means were in fact equal. A small p-value (below α) is evidence that the means really differ. Read what is a p-value? for the full explanation.

    What is Cohen’s d telling me?

    How big the difference is, in standard-deviation units, rather than just whether it is significant. In the worked example, d = 0.6558 means the two class means are about two-thirds of a standard deviation apart — a medium-to-large effect. See the Cohen’s d calculator for more.

    Why is the Welch df not a whole number?

    The Welch–Satterthwaite formula blends the two groups’ variances and sample sizes, and the result is usually fractional — 52.93 in the worked example. That is normal: the t-distribution is defined for any positive degrees of freedom, not only whole numbers.

    Sources: the Welch and pooled formulas follow the NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.3. Two-Sample t-Test for Equal Means; the t* values quoted on this page follow 1.3.6.7.2. Critical Values of the Student’s-t Distribution. For the interval version of this test, see the confidence interval for the difference of two means, and for the distribution itself, the t-distribution calculator.

    See all 62 free statistics tools on Empirical Rule Calculators.