induwara.lk
induwara.lkEducation · Statistics

Z-Test Calculator — One-Sample, Two-Sample & Proportions

Enter your summary statistics and get the z-statistic, the one- or two-tailed p-value, the critical z-value and decision at your chosen α, plus a confidence interval and every step of the working. Handles a mean, two means, one proportion, and two proportions.

By Induwara AshinsanaUpdated Jul 15, 2026
Z-test from summary statistics
NIST formulas · cross-checked

Known population standard deviation (> 0).

Try an example
Hypothesis tail

Any value from 0.0001 to 0.5. 0.05 is the usual default.

Fail to reject H₀ — not statistically significant (two-tailed p = 0.0956 ≥ α = 0.05).
Method: One-sample z-test for a mean (σ known), n = 25
z-statistic
1.6667
p-value (two-tailed)
0.0956
critical z (α = 0.05)
±1.96
95% CI for mean
[499.12, 510.88]
With n = 25 (< 30) the z-test relies on σ being genuinely known. If you estimated σ from the sample, use a t-test instead.

Show working

  1. SE = σ / √n = 15 / √25 = 3
  2. z = (x̄ − μ₀) / SE = (505 − 500) / 3 = 5 / 3
  3. two-tailed p-value = 2·(1 − Φ(1.6667)) = 0.095581
  4. critical z (two-tailed, α = 0.05) = ±1.96

Cross-check: Φ(1.6667) evaluated by the erf approximation and by the independent Zelen & Severo formula agree to better than 1 part in 10 million.

Sources cited

How it works

A z-test asks whether an observed statistic — a mean or a proportion — is far enough from a hypothesised value that random sampling alone is an unlikely explanation. What separates it from a t-test is the assumption that the population standard deviation is known, or that the sample is large enough for the normal approximation to hold. Every version reduces to the same shape: z equals the quantity you care about, minus its null value, divided by its standard error. The formulas below follow the NIST/SEMATECH e-Handbook of Statistical Methods.

One-sample mean. To test a sample mean x̄ against a hypothesised μ₀ with known σ, use SE = σ/√n and z = (x̄ − μ₀) / SE (§1.3.5.2).

Two-sample means. For two independent groups with known σ₁ and σ₂, the standard error of the difference is √(σ₁²/n₁ + σ₂²/n₂), so z = ((x̄₁ − x̄₂) − D₀) / √(σ₁²/n₁ + σ₂²/n₂), where D₀ is the hypothesised difference, normally 0 (§7.2.2).

One proportion. With p̂ = x/n, the test uses the standard error implied by the null value: z = (p̂ − p₀) / √(p₀(1 − p₀)/n) (§7.2.4).

Two proportions. Under the null the two samples share one rate, so the standard error uses the pooled proportion p̂ = (x₁ + x₂)/(n₁ + n₂): z = (p̂₁ − p̂₂) / √(p̂(1 − p̂)(1/n₁ + 1/n₂)) (§7.3.3).

The p-valuecomes from the standard-normal CDF Φ. A two-tailed test gives p = 2·(1 − Φ(|z|)); a right-tailed test gives 1 − Φ(z); a left-tailed test gives Φ(z). This tool evaluates Φ from the error function (Abramowitz & Stegun 7.1.26), so any z resolves exactly rather than being read off a rounded table, and cross-checks it against the independent Zelen & Severo formula (26.2.17). The critical values are the standard-normal percent points — ±1.645 at α=0.1, ±1.960 at α=0.05, ±2.576 at α=0.01 for two-tailed tests — and the confidence interval for the mean is x̄ ± z_{α/2}·(σ/√n), with the analogous forms for the two-sample and proportion cases.

Worked examples

One-sample mean, two-tailed

Bottling line: does the mean fill differ from 500 ml?

  1. Known σ = 15 ml, sample n = 25, sample mean x̄ = 505 ml, μ₀ = 500
  2. SE = σ / √n = 15 / √25 = 15 / 5 = 3
  3. z = (x̄ − μ₀) / SE = (505 − 500) / 3 = 1.6667
  4. Two-tailed p = 2·(1 − Φ(1.6667)) = 2·(1 − 0.95221) = 0.0956
  5. Critical value at α = 0.05: ±1.960

|1.6667| < 1.960 and p = 0.0956 > 0.05 → fail to reject H₀. No significant evidence the line is off-target.

Two-proportion, two-tailed

Do defect rates differ between two software releases?

  1. Release A: 40 defects in 200 builds → p̂₁ = 0.20
  2. Release B: 60 defects in 200 builds → p̂₂ = 0.30
  3. Pooled p̂ = (40 + 60)/(200 + 200) = 100/400 = 0.25
  4. SE = √(0.25·0.75·(1/200 + 1/200)) = √0.001875 = 0.043301
  5. z = (0.20 − 0.30) / 0.043301 = −2.3094
  6. Two-tailed p = 2·(1 − Φ(2.3094)) = 0.0209

|−2.3094| > 1.960 and p = 0.0209 < 0.05 → reject H₀. The defect rates differ; release B is significantly worse.

Two-sample means, left-tailed (edge case)

Is line 1's fill lower than line 2's? Fractional, negative z

  1. Line 1: x̄₁ = 98.6, σ₁ = 2.5, n₁ = 30
  2. Line 2: x̄₂ = 100.2, σ₂ = 3.0, n₂ = 40, tested difference D₀ = 0
  3. SE = √(2.5²/30 + 3²/40) = √(0.20833 + 0.225) = √0.43333 = 0.65828
  4. z = (98.6 − 100.2) / 0.65828 = −1.6 / 0.65828 = −2.4306
  5. Left-tailed p = Φ(−2.4306) = 0.00754
  6. Critical value at α = 0.05 (left): −1.645

−2.4306 < −1.645 and p = 0.00754 < 0.05 → reject H₀. Line 1 fills significantly lower than line 2.

Frequently asked questions

Sources & references

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.