Advertisement
Advertisement
STATISTICS

Z-Test Calculator — one and two sample, means and proportions

Run a one- or two-sample z-test for means with known population variance, or for proportions, and get the statistic, the p-value and the decision.

The mean tests assume the population standard deviation is known. If you are estimating it from the sample, a t-test is the correct procedure.
The value under the null hypothesis. For a two-sample test this is the hypothesised difference, usually 0.
Test statistic z
0
 
0
p-value
0
Critical value at α
0
Standard error
Decision at α
Tip: failing to reject the null is not evidence that it is true. It means the data did not separate the two possibilities at this sample size, which is a statement about the study rather than about the world.
Advertisement

This z-test calculator runs the four standard z procedures: a one-sample test of a mean against a hypothesised value, a two-sample comparison of means, a one-sample test of a proportion, and a two-sample comparison of proportions. It returns the z statistic, the standard error behind it, the p-value, the critical value at your chosen significance level, and the resulting decision.

Arb Digital publishes it because the z-test has one defining assumption that other pages tend to gloss over. For the mean tests, the population standard deviation must be known, not estimated from the sample. That single condition is what separates the z-test from the t-test, and it is the reason this page exists alongside the other tools we publish on hypothesis testing.

What This Z-Test Calculator Does, and Where It Sits

It performs the complete test end to end. That is a different job from three adjacent tools on this site, and the boundaries are worth stating precisely. Our z-score calculator standardises a single observation — how many standard deviations an individual value sits from a mean — and does not test a hypothesis at all. Our critical value calculator returns the cut-off statistic for a chosen alpha and distribution but takes no data. Our hypothesis testing calculator is the general framework page covering the logic, the error types and the decision rule across procedures.

This page is the specific procedure: the z-test itself, with the known-variance assumption stated and enforced in the inputs. If you do not know the population standard deviation and are estimating it from your sample, the t-test calculator is the correct tool, and using this one instead will give you a p-value that is too small.

How to Use It

  1. Pick the test. The input labels change to match, and the second-sample block appears only for the two-sample procedures.
  2. Enter the null value. For a one-sample test this is the hypothesised mean or proportion. For a two-sample test it is the hypothesised difference, which is almost always zero.
  3. Enter the sample figures. For proportion tests, give the number of successes rather than the proportion; the tool computes the proportion and shows it in the summary line.
  4. Choose the alternative. Two-tailed unless you had a directional hypothesis before you saw the data.
  5. Read the p-value and the decision together. The critical value and the p-value always agree; they are two ways of stating the same comparison.

The Formulas and How They're Calculated

Every version is the same shape: an observed difference divided by its standard error. One-sample mean: z = (x̄ − μ₀) ÷ (σ ÷ √n). Two-sample means: z = ((x̄₁ − x̄₂) − Δ₀) ÷ √(σ₁²/n₁ + σ₂²/n₂). One-sample proportion: z = (p̂ − p₀) ÷ √(p₀(1 − p₀) ÷ n), using the null value in the standard error rather than the observed one. Two-sample proportions: the standard error uses a pooled estimate, p̄ = (x₁ + x₂) ÷ (n₁ + n₂), giving z = (p̂₁ − p̂₂) ÷ √(p̄(1 − p̄)(1/n₁ + 1/n₂)).

Work the defaults through. A sample of 36 has a mean of 104, tested against a hypothesised mean of 100 with a known population standard deviation of 15. The standard error is 15 ÷ √36 = 15 ÷ 6 = 2.5, so z = (104 − 100) ÷ 2.5 = 1.6. The two-tailed p-value is 2 × (1 − Φ(1.6)) = 2 × 0.0548 = 0.1096, and the critical value at α = 0.05 is ±1.96. Since 1.6 does not exceed 1.96, and equivalently 0.1096 exceeds 0.05, the null is not rejected.

The p-value comes from the standard normal distribution, computed here with a high-accuracy complementary error function rather than a lookup table, so the tails stay reliable. The critical value is the inverse of the same function. NIST's e-Handbook section on testing a population mean against a standard sets out the same hypotheses and notes explicitly that if the standard deviation is assumed known, that assumption should itself be checked.

Advertisement

The Known-Variance Assumption, and Why It Is Usually False

The z-test is derived on the basis that σ is a fixed, known constant. That is a strong claim. It is genuinely satisfied in a few situations: a measurement instrument whose precision has been established over thousands of calibrations, a manufacturing process with a long control history, or a simulation where the generating distribution is specified. In most research settings it is not satisfied at all, because σ is being estimated from the same sample that produced the mean.

When you estimate σ and use it as though it were known, you understate the uncertainty, because you have ignored the error in the estimate itself. The t-distribution exists precisely to absorb that extra uncertainty, and it does so with heavier tails than the normal. The practical consequence is that a z-test on estimated variance produces p-values that are too small and confidence intervals that are too narrow, and the effect is worst exactly where it matters most — at small sample sizes.

The gap closes as n grows. At n = 30 the two-tailed 5% critical value is 2.045 for t and 1.960 for z, a difference of about 4%. At n = 100 it is 1.984 against 1.960, under 2%. This is why the rule of thumb "use z for large samples" works in practice, though it is a statement about the size of the approximation error rather than about the assumption becoming true.

Proportions: Why the Two Standard Errors Differ

