What the Z-Test Calculator does
This calculator runs the four common z-tests - one sample mean, two sample means, one proportion and two proportions - and gives the z statistic, the one- or two-tailed p-value, the critical value for your significance level, a confidence interval and a plain-language decision, with every step of the arithmetic written out so you can copy it into homework or a report.
A z-test asks whether the gap between what you observed and what a hypothesis predicts is bigger than random sampling would usually produce. It applies when the population standard deviation is known, or when samples are large enough that the normal approximation holds - which is why it is the standard test for proportions such as conversion rates, survey shares and pass rates.
How to use it
- Choose the test. Use a mean test for measurements (scores, weights, times) and a proportion test for counts of yes/no outcomes (sign-ups, defects, heads).
- Enter the data. For means, give the sample mean, the population standard deviation and the sample size; for proportions, give the number of successes and the sample size.
- Pick the alternative hypothesis: "not equal" for a two-tailed test, or "greater" or "less" if you predicted a direction before collecting data.
- Choose the significance level. 0.05 is the most common convention; 0.01 is stricter.
- Read the verdict, then the tiles and the working. The curve shades the rejection region and marks where your z statistic fell.
Reading the results
If the p-value is at or below alpha - equivalently, if z falls in the shaded rejection region - the result is statistically significant: data this extreme would be unusual if the null hypothesis were true.
"Not significant" does not mean "no difference". It means the data are compatible with no difference at this sample size. A larger sample might detect a real but small effect.
The confidence interval shows the plausible size of the effect. A two-sample interval that excludes zero agrees with a significant two-tailed test at the same level; its width tells you how precisely the effect is estimated.
Warnings appear when an assumption is shaky - small samples for a mean test, or fewer than about ten successes or failures for a proportion test. Treat the p-value as approximate in those cases.
Worked example: a class of 36 averaging 105 on a test normed at 100 with SD 15
The standard error is 15 / sqrt(36) = 15 / 6 = 2.5.
z = (105 - 100) / 2.5 = 2.00.
The upper tail beyond z = 2.00 is 0.02275, so the two-tailed p-value is 2 x 0.02275 = 0.0455. At alpha = 0.05 the critical value is 1.96, and 2.00 is beyond it, so the null hypothesis that the class mean is 100 is rejected.
The 95% confidence interval is 105 +/- 1.96 x 2.5 = 100.10 to 109.90. It just excludes 100, which is the same conclusion seen from the other side; at alpha = 0.01 (critical 2.576) the result would not be significant.
Formulas and scoring rules
- One-sample mean
z = (xbar - mu0) / (sigma / sqrt(n))- Two-sample means
z = (xbar1 - xbar2 - d0) / sqrt(sigma1^2 / n1 + sigma2^2 / n2)- One proportion
z = (phat - p0) / sqrt(p0 (1 - p0) / n), phat = x / n- Two proportions (pooled)
z = (phat1 - phat2) / sqrt(pbar (1 - pbar) (1/n1 + 1/n2)), pbar = (x1 + x2) / (n1 + n2)- p-value
two-tailed p = 2 x P(Z > |z|); right-tailed p = P(Z > z); left-tailed p = P(Z < z)Normal areas from Hart's algorithm 5666 (absolute error below 1e-14).- Critical value and interval
z_crit = Phi^-1(1 - alpha/2) for two tails; CI = estimate +/- z_crit x SEProportion intervals use the unpooled (Wald) standard error. Displayed values are rounded to 4 decimal places; nothing is rounded before the decision.
Z-test or t-test?
Use a z-test for a mean only when the population standard deviation is genuinely known - from a standardised test's norms or a long-running process, for example. If you estimated the standard deviation from the same sample, the correct test is a t-test, and with small samples the difference matters: at n = 10 the two-tailed 5% critical value is 2.262 for t but 1.960 for z, so a z-test would call too many results significant.
For proportions the z-test is the usual large-sample test, and the two-proportion version is what most A/B testing dashboards compute. With small counts an exact binomial test or Fisher's exact test is more reliable.
Limitations: what the result does not prove
- The tests assume independent observations - one response per person, no repeated measurements counted twice, no clustering. Violating this makes p-values far too small.
- Statistical significance is not practical importance. With a very large sample a trivial difference becomes significant; look at the confidence interval and decide whether the effect matters.
- Running many tests, or testing repeatedly while data arrive, inflates the false positive rate. This calculator does not correct for multiple comparisons or sequential peeking.
- The proportion tests use the normal approximation. Below about ten successes or failures in any group the result is approximate and an exact test is preferable.
Privacy: where your data goes
Everything you paste, type or drop is processed in this browser tab. It is not uploaded, logged, stored or sent to analytics. Session recording and tag-manager scripts are switched off on this page.
Standards and sources
- NIST/SEMATECH e-Handbook - 7.2.2 Are the data consistent with the assumed process mean?
- NIST/SEMATECH e-Handbook - 7.3.3 How can we determine whether two processes produce the same proportion of defectives?
- OpenStax Introductory Statistics - Hypothesis testing with one sample
- American Statistical Association statement on p-values (2016)
Frequently asked questions
When should I use a z-test instead of a t-test?
Use a z-test when the population standard deviation is known or for proportions with reasonably large samples. If you estimated the standard deviation from your sample, use a t-test; with large samples (n above about 30 to 50 in each group) the two give nearly the same answer.
How do I calculate a two-proportion z-test?
Compute each group's proportion, pool them as (x1 + x2) / (n1 + n2), find the standard error sqrt(pbar (1 - pbar) (1/n1 + 1/n2)) and divide the difference in proportions by it. For 60 of 200 against 45 of 200 that gives z = 1.705 and a two-tailed p-value of 0.088.
What does a z statistic of 2 mean?
The observed result is two standard errors away from what the null hypothesis predicts. In a two-tailed test that corresponds to p = 0.0455, which is significant at the 5% level but not at 1%.
What is the critical value of z at the 5% significance level?
1.960 for a two-tailed test, because 2.5% lies beyond it in each tail. For a one-tailed test at 5% it is 1.645. At 1% the values are 2.576 (two-tailed) and 2.326 (one-tailed).
Can I use a z-test for an A/B test of conversion rates?
Yes - the two-proportion z-test is the standard large-sample test for comparing two conversion rates. Decide the sample size in advance and do not stop the test the moment it becomes significant, because repeated peeking inflates false positives.
Why is my one-tailed p-value half the two-tailed one?
A two-tailed test counts results as extreme in either direction, so it adds the areas in both tails. When the observed difference points in the direction you predicted, the one-tailed p-value is exactly half. Choosing one tail after seeing the data is not legitimate.
Last reviewed by the A2Z.Tools team against the sources listed above.