A z-test answers a focused question: is this sample mean plausibly consistent with a known population mean, or is it far enough away to be surprising? It is used when the population standard deviation is known, or when the sample is large enough that the estimated standard deviation behaves almost like a known one. The Z-Test Calculator performs the arithmetic, but the value of the test lies in setting it up correctly: stating the null hypothesis, choosing the direction of the test, and interpreting the result without overstating it.
The null hypothesis is the starting assumption, usually that the sample comes from a population with the known mean. The test statistic measures how far the sample mean sits from that mean, in units of standard error. The standard error is the standard deviation of sample means, and it equals the population standard deviation divided by the square root of the sample size. That square-root relationship is the key intuition: quadrupling the sample size halves the standard error, because the square root of 4 is 2, so larger samples detect smaller differences, but with diminishing returns. The z statistic itself equals the sample mean minus the population mean, divided by the standard error. A z of 2 means the sample mean sits two standard errors from the population mean, which is surprising under the null model but not impossible.
The p-value then translates that distance into a tail probability, as explained in the companion conversion guide. A two-tailed p-value asks how often a sample mean at least this far from the population mean, in either direction, would occur if the null model were true. A one-tailed p-value asks the same question in one direction only, and it must be chosen from the research question before the data are examined, not after a result is seen. The familiar 0.05 threshold is a convention, not a law of nature, and a p-value just above it is not meaningfully different from one just below it. This guide is general educational information, not statistical advice for a specific study, and small or important studies deserve specialist review.
A worked example
Suppose a population has a known mean of 100 and a known standard deviation of 15. You take a sample of 36 observations and find a sample mean of 105. The standard error is 15 divided by the square root of 36. The square root of 36 is 6, so the standard error is 15 divided by 6, which is 2.5. The z statistic is the sample mean minus the population mean, divided by the standard error: 105 minus 100 is 5, and 5 divided by 2.5 is 2.00. The two-tailed p-value for a z of 2.00 is about 0.0455, because the upper tail above 2.00 is about 0.0228 and the lower tail below negative 2.00 is also about 0.0228, and 0.0228 plus 0.0228 equals 0.0456, usually rounded to 0.0455 in standard tables. In plain language, if the null model were true, a sample mean at least 5 points from 100 in either direction would occur about 4.6 percent of the time with samples of this size. That is some evidence against the null model, but it is not proof that the alternative is true, and it says nothing on its own about whether a 5-point difference matters in practice.
Notice how sample size changes the same difference. With a sample of 9 instead of 36, the standard error would be 15 divided by the square root of 9, which is 15 divided by 3, which is 5. The z statistic would be 5 divided by 5, which is 1.00, with a two-tailed p-value of about 0.317. The same 5-point gap that looked surprising with 36 observations looks ordinary with 9, because smaller samples vary more. That is why reporting a sample size alongside a p-value is essential: without it, the p-value cannot be understood or checked.
Common mistakes
The first mistake is using a z-test when the population standard deviation is unknown and the sample is small; a t-test is the usual alternative there, and the choice should be made with a statistics reference or adviser. The second mistake is choosing a one-tailed test after seeing the direction of the result, which halves the p-value without justification. The third mistake is reading a p-value as the probability that the null hypothesis is true, which it is not. The fourth mistake is confusing statistical surprise with practical importance: a tiny difference can be statistically surprising with a huge sample while mattering little in the real world, so always report the size of the difference alongside the p-value. The fifth mistake is testing many outcomes and reporting only the smallest p-value, which exaggerates surprise because many chances were taken to find something extreme.
Assumptions deserve a sentence in any report. A z-test for a mean assumes observations are independent and, for small samples, approximately normally distributed or drawn from a population where the mean's sampling distribution is approximately normal. Outliers, clustered data, or non-independent observations, such as repeated measurements on the same people treated as separate people, can invalidate the calculation. If those conditions do not hold, the p-value is a number without its intended meaning, however precisely it is calculated.
A practical routine
A routine that works for most z-tests has five steps. First, state the null hypothesis and the population mean and standard deviation. Second, decide one-tailed or two-tailed from the question, before examining the result. Third, calculate the standard error and the z statistic with the steps shown above. Fourth, find the matching p-value and report the sample size, the observed difference, and the p-value together. Fifth, interpret the result in plain language, including whether the difference matters practically. For planning a study, the Statistical Power Calculator estimates the chance of detecting a given effect, and the Research Sample Size Calculator estimates the sample needed for a survey. For the mean at the heart of the test, the guide Average Calculator Guide explains how a sample mean is calculated.
A z-test is a disciplined way to ask whether a sample mean surprises you. Set it up before you look, show the arithmetic, and report the size of the difference with the p-value, so the result informs a decision instead of replacing one.