What this calculator does
This tests a sample mean against a hypothesised population mean when the population standard deviation is genuinely known. A sample of 36 with a mean of 104 against a hypothesis of 100, with a known sigma of 15, gives z = 1.600 and a p-value of 0.1096.
The condition that sigma is known is stricter than it sounds, and it is rarely satisfied outside textbooks and standardised testing. If you estimated the standard deviation from your own sample, you should be using a t-test instead. The difference is small for large samples and substantial for small ones.
The formula
The z-statistic is the difference between the sample mean and the hypothesised mean, divided by the standard error, which is the known population standard deviation over the square root of the sample size. The p-value is two-tailed. Because sigma is treated as known rather than estimated, the reference distribution is the normal rather than the t.
| Term | Meaning |
|---|---|
| σ (sigma) | The population standard deviation, which must be known rather than estimated. |
| μ₀ | The hypothesised population mean. |
| Standard error | σ/√n, the sampling variability of the mean. |
| Two-tailed p-value | The chance of a result at least this extreme in either direction, if the hypothesis is true. |
The inputs explained
| Field | What to enter |
|---|---|
| Sample mean | The observed sample mean. |
| Hypothesised population mean μ₀ | The hypothesised population mean. |
| Known population standard deviation σ | Known population standard deviation. If you calculated this from your sample, use a t-test instead. |
| Sample size | Sample size. |
When to use it
Testing against a standardised scale
IQ-style tests and other instruments calibrated to a fixed mean and standard deviation are the genuine use case.
Monitoring a stable process
Where long production history has established the process standard deviation, it can reasonably be treated as known.
Teaching hypothesis testing
The z-test is the simplest complete example, which is why it appears before the t-test in every course.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
What does each sample mean give?
A range of sample means against the same hypothesis.
| Sample mean | Z-statistic | Two-tailed p-value | Significant at 5%? |
|---|---|---|---|
| 100 | 0 | 1.0000 | No |
| 102 | 0.8000 | 0.4237 | No |
| 104 | 1.600 | 0.1096 | No |
| 108 | 3.200 | 0.0014 | Yes |
Questions
When should I use a z-test instead of a t-test?
Only when the population standard deviation is genuinely known from outside your sample. If you calculated it from the data you are testing, a t-test is correct. In practice this means the z-test is rarely the right choice outside standardised instruments and well-characterised processes.
Does it matter with a large sample?
Less and less. The t-distribution converges to the normal as degrees of freedom grow, so above about n = 30 the two tests give nearly identical answers. Below that the t-test gives noticeably wider intervals, which is the correction for having estimated sigma.
What does the p-value mean?
The probability of observing a result at least this far from the hypothesised mean, in either direction, if the hypothesis were true. It is not the probability that the hypothesis is true, which is a different quantity requiring a prior.
What if my data is not normal?
For a reasonably large sample the central limit theorem makes the sampling distribution of the mean approximately normal regardless, so the test remains usable. For small samples from clearly non-normal data, a nonparametric test is safer.
For an estimated standard deviation, see the t-statistic calculator. For testing a proportion, see the z-test for a proportion calculator.