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.
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
Frequently asked questions
Sources & references
- NIST/SEMATECH e-Handbook §1.3.5.2 — One-sample location test (z)
- NIST/SEMATECH e-Handbook §7.2.2 — Comparison of two means
- NIST/SEMATECH e-Handbook §7.3.3 — Comparison of two proportions
- NIST/SEMATECH e-Handbook §1.3.6.7.1 — Critical values of the standard normal
- Abramowitz & Stegun §7.1.26 — Rational approximation of the error function
The formulas and the p-value engine on this page were last cross-checked against the NIST e-Handbook and standard-normal critical-value table on 2026-07-15.
Related tools
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.