StatGardenREF. DESK
Calculators/Statistics/Z-test for a proportion
Statistics

Z-test for a proportion calculator

Tests a sample proportion against a hypothesised population proportion.

Published 6 August 2026 · Updated 25 September 2026

What this calculator does

This tests whether an observed proportion differs from a hypothesised one. A sample of 150 splitting 58-42 against a hypothesis of 50% gives z = 1.960 and a two-tailed p-value of 0.0500.

That example sits exactly on the conventional threshold, and it is worth dwelling on. The p-value rounds to 0.0500 in the display but is actually 0.05004, so the calculator correctly reports it as not significant at 5%. A result this close to the line is a reason to gather more data, not to argue about the fourth decimal place.

The formula

Formulaz = (p̂ − p₀) / √(p₀(1−p₀)/n); two-tailed p-value = 2(1 − Φ(|z|))

The z-statistic is the difference between the sample and hypothesised proportions, divided by the standard error computed under the null hypothesis. That standard error uses the hypothesised proportion rather than the observed one, which is the correct choice for a test but differs from the standard error used to build a confidence interval. The p-value is two-tailed.

TermMeaning
p̂ (p-hat)The observed sample proportion.
p₀The hypothesised population proportion being tested against.
Two-tailedTesting for a difference in either direction, which is the usual default.
Null standard error√(p₀(1−p₀)/n), computed under the hypothesis rather than from the sample.

The inputs explained

FieldWhat to enter
Sample proportion (p̂) (%)Observed sample proportion as a percentage.
Hypothesised proportion (p₀) (%)The proportion you are testing against, from theory, a previous study or a target.
Sample sizeSample size. The normal approximation needs at least about 10 expected successes and 10 expected failures.

When to use it

Testing against a known rate

Whether an observed rate differs from a published or historical figure.

Checking a fairness claim

Whether an outcome rate differs from the 50% a fair process would produce.

Evaluating a single-arm result

Comparing an observed success rate against a pre-specified target rather than against a control group.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

What does each sample proportion give?

A range of observed proportions against the same hypothesis.

n = 150, testing against 50%
Sample proportionZ-statisticTwo-tailed p-valueSignificant at 5%?
52%0.48990.6242No
55%1.2250.2207No
58%1.9600.0500No
62%2.9390.0033Yes
The 58% row lands on z = 1.960 with a p-value displaying as 0.0500 and reported as not significant. That is correct rather than a rounding fault: the exact z is 1.959592 and the exact p is 0.05004, just above the threshold. The 62% row clears both the 5% and 1% levels comfortably.

Questions

Why does a p-value of 0.0500 show as not significant?

Because the displayed figure is rounded to four decimal places. The exact value here is 0.05004, which is above 0.05. A result sitting this close to the threshold should prompt more data rather than a decision either way, since the conventional cutoff is arbitrary.

Which standard error does this use?

The one computed under the null hypothesis, using p₀ rather than the observed proportion. That is correct for a hypothesis test. A confidence interval around the observed proportion uses p̂ instead, which is why a test and an interval can occasionally disagree at the margin.

How large a sample do I need?

The normal approximation needs roughly ten expected successes and ten expected failures, so n times p₀ and n times (1−p₀) should both be at least 10. Below that, use an exact binomial test rather than this approximation.

Should I use a one-tailed test?

Only if you committed to a direction before seeing the data and a result in the other direction would be of no interest. Switching to one-tailed after looking at the result, which halves the p-value, is a well-known form of p-hacking.

For comparing two proportions, see the two-proportion z-test calculator. For the margin of error instead, see the margin of error calculator.