Skip to main content

Z-test Calculator

The z-test answers one question: is the difference between this sample mean and a population mean large enough to be real rather than chance? It applies when the population standard deviation is known — a genuinely rare situation, but a common one in quality control, where a process standard deviation is measured once and then treated as fixed.

The value you are testing against — the historical average or the specification limit.

Must be known in advance. If you are estimating it from the sample, use the t-test instead.

What Is the Z-test Calculator?

The z-test is a significance test for a mean. It asks whether a sample mean is far enough from a hypothesised population mean to be unlikely under the assumption that the null hypothesis is true.

It is the simplest of the two classical tests for a mean, and the one you use when the population standard deviation is already known rather than estimated from the data.

How Does the Z-test Calculator Work?

First the standard error of the mean: divide the population standard deviation by the square root of the sample size. Larger samples therefore produce a narrower standard error and a more sensitive test.

Then the z statistic: the gap between the sample mean and the null value, divided by that standard error. A z of 1.96 is the familiar threshold for a two-sided 5% test.

Finally the p-value, which is the area of the standard normal curve beyond ±z. Because that curve has fixed shape, the p-value depends only on the statistic, not on the units you measured in.

Z-test Calculator Formula & Variables

The core mathematical equation utilized by this calculator is expressed as:

z=xˉ−μ0σ/nreject H0 when ∣z∣>zαz = \frac{\bar{x} - \mu_0}{\sigma/\sqrt{n}} \qquad \text{reject } H_0 \text{ when } |z| > z_{\alpha}

Variable Definitions

SymbolVariable Meaning & Units
x̄sample mean
μ₀population mean under the null hypothesis
σknown population standard deviation
nsample size
z*critical value from the standard normal table

The z statistic measures the sample mean in standard-error units. Dividing the population standard deviation by √n gives the standard error of the mean, and the ratio of the observed gap to that standard error is how many standard errors the sample sits from the hypothesised value. The p-value is the area of the normal curve beyond that many standard errors.

How to Use the Z-test Calculator

  1. Choose one-sample or two-sample. One-sample compares your mean with a known population value; two-sample compares two independent groups when both population standard deviations are known.
  2. Set the alternative hypothesis before you look at the answer. Two-sided is the honest default unless a directional question was specified in advance.
  3. Pick a significance level. The conventional choices are 5% and 1%, and 5% is the one to use unless there is a specific reason otherwise.
  4. Read the p-value and the confidence interval together. They encode the same evidence, but the interval also shows the magnitude of the difference.

Step-by-Step Example Calculation

A sample of 36 items with mean 104 against a target of 100

Input Values:

mode:one_sample
direction:two_sided
alpha:0.05
mu0:100
mean1:104
sd1:6
n1:36
Worked Steps: The standard error is 6 ÷ √36 = 1, so z = 4. The two-sided p-value is about 0.000063, well under 5%, and the 95% interval runs from 102.04 to 105.96 — nowhere near the null value.

Understanding Your Result

A p-value below your chosen level means rejecting the null hypothesis: the data are inconsistent with the sample mean having come from that population. It does not mean the null hypothesis is false, and it does not measure how large the effect is.

The critical value is the boundary of rejection. Two-sided at 5% it is 1.96; one-sided it is 1.645. Comparing your |z| against that number gives the same answer as comparing the p-value against alpha.

The confidence interval is the most informative output. If it sits entirely on one side of the null value, the result is significant; if it straddles zero, it is not. Its width tells you how precisely the mean is pinned down.

Factors That Affect the Result

  • Sample size. The standard error shrinks as 1/√n, so quadrupling the sample roughly doubles the z statistic for the same difference.
  • How wrong the population standard deviation is. Because it enters the denominator directly, an overstated σ makes every test look insignificant.
  • The distance between the sample mean and the null value. This is the numerator, and it is the only part of the result that is about your data rather than your assumptions.
  • Whether the observations are genuinely independent. The standard error formula assumes they are; clustered or repeated measures break that assumption silently.

When Should You Use This Calculator?

  • Quality control, where a process standard deviation is measured once and then treated as known for ongoing checks.
  • Comparing against a specification limit rather than against another sample.
  • Large-sample work where the distinction between z and t has become numerically negligible.
  • Any coursework covering the standard normal test for a population mean.

Assumptions & Limitations

  • The population standard deviation must be known. Estimating it from the sample invalidates the standard normal reference and makes p-values anti-conservative.
  • The observations must be independent. Serial correlation or clustered sampling inflates the true standard error and makes the test too eager to declare significance.
  • Sample means are approximately normal for moderate sample sizes, but with small n and a badly skewed population the z approximation is poor.
  • The null value is treated as exact. If it is itself an estimate with real uncertainty, the test is overconfident.

Frequently Asked Questions

Calculation Accuracy & Reference Note

Normal probabilities come from an accurate numerical implementation of the error function, accurate to well beyond the digits displayed.

Standard Reference: Standard normal (z) test; critical values from the standard normal distribution.