Two-Sample Z-Test Statistic

z=xˉ1−xˉ2σ12n1+σ22n2z = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{\dfrac{\sigma_1^{2}}{n_1} + \dfrac{\sigma_2^{2}}{n_2}}}

Units aren’t used in this calculation: every value is a plain number.

sig figs

Worked example: means 82 vs 76, sigma 10 each, n 25 and 20 → z = 2. Press Try an example to run it live, then adjust anything.

Enter your known values, leave one input blank, and solves for the missing one. Tap a variable’s symbol to see what it means, with a typical value.

See also

One-Sample Z-Test Statistic: Both use test statistic and sample mean.Confidence Interval Lower Limit: Both use sample mean and standard deviation.Confidence Interval Upper Limit: Both use sample mean and standard deviation.One-Sample T-Test Statistic: Both use sample mean and standard deviation.Z-Score (Standard Score): Both use test statistic and standard deviation.Weighted Mean of Two Groups: Both use sample mean and sample size.
3 more relatedCohen's d (Effect Size): Both use sample mean.Regression Line Intercept: Both use sample mean.Arithmetic Mean of Two Numbers: Both use sample mean.
Learning zone

Two-Sample Z-Test Statistic explained

zx̄1x̄2σ1σ2

To compare two independent groups you need the standard error of the difference, and variances of independent quantities add: σ₁²/n₁ + σ₂²/n₂. Take the square root, divide the gap between the means by it, and you have a z that is read against the normal table exactly like a one-sample test. Two production lines averaging 82 and 76 with σ = 10 each and samples of 25 and 20 give a standard error of √(4 + 5) = 3, so z = 6/3 = 2.0, just past the two-sided 5% cutoff.

The mistake to avoid is averaging the two standard errors, or worse, comparing each group's confidence interval and concluding "they overlap, so no difference". Overlapping intervals frequently hide a significant difference, because the error on the gap is smaller than the sum of the individual errors. Note also that the smaller group dominates the denominator: with n₁ = 25 and n₂ = 20 above, shrinking group 2 to 5 observations would push the standard error from 3 to 4.9 and kill the result outright, no matter how large group 1 grew. Balance your groups when you can.

Two-Sample Z-Test Statistic formula

z=xˉ1−xˉ2σ12n1+σ22n2z = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{\dfrac{\sigma_1^{2}}{n_1} + \dfrac{\sigma_2^{2}}{n_2}}}
Where
  • zz= Test statistic
  • xˉ1\bar{x}_1= Mean of sample 1
  • xˉ2\bar{x}_2= Mean of sample 2
  • σ1\sigma_1= Standard deviation 1
  • n1n_1= Size of sample 1
  • σ2\sigma_2= Standard deviation 2
  • n2n_2= Size of sample 2
Revised 31 October 2026
Cite this page

formula.expert. (2026, October 31). Two-Sample Z-Test Statistic Formula & Calculator. https://formula.expert/solvers/two-sample-z-test