Z-Test Calculator
Test a sample mean against a known population mean when the population standard deviation (σ) is known — with the z statistic, p-value, confidence intervals and Cohen's d.
The sample mean is 2.00 standard errors above the population mean (z = 2.0000, p = 0.0455).
Calculation
Standard normal curve — rejection region
The shaded tails beyond ±1.960 are the rejection region at α = 0.05 (two-tailed). The dot marks the observed z = 2.0000, which falls inside the shaded region.
A z-test compares a sample mean to a known population mean when the population standard deviation is known — a rare but classic case, and the foundation every t-test is taught against. Enter your sample mean, population mean, population SD and sample size, and get the z statistic, p-value, confidence interval and effect size.
How to use the z-test calculator
- Enter the sample mean (x̄), the population mean (μ₀), the known population SD (σ) and the sample size (n).
- Choose the significance level (α) and the tail: two-tailed, or one-tailed for μ > μ₀ or μ < μ₀.
- Read the headline z statistic, then check the results grid for the p-value, standard error, Cohen’s d, the 95% and 99% confidence intervals and the critical z. The calculation ledger shows every step, and the chart shades the rejection region.
Try it now: with x̄ = 105, μ₀ = 100, σ = 15 and n = 36, the calculator gives z = 2.00 and a two-tailed p-value of 0.0455 — significant at the 5% level. With x̄ = 48.5, μ₀ = 50, σ = 8 and n = 64, it gives z = −1.50 and p = 0.1336 — not significant.
When should you use a z-test?
Use a z-test when you have one sample and want to know whether its mean is compatible with a known population mean, and the population standard deviation (σ) is known — for example, whether a batch of components really averages the specified length, or whether a class mean differs from a national norm whose SD is published. It is the right test when:
- The population standard deviation (σ) is known (not estimated from the sample).
- The data are approximately normal, or the sample is large enough that the central limit theorem applies.
- Observations are independent and measured on a continuous scale.
- If σ is unknown and must be estimated from the sample, use the one-sample t-test instead — the calculator links to it under the σ field.
Because σ is known, the test uses the standard normal distribution, not the t-distribution. The same normal curve powers the p-value calculator from a z-score, where you can turn any z into a p-value.
Z-test vs t-test: which one do you need?
Both tests compare a sample mean with a value, but they assume different things about the population. The t-test is for unknown σ; the z-test is for known σ.
| Question | One-sample t-test | Z-test |
|---|---|---|
| Is σ known? | No — estimated from the sample (s) | Yes — σ is known |
| Sample size | Any, but essential when n < 30 | Large (usually n ≥ 30) |
| Distribution | t with df = n − 1 | Standard normal |
| Two-tailed cut-off at 95% (df = 24) | 2.064 | 1.960 |
| Typical use | Testing a mean with unknown σ | Testing a mean with known σ, or a proportion |
Common z critical values at α = 0.05 (two-tailed) are 1.960, at α = 0.01 they are 2.576 and at α = 0.10 they are 1.645. Notice how the cut-off falls towards 1.960 as α grows, and how the t cut-off approaches 1.960 as the sample grows.
If σ is known, a critical value calculator gives the cut-off you need. If you are testing a proportion rather than a mean, use the one-proportion z-test calculator instead. If you have two independent samples to compare, run a two-sample t-test instead — it tests whether the two means differ. If you need to plan how many observations to collect first, use the sample size calculator.
How the z-test works
The test turns the gap between your sample mean and the population mean into a z score — a distance measured in standard errors — and then asks how surprising that distance is under the null hypothesis.
- Standard error: SE = σ / √n. It shrinks as n grows, so larger samples give more precise estimates.
- z statistic: z = (x̄ − μ₀) / SE. It says how many standard errors the sample mean sits from μ₀.
- p-value: two-tailed p = 2 × (1 − Φ(|z|)); right-tailed p = 1 − Φ(z); left-tailed p = Φ(z), where Φ is the standard normal cumulative distribution function.
- Critical z: at α = 0.05, ±1.960 two-tailed and 1.645 one-tailed; at α = 0.01, ±2.576 two-tailed and 2.326 one-tailed; at α = 0.10, ±1.645 two-tailed and 1.282 one-tailed.
- Confidence interval: x̄ ± z* × SE, with z* = 1.960 for 95% and 2.576 for 99%.
- Cohen’s d: d = (x̄ − μ₀) / σ. Roughly, 0.2 is small, 0.5 is medium and 0.8 is large. An effect size calculator can put d alongside other measures.
The confidence interval and the p-value must agree: if the 95% CI excludes μ₀, the two-tailed test at 5% rejects — and vice versa. They are two views of one calculation, so if they ever disagree, one of them was computed with different inputs.
Worked examples
Example 1 — IQ scores (significant)
A school psychologist wants to know whether a group of 36 pupils has a mean IQ different from the national mean of 100. The population SD for IQ is known to be 15, and the sample mean is 105. Testing H₀: μ = 100 at α = 0.05, two-tailed: SE = 15 / √36 = 2.50, so z = (105 − 100) / 2.50 = 2.00. The two-tailed p-value is 0.0455 (right-tailed 0.0228, left-tailed 0.9772) and the critical z is ±1.960, so |2.00| > 1.960 and we reject H₀. Cohen’s d = 0.333 (small) and the 95% CI is [100.1, 109.9], which just excludes 100, while the 99% CI [98.56, 111.44] includes it.
Interpretation: significant at α = .05 (p = 0.0455) but not at α = .01; the 95% CI just excludes 100 (lower bound 100.1) while the 99% CI includes it — the two answers agree, as they must.
Example 2 — Blood pressure (not significant)
A clinic compares the mean of a blood-pressure measure in 64 patients with a known population mean of 50. The population SD is known to be 8, and the sample mean is 48.5. Testing H₀: μ = 50 at α = 0.05, two-tailed: SE = 8 / √64 = 1.00, so z = (48.5 − 50) / 1.00 = −1.50. The two-tailed p-value is 0.1336 (right-tailed 0.9332, left-tailed 0.0668) and the critical z is ±1.960, so |−1.50| < 1.960 and we fail to reject H₀. Cohen’s d = −0.1875 (small). The 95% CI is [46.54, 50.46] and the 99% CI is [45.924, 51.076], both of which include 50.
Interpretation: not significant; the CI includes 50 and the effect is small (d = −0.19).
How to read the results together
Four numbers, one story. Read them as a group rather than in isolation:
- z: how many standard errors the sample mean sits from μ₀.
- p-value: whether that distance is surprising if the null hypothesis were true. If p < α, reject H₀; if p > α, do not.
- Cohen’s d: how big the difference is in SD units. A significant p with a tiny d can mean a real but trivial difference.
- Confidence interval: the range of plausible values for the true mean. If it excludes μ₀, the two-tailed test at 5% rejects — the two must agree.
A non-significant result does not prove the null is true; it only says the data are compatible with it. A wide CI alongside a non-significant p means the data are compatible with a range of values, not just with μ₀.
Assumptions of the z-test
- The population standard deviation (σ) is known. If it is estimated from the sample, use a t-test instead.
- The data are approximately normal, or the sample is large enough that the central limit theorem applies.
- Observations are independent — no pairing, clustering or repeated measures on the same subjects.
- The sample is a random sample from the population you want to generalise to.
- The measurement scale is continuous (interval or ratio).
How to report a z-test (APA)
Report the sample mean, the population mean, the z statistic, the p-value, the confidence interval and the effect size. Copy the sentence below and replace the numbers with your own:
For a non-significant result, the same pattern reads: A one-sample z-test showed that the sample mean (M = 48.5) did not differ significantly from the population mean of 50, z = −1.50, p =.134, 95% CI [46.54, 50.46], d = −0.19.
Cite this tool
Shafiq, A. (2026). Z-Test Calculator. Empirical Rule Calculators. https://empiricalrulecalculators.com/z-test-calculator/
Frequently asked questions
Z-test or t-test — which do I use?
Use a z-test when the population SD (σ) is known; use a t-test when σ is unknown and estimated from the sample. In practice σ is rarely known, which is why the t-test is the everyday choice — but the z-test is the foundation the t-test is taught against, and it is exact for normal data when σ is known.
What does ‘known population SD’ mean in practice?
It means σ comes from outside your sample — a published norm, a manufacturing specification, a previous large study — not computed from the data you are testing. IQ (σ = 15) is the classic example. If you computed the SD from your own sample, that is s, not σ, and you need a t-test.
Why do the CI and the p-value always agree?
Because both are built from the same z statistic and the same standard error. A two-tailed test at α = 0.05 rejects exactly when the 95% CI excludes μ₀. They are two views of one calculation, so if they ever disagree, one of them was computed with different inputs.
One-tailed or two-tailed?
Two-tailed unless you stated a direction before seeing the data. A one-tailed test has more power in the stated direction but no power at all in the other — and switching to one-tailed after seeing the result is not legitimate.
What sample size do I need?
There is no minimum for a z-test (it is exact for normal data when σ is known), but larger samples give narrower confidence intervals and more power. To plan a sample size in advance, use the sample size calculator.
All examples on this page were checked against SciPy 1.11.4 (scipy.stats.norm). The anchor check z = 1.96 gives a two-tailed p-value of 0.05 exactly.
See all 106 free statistics tools on Empirical Rule Calculators.
Next steps
One-Proportion Z-Test Calculator
Test a sample proportion against a claimed value with a z-test and a p-value.
Try Calculator →Two-Sample T-Test Calculator
Compare the means of two independent samples with a t-test and a confidence interval.
Try Calculator →One-Sample T-Test Calculator
Test a sample mean when the population SD is unknown — the t-test version of the z-test.
Try Calculator →More Tools to Explore
Keep going with the calculators that pair with the z-test — proportions, t-tests, sample size, critical values and z-scores.
One-Proportion Z-Test Calculator
Test a sample proportion against a claimed value with a z-test and a p-value.
Try Calculator →Two-Sample T-Test Calculator
Compare the means of two independent samples with a t-test and a confidence interval.
Try Calculator →One-Sample T-Test Calculator
Test a sample mean when the population SD is unknown — the t-test version of the z-test.
Try Calculator →Sample Size Calculator
Work out how many observations you need for a mean or a proportion before you collect data.
Try Calculator →Critical Z-Value Calculator
Find the z cut-offs (1.645, 1.96, 2.576) for your confidence level in one step.
Try Calculator →Z-Score Calculator
Turn any raw score into a z-score and read off its percentile in seconds.
Try Calculator →Explore All Tools
Browse all 106 free statistics tools — every calculator on this site in one place.
Browse All Tools