StatGardenREF. DESK
Calculators/Statistics/Z-test for a single mean
Statistics

Z-test for a single mean calculator

Tests a sample mean against a hypothesised mean when the population standard deviation is known

Published 8 August 2026 · Updated 25 September 2026

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

Formulaz = (x̄ − μ₀) / (σ/√n)

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.

TermMeaning
σ (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-valueThe chance of a result at least this extreme in either direction, if the hypothesis is true.

The inputs explained

FieldWhat to enter
Sample meanThe 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 sizeSample 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.

μ₀ = 100, σ = 15, n = 36
Sample meanZ-statisticTwo-tailed p-valueSignificant at 5%?
10001.0000No
1020.80000.4237No
1041.6000.1096No
1083.2000.0014Yes
The standard error is 2.500 in every row, so each 2.5 points of difference is worth exactly 1 on the z scale. A mean of 104 is 1.6 standard errors out and not significant; 108 is 3.2 out and highly significant at p = 0.0014. The threshold sits at about 104.9.

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.