The two proportion tests use different denominators, and the reason is worth understanding rather than memorising. In the one-sample test, the null hypothesis specifies an exact proportion p₀. If the null is true, the variance of p̂ is exactly p₀(1 − p₀)/n, so that is the standard error to use — computed under the null, not from the data.

In the two-sample test the null does not specify a value, only that the two proportions are equal to each other. The best estimate of that shared value is the pooled proportion across both samples combined, which is why the standard error uses p̄ rather than the two observed proportions separately. Using the unpooled version is a common slip; it changes the answer, and it is the correct denominator for a confidence interval on the difference but not for this test.

Both proportion tests are normal approximations to a binomial situation, and they need enough data to be reasonable. The usual condition is that np and n(1 − p) both exceed about 5 to 10, evaluated at the null proportion. Below that the approximation degrades and an exact binomial procedure is appropriate instead. This tool warns you when the condition fails rather than quietly reporting a p-value that does not mean what it appears to.

One Tail or Two, and When You Are Allowed to Choose

A one-tailed test puts the whole rejection region on one side, which makes it easier to reach significance in that direction and impossible in the other. At α = 0.05 the one-tailed critical value is 1.645 rather than 1.960, so a z of 1.7 is significant one-tailed and not significant two-tailed. That is a real gain in sensitivity, and it is paid for by giving up the ability to detect an effect in the opposite direction at all.

The condition on using it is about timing, not about the data. The direction must be specified before you look at the results, and it must be a direction where an effect the other way would genuinely be of no interest. Choosing one-tailed after seeing which way the difference fell converts a p of 0.08 into 0.04 by decree, and it is the most common form of the practice known as p-hacking. When in doubt, two-tailed is the honest default. Penn State's STAT 500 course notes cover the hypothesis-testing framework and the rules governing the choice.

Reading the Result Without Over-Reading It

A p-value is the probability of observing a statistic at least this extreme if the null hypothesis is true. It is not the probability that the null is true, and it is not the probability that your result was a fluke. Those two misreadings account for a large share of the ways significance testing gets reported badly.

Two further cautions apply directly to what this page outputs. First, significance is not effect size: with a large enough n, a difference far too small to matter will produce a tiny p-value, so always read the raw difference alongside it. Second, the decision boundary is a convention, not a discovery. A p of 0.049 and a p of 0.051 describe practically identical evidence, and treating one as a finding and the other as nothing is an artefact of the threshold. Reporting the p-value itself, rather than only the verdict, is what lets a reader judge for themselves — and the p-value calculator and normal distribution calculator are useful for exploring how the number moves as the inputs change.

Running tests on your marketing data?

Arb Digital reads conversion experiments the way this page reads a z statistic — assumption first, effect size second, threshold last.

Browse All Free Tools Talk To Our Team

Common Mistakes to Avoid

  • Using a z-test with an estimated standard deviation — that is a t-test. Substituting s for σ understates the uncertainty and shrinks the p-value.
  • Choosing the tail after seeing the data — a one-tailed test is only legitimate if the direction was specified in advance.
  • Using unpooled standard errors for a two-proportion test — the null says the proportions are equal, so the pooled estimate is the one that belongs in the denominator.
  • Reading a non-significant result as proof of no effect — it means the data did not distinguish the hypotheses, which is often a sample-size problem.
  • Reporting significance without the effect size — a large enough sample makes trivial differences significant, and the p-value alone cannot show that.

Related Free Tools From Arb Digital

Standardise a single observation with the z-score calculator, work through the general framework with the hypothesis testing calculator, find a cut-off with the critical value calculator, switch to an estimated standard deviation with the t-test calculator, convert a statistic to a probability with the p-value calculator, or explore the underlying curve with the normal distribution calculator. The full free online tools hub lists every statistics tool we publish.

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 genuinely known rather than estimated from your sample. If you calculated the standard deviation from the same data that produced the mean, the t-test is the correct procedure.

What is the difference between this and a z-score?

A z-score standardises one observation against a distribution. A z-test compares a sample statistic against a hypothesised value using the standard error, and produces a p-value and a decision rather than just a position.

Why does the two-proportion test pool the samples?

Because the null hypothesis states only that the two proportions are equal, without specifying a value. The pooled proportion across both samples is the best estimate of that shared value under the null.

What critical value should I use at the 5 percent level?

For a two-tailed test the critical values are plus and minus 1.96. For a one-tailed test at the same level it is 1.645, applied on whichever side the alternative hypothesis specifies.

How large does the sample need to be for a proportion test?

The usual condition is that the sample size multiplied by the null proportion, and by one minus the null proportion, both exceed roughly five to ten. Below that the normal approximation is unreliable and an exact binomial test is better.

Does a p-value tell me the probability the null is true?

No. It is the probability of seeing a result at least this extreme assuming the null is true, which is a different conditional statement and cannot be reversed without additional information.

Can I use a one-tailed test to get a smaller p-value?

Only if the direction was chosen before seeing the data and an effect the other way would be of no interest. Switching to a one-tailed test after the fact is not a legitimate way to reach significance.

This page performs a standard statistical calculation for educational purposes only. It is not medical, scientific, or financial advice, and whether the z-test is the right procedure for your data is a question about your study design rather than about the arithmetic.

Advertisement
Advertisement

Take it further