Two-Mean Difference Confidence Interval Calculator

StatisticsLast updated: August 22, 2026

When two independent groups are compared, answering "are the means different?" with a p-value alone hides both how large the difference is and how precise the estimate is. A confidence interval for the difference in means delivers both at once: the direction of the difference, its size, and its margin of uncertainty appear on a single line.

This calculator accepts raw data or summary statistics (n, x̄, s) and builds an interval for the difference (x̄₁ − x̄₂) by two methods: the pooled method, which assumes equal variances, and the Welch method, which does not. With the automatic option, the variance ratio decides which method is appropriate. If the interval contains zero, the calculator states plainly that the difference between the means is not statistically significant; with raw data it also draws a box plot of the two groups.

You can separate the numbers with commas, spaces, or line breaks. A comma may be used as the decimal separator (3,14).
You can separate the numbers with commas, spaces, or line breaks. A comma may be used as the decimal separator (3,14).
With the automatic option, the calculator switches to Welch when the larger variance is more than twice the smaller one.
The probability that the interval covers the true parameter.

Confidence Interval for the Difference of Two Means

Difference:          d = x̄₁ − x̄₂
Pooled variance:     sp² = [(n₁−1)s₁² + (n₂−1)s₂²] / (n₁ + n₂ − 2)
Pooled SE:           SE = sp · √(1/n₁ + 1/n₂),   df = n₁ + n₂ − 2
Welch SE:            SE = √( s₁²/n₁ + s₂²/n₂ )
Welch df:            df = (s₁²/n₁ + s₂²/n₂)² / [ (s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1) ]
Confidence interval: CI = d ± t(1−α/2; df) · SE
Effect size:         d_Cohen = (x̄₁ − x̄₂) / sp
Decision:            if 0 ∈ CI, the difference is not significant

The Welch degrees of freedom are usually not a whole number; the t distribution is defined for fractional degrees of freedom as well, and both SPSS and R report the same fractional value.

How to Calculate

  1. Choose the input format: paste the raw data of the two groups, or enter n, x̄, and s for each group.
  2. In raw-data mode, put each group in its own box; the groups may be of different sizes.
  3. Set the variance approach: if you are unsure, leave it on "Automatic", which switches to Welch when the variance ratio exceeds 2.
  4. Choose the confidence level; 95% is the standard choice in academic reporting.
  5. Check whether the resulting confidence interval contains zero: if it does, the difference is not significant.
  6. Use the box plot to inspect the spread and the outliers of the groups, then copy the reporting line into your write-up.

Worked Examples

Comparing the scores of two classes with raw data

The mean of group 1 is 83.60 (s = 4.09) and the mean of group 2 is 74.50 (s = 3.69); the difference is 9.100. Because the variance ratio is 1.228, the pooled variance is used: with a standard error of 1.7413, df = 18, and a critical t of 2.1009, the 95% confidence interval is [5.442; 12.758]. The interval does not contain zero, so the difference is significant (t = 5.2259; p < 0.001; d = 2.337).

95% confidence interval for the difference in means: [5.442; 12.758] · Difference in means (x̄₁ − x̄₂): 9.100 · Does the interval contain zero?: No — the difference is significant

A case where the interval contains zero

In two groups of 25, the means are 52.40 and 49.90; the difference is 2.500. With a pooled standard error of 2.8580, df = 48, and a critical t of 2.0106, the 95% confidence interval is [-3.246; 8.246]. Because the interval contains zero, the difference is not statistically significant (t = 0.8747; p = 0.386).

95% confidence interval for the difference in means: [-3.246; 8.246] · Difference in means (x̄₁ − x̄₂): 2.500 · Does the interval contain zero?: Yes — the difference is not significant

Welch when the variances differ

The variance ratio of 5.444 exceeds 2, so the automatic choice switches to the Welch method: with a standard error of 5.4836, an adjusted df = 19.73, and a critical t of 2.0878, the 95% confidence interval is [0.751; 23.649]. On the same data, the pooled method would have given [3.985; 20.415]. Because the interval stays just above zero the difference is significant (p = 0.038), but the closeness of the lower bound to zero shows that the estimate is weak.

95% confidence interval for the difference in means: [0.751; 23.649] · Difference in means (x̄₁ − x̄₂): 12.200 · Does the interval contain zero?: No — the difference is significant

Frequently Asked Questions

Should I use the pooled variance or Welch?
The Welch method does not need the equal-variance assumption, and even when the variances really are equal it gives results very close to the pooled method; for that reason most current sources recommend Welch as the default. The pooled method buys a slightly narrower interval only when the variances are similar and the group sizes are close. If the variance ratio exceeds 2 and the group sizes differ, always use Welch.
If the interval contains zero, should I say "there is no difference"?
No. Zero being inside the interval means that a true difference of zero cannot be ruled out by this data; it does not prove that there is no difference. If the interval is wide and covers zero, the correct phrasing is "no difference was detected; the study is not powered to show this difference." To claim equivalence, an equivalence test with a pre-specified equivalence margin is needed.
How is this interval related to the independent samples t-test?
They come from the same computation: if the 95% confidence interval does not contain zero, the two-tailed t-test gives p < 0.05, and if it does, p ≥ 0.05. Because the interval also shows the size of the difference in the unit of measurement and the precision of the estimate, APA 7 asks for the confidence interval to be reported alongside the p-value.
Is it a problem if the group sizes are very different?
With the pooled method, yes: when the variances are unequal and the smaller group has the larger variance, the true error rate exceeds the nominal level; in the opposite case the test becomes overly conservative. Welch is unaffected, because it weights each group's variance by that group's own sample size. In unbalanced designs, Welch is almost always the right choice.
Can I use this calculator when the measurements are matched (before-after)?
No. In a matched design the observations are not independent; a difference should be taken for each participant and a one-sample confidence interval built on the mean of those differences. The independent-groups formula overstates the standard error on paired data and needlessly reduces power.
How is Cohen's d interpreted?
Cohen's d divides the difference by the pooled standard deviation to give a unitless effect size. The traditional thresholds are 0.2 for a small, 0.5 for a moderate, and 0.8 for a large effect; those thresholds vary from field to field, though, and it is sounder to compare against typical effects in your own literature. Because the effect size is independent of sample size, it travels better than a p-value.
How do I get the same result in SPSS and R?
In SPSS, under Analyze → Compare Means → Independent-Samples T Test, the "Equal variances assumed" row gives the pooled interval and the "Equal variances not assumed" row gives the Welch interval. In R, t.test(x, y) returns the Welch interval by default and t.test(x, y, var.equal = TRUE) the pooled one; the conf.int field matches the values in this calculator.