Z-Test Calculator
The z-test checks whether a sample mean departs significantly from a theoretical value (μ₀) in the situation where the population standard deviation σ is known. It applies when σ is reliably known from earlier data: calibrated measuring instruments, standardized tests, and production records accumulated over many years.
The test statistic is the observed difference divided by the standard error of the sampling distribution, and it is judged directly against the standard normal distribution; there is no notion of degrees of freedom. The calculator returns z, the p-value for the direction you choose, the critical z, confidence intervals for both the mean and the difference, and Cohen's d, and it shades the rejection region on a normal curve.
One-Sample z-Test Formulas
Hypotheses: H₀: μ = μ₀ · H₁: μ ≠ μ₀ (two-tailed) Standard error: SE = σ / √n Test statistic: z = (x̄ − μ₀) / SE Two-tailed p: p = 2·[1 − Φ(|z|)] Right-tail p: p = 1 − Φ(z) Left-tail p: p = Φ(z) Critical value: two-tailed ±z₍₁−α/₂₎ · one-tailed z₍₁−α₎ Confidence int.: x̄ ± z₍₁−α/₂₎ · σ/√n Effect size: d = (x̄ − μ₀) / σ
Frequently used critical values: 1.645 for 90% · 1.960 for 95% · 2.576 for 99% (two-tailed). These values do not depend on sample size, because the z-test has no degrees of freedom.
How to Calculate
- Enter the population standard deviation (σ); this value must come from historical records or from the known properties of the measuring instrument.
- Paste the raw data, or switch to summary mode and type the sample mean and n.
- Set the test value (μ₀) the mean is to be compared against.
- Choose the hypothesis direction, the significance level (α), and the confidence level.
- Compare z with the critical z, and see on the shaded normal curve whether z falls inside the rejection region.
- Report the confidence interval and Cohen's d; if you have any doubt about σ, check the result with a t-test as well.
Worked Examples
Mean shift on a standardized test
The mean of the 12-person sample is 111.67. With σ = 15 known, the standard error is 4.33 and z = 2.694; the two-tailed test gives p = 0.007 and H₀ is rejected. The 95% confidence interval for the mean runs from 103.18 to 120.15 and does not cover 100; Cohen's d = 0.778 is a medium effect.
z statistic: 2.6943 · p-value: p = 0.007 · Critical z (α = 0.05): ±1.9600
Large sample from summary statistics
With n = 400 and σ = 15 the standard error is only 0.75; a difference of 1.50 units produces z = 2.000 and a two-tailed p = 0.046, so H₀ is rejected. Cohen's d = 0.100, on the other hand, makes the effect negligible. The 95% confidence interval for the mean runs from 100.03 to 102.97; this example shows plainly how a difference of no practical importance can still come out significant in a large sample.
z statistic: 2.0000 · p-value: p = 0.046 · Critical z (α = 0.05): ±1.9600
Left-tailed test — package fill weight
The mean of 40 packages is 497.50 grams and the known process standard deviation is 6 grams. The standard error is 0.9487, so z = -2.635, and the left-tailed test gives p = 0.004: the mean fill weight is below 500 grams. The 95% confidence interval for the difference runs from about -4.36 to -0.64 grams and does not cover zero; Cohen's d = -0.417 is a small effect.
z statistic: -2.6352 · p-value: p = 0.004 · Critical z (α = 0.05): -1.6449