Two-Proportion Z-Test Calculator

StatisticsLast updated: August 22, 2026

The two-proportion test (the two-sample z test for proportions) checks whether the rate at which an event occurs differs between two independent groups. It is the test behind comparisons such as the recovery rate in a treatment group versus a control group, the conversion rate of two ad variants, or the share of people holding an opinion in two districts. The null hypothesis states that the two population proportions are equal (π₁ = π₂); the alternative states that they differ.

This calculator returns more than the z value: it reports the pooled proportion, the standard error of the difference, the critical value, the Newcombe score confidence interval for the difference, and Cohen h as the effect size. It also lays out the observed and expected frequencies in a contingency table, tells you when the smallest expected frequency drops below 5 and you should switch to Fisher's exact test, and reports Fisher's exact p-value alongside.

How many times the outcome of interest (a success, a recovery, a click, and so on) was observed in group 1.
How many times the same outcome was observed in group 2.
A directional hypothesis should be chosen only if the direction of the difference can be justified in advance.
Sets the false positive risk. In the social sciences 5% is the common choice.

Two-Proportion Test Formulas

Sample proportions:  p̂₁ = x₁ / n₁ ,  p̂₂ = x₂ / n₂
Pooled proportion:   p̄ = (x₁ + x₂) / (n₁ + n₂)
Standard error (H₀): SE = √[ p̄(1 − p̄) · (1/n₁ + 1/n₂) ]
Test statistic:      z = (p̂₁ − p̂₂) / SE
Unpooled SE:         SEᵤ = √[ p̂₁(1−p̂₁)/n₁ + p̂₂(1−p̂₂)/n₂ ]
Confidence interval: Newcombe square-and-add (from two Wilson intervals)
Effect size:         h = 2·arcsin√p̂₁ − 2·arcsin√p̂₂
Expected frequency:  Eᵢⱼ = (row total × column total) / N

The test statistic uses the pooled proportion because under H₀ the two population proportions are equal; the confidence interval carries no such constraint, so it uses the separate proportions. Cohen h thresholds: 0.20 small, 0.50 medium, 0.80 large.

How to Calculate

  1. Enter the event count (how many times the outcome of interest — a success, a recovery, a click — occurred) and the total sample size for both groups.
  2. Choose the hypothesis direction: stay with two-tailed unless you can justify the direction of the difference in advance.
  3. Set the significance level (α); the confidence interval is produced automatically at the 1 − α level.
  4. Compare the z value, the p-value, and the critical value; the decision line states the conclusion directly.
  5. Check the smallest expected frequency in the contingency table: if it is below 5, report Fisher's exact p-value instead.
  6. Report the confidence interval for the difference in proportions together with Cohen h; the p-value alone says nothing about the practical importance of the difference.

Worked Examples

Recovery rate in a treatment and a control group

In the treatment group 48 of 120 patients recovered (40.00%), and in the control group 30 of 110 (27.27%). The pooled proportion is 33.91%, the standard error is 0.0625, and z = 2.037; with a two-tailed p = 0.042 the difference is significant at α = 0.05. The 95% confidence interval for the difference runs from 0.48% to 24.37%, and Cohen h = 0.271 (a small effect).

z statistic: 2.037 · Degrees of freedom: — · p-value: p = 0.042

Conversion rate of two ad variants (A/B test)

Variant A converted at 10.50% and variant B at 9.00%. With z = 1.599 and p = 0.110, the 1.50-point gap is not statistically significant; the 95% confidence interval runs from -0.34% to 3.34% and therefore contains zero. Cohen h = 0.051 is negligible — note how a small difference can stay non-significant even in a large sample.

z statistic: 1.599 · Degrees of freedom: — · p-value: p = 0.110

Small sample — Fisher's exact test is required

The proportions are 13.33% and 56.25%, giving z = -2.496 and p = 0.013. Even though the smallest expected frequency is 5.32, the cell counts are small and Fisher's exact test returns p = 0.023. Because the normal approximation can make the p-value look smaller than it is in small samples, the Fisher result should be preferred in the report.

z statistic: -2.496 · Degrees of freedom: — · p-value: p = 0.013

Frequently Asked Questions

What is the difference between the two-proportion test and the chi-square test?
For a 2x2 table the two are mathematically identical: the square of the two-tailed z statistic is exactly the Pearson chi-square statistic (z² = χ²) and the p-values match to the digit. The difference is in the presentation: the z test gives you the direction of the difference, the difference in proportions, and a confidence interval for that difference, whereas chi-square only tells you whether an association exists. If you want a directional hypothesis, you need the z test.
When should I switch to Fisher's exact test?
The classic rule is that the normal (chi-square) approximation becomes unreliable when any expected frequency in the 2x2 table falls below 5. Fisher's exact test then computes the exact probability from the hypergeometric distribution and is valid regardless of sample size. Because it is cheap to compute, many researchers report Fisher's test directly for small samples (n < 40) without waiting for the expected-frequency condition to fail.
Is it inconsistent to use a pooled standard error in the test and an unpooled one in the interval?
No, this is a deliberate and standard choice. A hypothesis test is carried out assuming H₀ is true; under H₀ the two population proportions are equal, so the best common estimate is the pooled proportion. A confidence interval makes no such assumption and estimates the two proportions separately. In borderline cases the p-value and the interval can point to different conclusions; when that happens the confidence interval is the more informative one.
What is Cohen h, and why use it instead of the raw difference in proportions?
Cohen h moves the proportions onto an equal-variance scale with the arcsine (angular) transformation and measures the difference there: h = 2·arcsin√p̂₁ − 2·arcsin√p̂₂. A raw difference in proportions means different things depending on where you are on the scale — 5 points between 50% and 55% is not the same as 5 points between 1% and 6%. Cohen h removes that problem; 0.20 counts as a small effect, 0.50 as medium, and 0.80 as large, and it feeds directly into power analysis.
Can I use this test for paired proportions measured on the same people?
No. The two-proportion z test assumes the groups are independent. In designs where the same people are measured before and after, or in matched case-control studies, the observations are related, and this test overestimates the standard error and loses power. Use McNemar's test for paired proportions.
How do I get the same result in SPSS, Excel, and R?
In R, prop.test(c(x1, x2), c(n1, n2), correct = FALSE) gives the same z² (chi-square) and p-value as this calculator; correct = TRUE adds Yates's continuity correction and inflates p slightly. In SPSS, ask for the Pearson chi-square on a 2x2 table through the Crosstabs menu. Excel has no built-in function; compute z yourself and get p from 2*(1-NORM.S.DIST(ABS(z), TRUE)).
Is my sample size large enough for this test?
A common rule of thumb is that both the event count and the non-event count should be at least 10 (5 in some sources) in each group; the calculator checks this through the expected-frequency test. Whether you have enough power is a separate question: detecting a small difference can require thousands of observations per group. Computing the sample size from Cohen h at the planning stage is far better than trying to interpret a non-significant result after the fact.