Skip to main content

Z-test calculator

Enter the mean, the population standard deviation and the sample size — or paste raw values and let the calculator do the arithmetic. One-sample and two-sample, with the confidence interval and effect size next to the p-value.

Test type
What you have

Hypothesis direction

Paste your data to begin

You get the p-value, the effect size, and a confidence interval together — because a p-value on its own does not tell you whether the result matters.

The one thing that decides between Z and t

It is not sample size. It is whether the population standard deviation is known or estimated.

A t-test exists because estimating σ from your data adds a second source of uncertainty on top of the sampling variability of the mean. The t-distribution has heavier tails to account for it, which produces a larger and more honest p-value. If you know σ outright, that extra uncertainty is not there, and the normal distribution is correct.

So the question to ask is simply: where did σ come from? If the answer is "I calculated it from these numbers," it is estimated, and the t-test calculator is the right page — no matter how many observations you have.

When σ really is known

  • Standardised instruments. IQ tests, many clinical scales and standardised exams publish a population SD from large norming samples. Testing a new group against the published mean is a textbook one-sample Z-test.
  • Long-running industrial processes. A machine with years of calibration data has a process SD that is better established than anything a fresh sample of 40 could tell you.
  • Proportions. The variance of a proportion is p(1 − p) — determined by the proportion itself, with nothing left to estimate. This is why A/B testing uses a Z-test rather than a t-test.
  • Simulation. When you generated the data, you know the parameters.

Outside cases like these, σ is usually an assumption dressed up as a fact. The calculator warns you when your sample SD sits a long way from the σ you supplied, because that gap is the clearest sign the assumption is not holding.

The formulas

One sample against a fixed value:

z = (mean − μ₀) / (σ / √n)

Two independent samples with both population SDs known:

z = (mean₁ − mean₂) / √(σ₁²/n₁ + σ₂²/n₂)

There are no degrees of freedom in either, which is the practical signature of a Z-test. The standard normal distribution has no parameters to estimate, so if something is asking you for df, you are not running a Z-test.

Read the interval, not just the verdict

The confidence interval on the difference is reported in the units you measured in, which makes it the number that answers the question you actually care about. A significant Z-test whose interval runs from 0.2 to 14.0 has established that a difference exists and almost nothing about its size.

Cohen's d appears next to it for the same reason: with a large enough n, a difference of no practical consequence will clear any threshold you set. If you already have a Z-score and only want the tail area, the Z-score to p-value calculator converts it directly, and stays exact far past the point where most calculators return zero.

Frequently asked questions

How do I calculate a Z-test from the mean and standard deviation?

Enter n, the sample mean, and the population standard deviation σ, plus the value you are testing against. The statistic is z = (mean − μ₀) / (σ / √n), and the p-value is the corresponding area of the standard normal distribution. Select "Mean and SD" above and the calculator does it, along with the confidence interval and Cohen's d.

When should I use a Z-test instead of a t-test?

When you genuinely know the population standard deviation rather than estimating it from your sample. That is rarer than people assume — it applies to standardised instruments with published norms, industrial processes with long calibration histories, and simulations. If you computed the SD from the data in front of you, you are estimating it, and a t-test is the correct test whatever your sample size.

Is the "n greater than 30" rule real?

It is a rule of thumb about when the two tests agree numerically, not about which one is correct. Above about n = 30 the t-distribution is close enough to normal that the p-values match to three decimals, so the choice stops mattering in practice. It has never been the case that a large sample makes an estimated σ into a known one. With a calculator there is no reason to approximate: if you estimated the SD, use t.

What is the difference between a Z-test and a Z-score?

A Z-score standardises a single observation: how many standard deviations it sits from the mean. A Z-test standardises a sample mean against a hypothesised population mean, dividing by the standard error rather than the standard deviation. The arithmetic looks similar and the √n in the denominator is what separates them.

Can I use a Z-test for proportions?

Yes, and it is the most common legitimate use of one, because the variance of a proportion is fixed by the proportion itself — there is nothing left to estimate. For comparing two rates, the A/B test calculator runs exactly that two-proportion Z-test with the pooled standard error.

Why does the calculator warn me about my sigma?

Because the sample standard deviation is a long way from the σ you entered. That usually means σ came from an assumption rather than a known population, and an assumed σ carries uncertainty that a Z-test does not account for — it will give you a p-value that is too small. When the two disagree noticeably, a t-test is the safer report.