One-Proportion Z-Test, Explained

After reading this you can test whether an observed proportion, like 60 successes out of 100, differs from a hypothesised value such as 0.5, using both the normal approximation and the exact binomial p-value.

What this test does

You have a single yes/no outcome measured on a sample: heads or tails, converted or not, defective or fine. You count x successes out of n trials. The observed proportion is \hat{p} = x/n. The one-proportion z-test asks a narrow question: is \hat{p} far enough from a fixed number p_0 that chance alone is an unconvincing explanation?

Suppose a coin lands heads 60 times in 100 flips. The observed rate is 0.60. A fair coin has p_0 = 0.5. Is 0.60 surprising for a fair coin? The test turns that gap into a number you can judge. As you will see below, 60 out of 100 gives a two-sided p-value near 0.046, just under the usual 0.05 line.

When to use it, and when not

Use this test when you have one sample, one binary outcome, and a specific value p_0 to compare against. That value comes from theory (a fair coin gives 0.5), a standard (a process should stay under a 2% defect rate), or a historical baseline.

Do not use it in these situations:

The trials must be independent and share the same success probability. If you flip a coin 100 times, fine. If you survey 100 people but pick whole households, responses within a household are correlated, and the test will report a p-value that is too small.

The formula and the intuition

Under the null hypothesis H_0: p = p_0, the count of successes follows a binomial distribution with mean n p_0 and standard deviation \sqrt{n p_0 (1 - p_0)}. Dividing by n gives the sampling distribution of \hat{p}. Its standard error under the null is:

SE_0 = \sqrt{\dfrac{p_0 (1 - p_0)}{n}}

Here p_0 is the hypothesised proportion and n is the sample size. The z-statistic counts how many standard errors separate the observed proportion from the hypothesised one:

z = \dfrac{\hat{p} - p_0}{\sqrt{\dfrac{p_0 (1 - p_0)}{n}}}

The key detail: the standard error uses p_0, not \hat{p}. Because you are testing a specific hypothesis, you assume it is true when you measure spread. When the null is true, z follows an approximately standard normal distribution, so a value beyond \pm 1.96 corresponds to a two-sided p-value below 0.05.

The exact binomial p-value skips the normal approximation entirely. It adds up the probabilities of every outcome as extreme as, or more extreme than, the one you observed, using the binomial distribution directly. For small n that exact value is what you should trust.

Worked example: 60 successes in 100 trials

Reproducing the demo

The demo uses x = 60, n = 100, and p_0 = 0.5.

  1. Observed proportion: \hat{p} = 60/100 = 0.60.
  2. Standard error under the null: SE_0 = \sqrt{0.5 \times 0.5 / 100} = \sqrt{0.0025} = 0.05.
  3. z-statistic: z = (0.60 - 0.50)/0.05 = 2.0.
  4. Two-sided p-value from the normal approximation: 2 \times P(Z \gt 2.0) \approx 2 \times 0.02275 = 0.0455.
  5. Exact binomial two-sided p-value: sum the probabilities of getting 60 or more, and 40 or fewer, heads out of 100 when p = 0.5. That comes to about 0.0569.

Notice the two methods disagree slightly: 0.0455 versus 0.0569. The normal approximation calls the result significant at 0.05; the exact test does not. When they straddle your threshold like this, report the exact value and treat the finding as borderline.

The distribution centres on 50. Observing 60 (or 40) sits in the thin tail, which is why the p-value lands near 0.05.

Explore how the count changes the verdict

With n = 100 and p_0 = 0.5, moving the success count changes the z-statistic by 0.2 per success. At 55 successes z is 1.0 (p about 0.32), at 60 it is 2.0 (p about 0.046), and at 65 it is 3.0 (p about 0.003). Larger deviations from 50 push the result further into significance.

Reading the output

The calculator returns \hat{p}, the z-statistic, the normal-approximation p-value, and the exact binomial p-value. Read them in that order.

z-statistic
Signed distance from p_0 in standard errors. A positive z means \hat{p} \gt p_0; negative means below. Magnitude beyond 1.96 corresponds to two-sided significance at 0.05.
Normal p-value
The chance, if the null is true, of a z at least this far from zero. Fast, and accurate when both n p_0 and n(1-p_0) exceed about 10.
Exact p-value
The same probability computed directly from the binomial distribution, with no approximation. Preferred whenever counts are small or p_0 is near 0 or 1.

A small p-value means the observed proportion is hard to reconcile with p_0. It does not tell you the size of the effect. With n = 100, 60 successes gives a 10 point gap from 0.5; with n = 10000, 5100 successes gives only a 1 point gap yet a much smaller p-value. Always look at \hat{p} - p_0 alongside the p-value. To convert a z-statistic you got elsewhere into a p-value, use the P-value Calculator.

Common mistakes

The errors below quietly change the answer.

  • Using \hat{p} in the standard error. The null-based SE uses p_0. Plugging in 0.60 instead of 0.50 gives \sqrt{0.6 \times 0.4/100} = 0.049 and z = 2.04, a subtly wrong figure. That estimate belongs to a confidence interval, not this test.
  • Trusting the normal approximation on tiny samples. With x = 3, n = 10, p_0 = 0.5, the expected count n p_0 = 5 is below the guideline of 10. Report the exact binomial p-value here.
  • Confusing one-sided and two-sided. A one-sided test at 0.05 uses a cutoff of 1.645, not 1.96. Decide the direction before you see the data, not after.
  • Reading significance as importance. A defect rate of 2.1% against a target of 2.0% can be significant with a large enough n and still not matter to your process.

Related tools

If your question involves more than one proportion or a different data shape, these fit better:

Frequently asked questions

Why does the exact p-value differ from the z-test p-value?

The z-test smooths the discrete binomial counts into a continuous normal curve. That smoothing introduces small errors, largest when n is small or p_0 is near 0 or 1. For 60 of 100 the two land at 0.0455 and 0.0569. When they disagree, report the exact value.

How large does n need to be for the normal approximation?

A common rule is that both n p_0 and n(1-p_0) should be at least 10. With p_0 = 0.5 that means n \ge 20. With p_0 = 0.02 you need n \ge 500 before the approximation is comfortable.

Should I use a one-sided or two-sided test?

Use two-sided unless you have a directional hypothesis fixed in advance, such as "the defect rate has risen above 2%." A two-sided test at 0.05 needs |z| \gt 1.96; a one-sided test needs z \gt 1.645 in the stated direction.

Can I test a proportion of exactly 0 or 1?

Yes. If x = 0 out of n = 30 against p_0 = 0.10, the normal SE still works but the tail is skewed, so lean on the exact binomial p-value, which here is about 0.042.

Does this give me a confidence interval too?

The test answers a yes/no question about p_0. A confidence interval for \hat{p} uses the observed proportion in its standard error, not p_0, so it is computed separately even though the two are related.