How to use the proportion z-test calculator
- Choose two proportions to compare two groups (for example an A/B test), or one proportion to compare a sample with a claimed value.
- Enter the number of successes and the sample size for each group, and for one proportion the value you're testing against (p₀).
- Keep the two-tailed test at α = 0.05 unless your hypothesis named a direction in advance, then click Run z-test.
- Read the p-value and decision, the confidence interval and, for two groups, the difference and relative lift.
- Check the conditions box: the test needs at least 10 expected successes and failures in each group.
Proportion z-test formulas
One proportion, comparing the sample proportion with p₀:
z = p − p0p0(1 − p0)n , p = xn
Two proportions, using the pooled proportion under the null hypothesis that both groups share the same rate:
z = p2 − p1pc(1 − pc)(1n1 + 1n2) , pc = x1 + x2n1 + n2
- p
- The sample proportion: successes divided by the sample size
- p0
- The proportion in the null hypothesis (one-proportion test)
- p1, p2
- The proportions in group 1 and group 2
- pc
- The pooled (combined) proportion of both groups, used for the test's standard error
- x, n
- The number of successes and the sample size
- z
- The test statistic: how many standard errors the observed difference is from the null value
Worked example
A coin lands heads 30 times in 50 flips. Is that evidence the coin favors heads (more than 50%)?
-
Sample proportion
p = 3050 = 0.6
- Check conditions: np₀ = 25 and n(1 − p₀) = 25 are both at least 10
-
Standard error under the null, then z
z = 0.6 − 0.50.5 × 0.550 = 0.10.0707 = 1.414
-
One-tailed p-value (greater than)
p = P(Z ≥ 1.414) = 0.0786
What it means: p = 0.079 is above 0.05, so 30 heads in 50 flips isn't strong evidence of a biased coin. A fair coin gives 30 or more heads about 8% of the time. With 300 heads in 500 flips (the same 60%), z would be 4.47 and the result highly significant: sample size matters.
How to interpret the result
- p ≤ α: the difference is statistically significant: unlikely to be due to chance alone.
- The confidence interval gives the plausible range for the true proportion (or the true difference). If the interval for a difference excludes 0, the two-tailed test is significant at the same level.
- The relative lift (two groups) expresses the difference as a percentage of group 1's rate, which is how A/B test results are usually reported.
- Significant isn't the same as important. With huge samples, a 0.1-point difference can be significant; judge whether the size of the difference matters in practice.
Planning a survey or test? The sample size calculator tells you how many responses you need. For a confidence interval on its own, use the confidence interval calculator.