01
Two-proportion z test formula
z = (p₁ − p₂) ÷ √(p × (1 − p) × (1 ÷ n₁ + 1 ÷ n₂))
p₁ and p₂ are the two sample proportions and p is the pooled proportion, (x₁ + x₂) ÷ (n₁ + n₂). The confidence interval of the difference uses the unpooled standard error, √(p₁(1 − p₁) ÷ n₁ + p₂(1 − p₂) ÷ n₂).
02
Worked example
45 of 100 respond in group 1 and 30 of 100 in group 2.
p = 75 ÷ 200 = 0.375
z = 0.15 ÷ √(0.375 × 0.625 × 0.02) = 0.15 ÷ 0.0685 = 2.191
The two-tailed p value is 0.0285. The difference is 15 percentage points, 95% CI 1.7 to 28.3 points.
03
Z test, chi-square or Fisher?
- For a 2 × 2 table the z test and the chi-square test without continuity correction give the same p value: chi-square equals z².
- Use Fisher's exact test when any cell has fewer than about 5 observations.
- For paired data, such as the same people before and after, use McNemar's test instead. This test assumes independent groups.
04
Mistakes when comparing two proportions
- Judging by overlapping intervals. In the worked example 45% (95% CI 35.6% to 54.8%) and 30% (21.9% to 39.6%) overlap, yet the test gives p = 0.028.
- Mixing percentage points and percent. 45% against 30% is a difference of 15 percentage points and a 50% relative increase; say which one you mean.
- Not saying whether a continuity correction was used. With Yates’ correction the same table gives chi-square 4.18 and p = 0.041 instead of 0.028.
Trust
How this page is checked
- The calculation runs on code with automated tests against worked reference values. Every number in the examples on this page was produced by that same code, not typed by hand.
- The formulas and conventions used are stated on the page, so you can reproduce the result yourself or compare it with your own software.
- Last reviewed by the Sciloom team, Zebra Nine Studio Inc. It is a tool for research and teaching, not a substitute for a statistician, a validated lab method or medical advice.
Cite this page
Sciloom. (2026). Two-proportion z test calculator. Zebra Nine Studio Inc. https://sciloom.si/two-proportion-z-test-calculator
Frequently asked questions
When do I use a two-proportion z test?
When you compare a yes/no outcome between two independent groups and the samples are large enough: at least about 5 to 10 successes and failures in each group.
Why is the pooled proportion used?
The null hypothesis says both groups share one true proportion, so the standard error for the test is computed from the combined estimate. The confidence interval does not assume that, so it uses each group separately.
Is this the same as an A/B test calculator?
It is the standard test behind most A/B test calculators for conversion rates. Enter conversions and visitors for each variant.
What about a one-tailed test?
The calculator lists both one-tailed p values beside the two-tailed one. Use the one that matches the direction you predicted before seeing the data. Two-tailed is the safer default.
What is Cohen’s h?
An effect size for the gap between two proportions: h = 2·asin(√p₁) − 2·asin(√p₂). By Cohen’s rough guide 0.2 is small, 0.5 medium and 0.8 large. For 45% against 30%, h is 0.311.