The one-sample z-test
The one-sample z-test checks whether a sample mean is consistent with a hypothesized population mean when the population standard deviation is already known. The test statistic is:
z = (x̄ − μ₀) / (σ / √n)
Here x̄ is the sample mean, μ₀ is the population mean under the null hypothesis, σ is the known population standard deviation, and n is the sample size. The denominator σ/√n is the standard error of the mean — the standard deviation of the sampling distribution of x̄. The z statistic simply expresses how many standard errors the observed mean sits from μ₀.
Getting a p-value from z
Under the null hypothesis, z follows the standard normal distribution N(0, 1). The p-value is the area in the tail(s) beyond the observed z. For a two-tailed test, p = 2 × P(Z > |z|); for a one-tailed test you use a single tail. At the common significance level α = 0.05, the two-tailed critical values are z = ±1.96, so any |z| above 1.96 rejects the null. For one-tailed tests at α = 0.05 the critical value is 1.645.
When to use a z-test instead of a t-test
Use the z-test only when the population standard deviation σ is genuinely known — for example, from a well-established measurement process or a large historical dataset. If you only have the sample's own standard deviation s, use a t-test instead, which accounts for the extra uncertainty of estimating the spread. In practice the two agree closely once n is large (roughly n > 30), because the t-distribution converges to the normal.
Common reference z-values
- ±1.645 — two-tailed 90% / one-tailed 95% (α = 0.10 two-tailed).
- ±1.96 — two-tailed 95% confidence (α = 0.05), the most-cited threshold.
- ±2.576 — two-tailed 99% confidence (α = 0.01).
- ±3.291 — two-tailed 99.9% confidence (α = 0.001).