One-Sample Z-Test
Test whether a sample mean differs from a known or target population mean when the population standard deviation is known. Get the z-statistic, p-value and confidence interval for a one- or two-tailed test.
Run One-Sample Z-Test →What is a One-Sample Z-Test?
A one-sample z-test compares the mean of a single sample against a known or hypothesized population mean. It answers whether the observed difference between your sample mean and the reference value is larger than would be expected from sampling variation alone.
The defining condition is that the population standard deviation is known. This is what distinguishes the z-test from the more commonly used one-sample t-test, which is used when the standard deviation must be estimated from the sample. In practice the population standard deviation is rarely known, so the z-test is used mainly with large samples or in settings where a long-established standard deviation exists.
The test computes a z-statistic, the standardized distance between the sample mean and the reference value, and converts it to a p-value using the standard normal distribution. A small p-value indicates the sample mean differs significantly from the reference.
In plain terms: You have one group of measurements and a target value, and you want to know if your group's average really differs from that target. The z-test does this when you already know the population's spread. If you don't know the spread (the usual case), use the t-test instead.
When to Use It
Known Sigma
Use the z-test only when the population standard deviation is genuinely known, not estimated from the sample.
One- vs Two-Tailed
A two-tailed test checks for any difference; a one-tailed test checks for a difference in a specific direction and has more power for that direction.
Large Samples
With large samples the t-test and z-test give nearly identical results, since the t-distribution approaches the normal.
Key Formulas
Interpreting the Result
Compare the p-value to your significance level (commonly 0.05). If p is below alpha, reject the null hypothesis and conclude the sample mean differs significantly from the reference value.
The confidence interval complements the test: if the hypothesized mean falls outside the interval, the two-tailed test is significant. Report the interval alongside the p-value, since it conveys the size and direction of the difference, not just its significance.
Assumptions & Validation
Known Population Sigma
The population standard deviation is known, not estimated.
If violated: Use the one-sample t-test, which estimates the standard deviation from the sample.
Random Sampling
Observations are an independent random sample from the population.
If violated: Address sampling bias; dependence invalidates the test.
Normality or Large n
The sampling distribution of the mean is approximately normal, satisfied for large samples by the Central Limit Theorem.
If violated: For small, clearly non-normal samples, use a non-parametric test.
⚠️ Check assumptions first
The one-sample z-test requires the population standard deviation to be known, which is uncommon in practice. If you are estimating the standard deviation from your own sample, the correct tool is the one-sample t-test, not the z-test. Using a z-test with an estimated standard deviation understates uncertainty and can make results look more significant than they are, especially with small samples.
When NOT to Use One-Sample Z-Test
Unknown Sigma
If the population standard deviation is estimated from the data, use the one-sample t-test instead.
Comparing Two Groups
To compare the means of two samples, use a two-sample t-test or z-test.
Non-normal Small Samples
For small samples that are clearly non-normal, use a non-parametric test such as the sign or Wilcoxon test.
Industry Applications
Quality Standards
Check whether a process mean has drifted from an established target when the historical standard deviation is well known.
Calibration Checks
Test whether measured output matches a known reference standard.
Large-Sample Surveys
Compare a large-sample mean against a benchmark where the population variability is established.
Process Monitoring
Confirm whether a sample of output is consistent with a known process mean and spread.
Frequently Asked Questions
When should I use a z-test instead of a t-test?
Use a one-sample z-test only when the population standard deviation is genuinely known, for example from a long-established process history. When the standard deviation is estimated from your sample, which is the usual situation, the one-sample t-test is correct. With large samples the two tests give almost identical results because the t-distribution approaches the normal, but the t-test remains the safe default when sigma is unknown.
What is the difference between one-tailed and two-tailed tests?
A two-tailed test checks whether the sample mean differs from the reference value in either direction and splits the significance level across both tails. A one-tailed test checks for a difference in a single, pre-specified direction and concentrates the significance level in one tail, giving more power to detect an effect in that direction. The choice must be made before seeing the data, based on the research question.
What does the z-statistic represent?
The z-statistic is the standardized distance between the sample mean and the hypothesized mean, measured in standard errors. A z of 2, for instance, means the sample mean lies two standard errors above the reference value. Larger absolute z-values correspond to smaller p-values and stronger evidence against the null hypothesis that the means are equal.
Does the z-test require normally distributed data?
The test relies on the sampling distribution of the mean being approximately normal. For large samples this holds by the Central Limit Theorem regardless of the underlying distribution, so normality of the raw data is not strictly required. For small samples the raw data should be approximately normal; if it is clearly not, a non-parametric test is more appropriate.
What does the p-value tell me?
The p-value is the probability of observing a difference as large as, or larger than, the one in your sample if the null hypothesis were true. A small p-value, below your chosen significance level such as 0.05, indicates the observed difference is unlikely under the null hypothesis, so you reject it. The p-value does not measure the size of the effect, which is why a confidence interval should accompany it.
How is the confidence interval related to the test?
For a two-tailed test, the confidence interval and the hypothesis test are equivalent: if the hypothesized mean lies outside the confidence interval, the test is significant at the corresponding level. The interval adds information the p-value alone does not, showing the plausible range for the true mean and thus the magnitude and direction of any difference, which is essential for judging practical importance.
Test a Mean Against a Known Standard
Run a one-sample z-test with z-statistic, p-value and confidence interval. Free during Beta.
Run One-Sample Z-Test →