Z-test Calculator

Run a one-sample z-test: enter your sample mean, the hypothesized population mean, the known population standard deviation, and the sample size to get the z statistic and p-value.

Quick Facts

Formula
z = (x̄ − μ₀) / (σ / √n)
The p-value comes from the standard normal distribution. Use a z-test only when the population standard deviation σ is known.

Your Results

Calculated
Z statistic
-
(x̄ − μ₀) / standard error
P-value
-
Probability under H₀
Standard error
-
σ / √n
Decision (α = 0.05)
-
Reject or fail to reject H₀

Ready

Enter your sample statistics and run the test.

The one-sample z-test

The one-sample z-test checks whether a sample mean is consistent with a hypothesized population mean when the population standard deviation is already known. The test statistic is:

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

Here x̄ is the sample mean, μ₀ is the population mean under the null hypothesis, σ is the known population standard deviation, and n is the sample size. The denominator σ/√n is the standard error of the mean — the standard deviation of the sampling distribution of x̄. The z statistic simply expresses how many standard errors the observed mean sits from μ₀.

Getting a p-value from z

Under the null hypothesis, z follows the standard normal distribution N(0, 1). The p-value is the area in the tail(s) beyond the observed z. For a two-tailed test, p = 2 × P(Z > |z|); for a one-tailed test you use a single tail. At the common significance level α = 0.05, the two-tailed critical values are z = ±1.96, so any |z| above 1.96 rejects the null. For one-tailed tests at α = 0.05 the critical value is 1.645.

When to use a z-test instead of a t-test

Use the z-test only when the population standard deviation σ is genuinely known — for example, from a well-established measurement process or a large historical dataset. If you only have the sample's own standard deviation s, use a t-test instead, which accounts for the extra uncertainty of estimating the spread. In practice the two agree closely once n is large (roughly n > 30), because the t-distribution converges to the normal.

Common reference z-values

  • ±1.645 — two-tailed 90% / one-tailed 95% (α = 0.10 two-tailed).
  • ±1.96 — two-tailed 95% confidence (α = 0.05), the most-cited threshold.
  • ±2.576 — two-tailed 99% confidence (α = 0.01).
  • ±3.291 — two-tailed 99.9% confidence (α = 0.001).

Frequently Asked Questions

What is the difference between a z-test and a t-test?
Both compare a sample mean to a hypothesized mean, but the z-test uses the known population standard deviation σ, while the t-test uses the sample standard deviation s and refers the result to a t-distribution with n−1 degrees of freedom. Use the z-test when σ is truly known; otherwise use the t-test. For large samples the two give almost identical p-values.
What does the p-value actually mean here?
The p-value is the probability of observing a sample mean at least as far from μ₀ as yours, if the null hypothesis (true mean = μ₀) were correct. A small p-value means such a result would be unlikely by chance alone, which is evidence against the null. It is not the probability that the null is true.
Should I use a one-tailed or two-tailed test?
Use a two-tailed test when you care about any difference from μ₀ in either direction — this is the default and the more conservative choice. Use a one-tailed test only when you have a directional hypothesis decided in advance (e.g. the new process can only increase the mean), because it puts all of α in one tail and so rejects more easily on that side.
Why do I need to know the population standard deviation?
The z-test's denominator σ/√n uses σ as a fixed, known quantity, which is what lets the statistic follow the exact standard normal distribution. If you plug in the sample standard deviation instead, that quantity is itself estimated with error, and the correct reference distribution becomes the t-distribution, not the normal.