Compare the means of two independent samples with this comprehensive t‑test calculator. Choose between Student's t‑test (equal variance) and Welch's t‑test (unequal variance). Get the t‑statistic, degrees of freedom, p‑value, confidence interval, and Cohen's d effect size. Visualize the t‑distribution with critical regions.
The two‑sample t‑test (also known as the independent samples t‑test or Student's t‑test) is a statistical procedure used to determine whether the means of two independent groups are significantly different from each other. It is one of the most widely used tools in empirical research, from clinical trials to A/B testing in business.
t = ?1 − ?2 / √( sp2 ( 1/n1 + 1/n2 ) )
where sp2 is the pooled variance (Student's version).
The two‑sample t‑test was introduced by William Sealy Gosset in 1908 under the pseudonym "Student" while working at the Guinness Brewery. Gosset's original formulation assumed equal variances between groups. The Welch's t‑test, developed by B. L. Welch in the 1930s, relaxes the equal‑variance assumption and is generally preferred when sample sizes or variances differ.
The test statistic compares the difference between sample means relative to the standard error of that difference. Under the null hypothesis (H₀: μ₁ = μ₂), the statistic follows a t‑distribution with degrees of freedom determined by the method used. The p‑value quantifies the probability of observing a test statistic as extreme as the one computed, assuming the null hypothesis is true.
Practical tip: Use our built-in variance ratio check (F-test) to guide your choice between Student's and Welch's test. For normality, consider the Shapiro-Wilk test (available in our Normality Test Calculator).
A pharmaceutical company tests a new drug designed to lower blood pressure. Two independent groups are recruited: the treatment group (n = 15, mean = 118.5 mmHg, SD = 6.2) and the placebo group (n = 14, mean = 124.3 mmHg, SD = 7.1). Using a two‑sided t‑test with α = 0.05, the calculated t‑statistic is −2.41 with 27 degrees of freedom (Student's). The p‑value is 0.023, indicating a statistically significant difference. The company can conclude that the drug is effective in lowering blood pressure.
An e‑commerce platform tests two website layouts: Layout A (n = 500, conversion rate = 3.2%) and Layout B (n = 480, conversion rate = 4.1%). Since the data are proportions, a two‑sample t‑test is applied to the underlying continuous metrics (e.g., time on site). The Welch's t‑test yields t = 2.87, df = 45.6, p = 0.006. The result is statistically significant at α = 0.01, so the platform adopts Layout B to boost conversions.
When variances are unequal, the degrees of freedom are calculated using the Satterthwaite formula, which accounts for the sample sizes and variances of both groups:
This approximation yields a non‑integer df that is generally smaller than n₁ + n₂ − 2, providing a more conservative test when variances differ substantially. Welch's test is robust and recommended as a default in modern statistical practice.