Independent Samples t-Test Calculator
The independent samples t-test examines whether the difference between the means of two separate groups is statistically significant. It is the standard test for comparing two sets of observations that were not measured on the same people — a treatment and a control group, female and male participants, or two different production lines.
This calculator produces both t values: the pooled (Student) t, which assumes equal variances, and the Welch-corrected t for the case where they are not equal. It decides which one should be reported by looking at the result of Levene's test, computes the confidence interval for the difference along with the Cohen d and Hedges g effect sizes, and compares the distributions of the groups in a box plot.
Independent Samples t-Test Formulas
Hypotheses: H₀: μ₁ = μ₂ · H₁: μ₁ ≠ μ₂ Pooled variance: sₚ² = [(n₁−1)s₁² + (n₂−1)s₂²] / (n₁ + n₂ − 2) Pooled t: t = (x̄₁ − x̄₂) / √(sₚ²·(1/n₁ + 1/n₂)), df = n₁ + n₂ − 2 Welch t: t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂) Welch df: df = (s₁²/n₁ + s₂²/n₂)² / [ (s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1) ] Confidence int.: (x̄₁ − x̄₂) ± t₍₁−α/₂; df₎ · SE Cohen d: d = (x̄₁ − x̄₂) / sₚ Hedges g: g = d · [1 − 3 / (4(n₁+n₂) − 9)] Levene W: W = [(N−k)/(k−1)] · Σnᵢ(z̄ᵢ − z̄)² / ΣΣ(zᵢⱼ − z̄ᵢ)², zᵢⱼ = |xᵢⱼ − medianᵢ|
Levene's test is applied in its median-centered (Brown–Forsythe) form, which is more reliable than the original mean-centered version on skewed distributions. If p ≥ 0.05, the variances are treated as homogeneous and the pooled t is reported.
How to Calculate
- In raw data mode, write the observations of the two groups on separate lines; if you like, add a label such as "Treatment:" at the start of a line.
- If you only have summary statistics, switch to the second mode and enter the mean, the standard deviation, and the sample size for both groups.
- Set the hypothesis direction, the significance level (α), and the confidence level.
- Look at the homogeneity of variance row first: if Levene's p ≥ 0.05, the pooled t should be reported; if p < 0.05, the Welch t should be.
- Read the t, df, and p values of the selected method together with the decision row; the shaded t curve shows where t falls relative to the rejection region.
- Add the confidence interval for the difference and the Cohen d and Hedges g values to your report; use the box plot to compare the spread and the outliers of the groups.
Worked Examples
Treatment and control group (raw data)
The treatment group has a mean of 83.90 (s = 5.11) and the control group a mean of 72.50 (s = 3.03). Levene's test gives W = 2.549; p = 0.128, so the variances are treated as homogeneous and the pooled t is reported: t = 6.070; df = 18; p < 0.001. The mean difference is 11.40 units with a 95% confidence interval of 7.45 to 15.35, and Cohen d = 2.715 with Hedges g = 2.600 indicates a very large effect.
t statistic (pooled (Student) t): 6.0705 · Degrees of freedom (df): 18 · p-value: p < 0.001
Two groups with different variances
Group A has a mean of 50.60 and a standard deviation of 1.51, while group B has a mean of 50.00 and a standard deviation of 17.48. Levene's test gives W = 33.866; p < 0.001, so the variances are not homogeneous and the Welch t is reported: t = 0.108; df = 9.13; p = 0.916. The difference is only 0.60 units and the 95% confidence interval runs from -11.92 to 13.12, so it includes zero.
t statistic (Welch-corrected t): 0.1081 · Degrees of freedom (df): 9.13 · p-value: p = 0.916
Comparison from summary statistics
Comparing x̄₁ = 82 (s₁ = 8, n₁ = 25) with x̄₂ = 76 (s₂ = 9, n₂ = 25), the variance ratio test gives F = 1.266; p = 0.568 and the variances are treated as homogeneous. The pooled t = 2.491; df = 48; p = 0.016, so H₀ is rejected. The 95% confidence interval for the difference runs from 1.16 to 10.84; with Cohen d = 0.705 the effect is medium.
t statistic (pooled (Student) t): 2.4914 · Degrees of freedom (df): 48 · p-value: p = 0.016