Z-Test for Difference Between Two Population Means

Use this calculator to test if two population means differ when both population standard deviations are known (rare scenario).

When to Use

  • Two independent samples from different populations
  • Both population SDs known (σ₁ and σ₂)
  • Large samples or normal populations
  • Testing if means differ between two groups
  • Note: Use t-test instead in almost all practical situations

How to Use

Step 1: Enter sample 1 mean and sample 2 mean

Step 2: Enter both population standard deviations

Step 3: Enter both sample sizes

Step 4: Enter level of significance (α, typically 0.05)

Step 5: Select tail type (left, right, or two-tailed)

Step 6: Click “Calculate”

Interpret: If p-value < α, means differ significantly

Z test Calculator for two means
  Sample 1 Sample 2
Sample Mean
Standard Deviation
Sample Size
Level of Significance ($\alpha$)
Tail Left tailed Right tailed Two tailed
Results
Standard Error of Diff. of Means:
Test Statistics Z:
Z-critical value(s):
p-value:

Test Formula

$$Z = \frac{(\overline{x}_1 - \overline{x}_2) - 0}{\sqrt{\frac{\sigma_1^2}{n_1} + \frac{\sigma_2^2}{n_2}}}$$

Where:

  • $\overline{x}_1, \overline{x}_2$ = sample means
  • $\sigma_1, \sigma_2$ = known population standard deviations
  • $n_1, n_2$ = sample sizes

Worked Example

Scenario: Comparing average salary between two departments. Dept A (n₁=50, x̄₁=$55K, σ₁=$8K) vs Dept B (n₂=60, x̄₂=$52K, σ₂=$7K).

Hypotheses:

  • H₀: μ₁ = μ₂ (salaries are equal)
  • H₁: μ₁ ≠ μ₂ (salaries differ, two-tailed)

Calculation:

  • $SE = \sqrt{\frac{64M}{50} + \frac{49M}{60}} = 1.37$
  • $Z = (55-52)/1.37 = 2.19$
  • For α=0.05, critical Z = ±1.96
  • p-value = 0.029

Decision: p-value (0.029) < α (0.05), reject H₀. Significant evidence that departments have different average salaries.


⚠️ Use t-test instead - Population SDs are rarely known in practice

Related: T-test for Two Means, Tutorial