Two-Proportion z-Test Calculator

Two-Proportion z-Test Calculator

Compare two independent proportions — conversion rates in an A/B test or shares in two survey groups — with a pooled z-test, p-value, Cohen’s h and a confidence interval for the difference.

Number of “yes” answers in group 1
Total trials or people in group 1
Number of “yes” answers in group 2
Total trials or people in group 2
Z STATISTIC
1.8891

Fail to reject H₀ at α = 0.05 — with z = 1.8891 and a two-tailed p-value of 0.0589, the difference between the two proportions is not statistically significant.

P-value (two-tailed)
0.0589
P-value (one-tailed)
0.0294
Critical z
1.960
Pooled p̂
0.3850
Cohen’s h
0.2681
Wald 95% CI
[-0.0037, 0.2637]
Newcombe 95% CI
[-0.0047, 0.2583]
Pooled SE
0.0688

Calculation

    Shaded normal curve — rejection region

    The shaded tails beyond ±1.960 are the rejection region at α = 0.05 (two-tailed). The dot marks the observed z = 1.8891, which falls outside the shaded region.

    Decision rule: reject H₀ when |z| exceeds 1.960. Here |1.8891| is smaller, so the result is not significant. The Wald 95% CI [-0.0037, 0.2637] contains 0 and the Newcombe 95% CI [-0.0047, 0.2583] contains 0.

    Proportions with Wilson intervals

    Bars show p̂₁ and p̂₂; the whiskers show the 95% Wilson interval for each proportion.

    Group 1: p̂₁ = 0.4500, 95% Wilson CI [0.3561, 0.5476]. Group 2: p̂₂ = 0.3200, 95% Wilson CI [0.2367, 0.4166].

    A two-proportion z-test compares two percentages from independent samples — conversion rates in an A/B test, or survey shares in two groups. Enter the successes and sample sizes and get the pooled z-statistic, p-value, Cohen’s h and a confidence interval for the difference.

    This test compares TWO proportions from independent samples. For ONE proportion against a claimed value, use the one-proportion z-test. For the interval instead of the test, build a confidence interval for the difference of two proportions.

    How to use the two-proportion z-test calculator

    Use Counts when you have the numbers of successes and the sample sizes. Use Proportions when you know the percentages and the sample sizes — the calculator works out the counts for you.

    1. Choose a mode: Counts or Proportions.
    2. Enter the successes (x₁, x₂) and sample sizes (n₁, n₂) — or the proportions and sample sizes in Proportions mode.
    3. Choose the tail: two-tailed, or one-tailed for p̂₁ > p̂₂ or p̂₁ < p̂₂ — then choose the significance level (α).
    4. Read the headline z statistic, then check the results grid for the p-values, critical z, pooled p̂, Cohen’s h, the Wald and Newcombe confidence intervals and the pooled standard error. The calculation ledger shows every step, and the chart shades the rejection region.

    Try it now: with 45 of 100 and 32 of 100, the calculator gives z = 1.8891 and a two-tailed p-value of 0.0589 — not significant at the 5% level.

    When should you use a two-proportion z-test?

    Use a two-proportion z-test when you have two independent samples and want to know whether their proportions differ — for example, whether a new page converts better than the old one, or whether two survey groups agree. It is the right test when:

    • The two samples are independent — no person or unit appears in both groups.
    • Each group is a set of yes/no (binary) outcomes.
    • The normal approximation is valid: n·p̂ and n·(1−p̂) are at least 5 in each group — the calculator checks this for you.
    • You want a p-value for the difference. If you only want the interval, build a confidence interval for the difference of two proportions instead.
    Rule of thumb: two independent groups with yes/no outcomes call for a two-proportion z-test. Paired proportions — the same people measured twice, for example before and after a treatment — need McNemar’s test, not this page.

    Two-proportion z-test vs chi-square test: which one do you need?

    For a 2×2 table the two tests are the same test in different clothes: z² = χ² (without a continuity correction). The z-test gives you a direction — which proportion is higher — and a confidence interval for the difference; the chi-square test gives you a single p-value for independence.

    QuestionTwo-proportion z-testChi-square test
    What it testsWhether p̂₁ differs from p̂₂Whether two variables are independent
    DirectionYes — the sign of z tells you which proportion is higherNo — a single p-value
    Confidence intervalYes — Wald and Newcombe intervals for p̂₁ − p̂₂No
    2×2 relationshipz² = χ² (no continuity correction)χ² = z²
    Typical useA/B tests, survey comparisonsIndependence or goodness-of-fit on counts

    If you need the chi-square version, use the chi-square test calculator.

    How do I read the p-value, Cohen’s h and confidence interval together?

    Three numbers, one story. Read them as a group rather than in isolation:

    • P-value: the probability of getting a difference in proportions at least as large as yours, if the null hypothesis (p̂₁ = p̂₂) were true. If p < α, reject H₀; if p > α, do not. Learn more about what a p-value is and what it cannot tell you.
    • Cohen’s h: the size of the difference in arcsine units, h = 2·arcsin(√p̂₁) − 2·arcsin(√p̂₂). Roughly, 0.2 is small, 0.5 is medium and 0.8 is large. A tiny p-value with a tiny h can mean a real but trivial difference.
    • 95% confidence interval: the range of plausible values for the true difference p̂₁ − p̂₂. If the interval excludes 0, the two-tailed test at 5% rejects — the two must agree. For a single proportion, use a confidence interval for a proportion. You can turn any z into a p-value with a p-value calculator from a z-score, or look up areas under the normal distribution.

    Example: in the first worked example below, p = 0.0589 (not significant at 5%), h = 0.2681 (a small-to-medium effect) and the 95% CI [−0.0037, 0.2637] contains 0 — all three agree that the evidence against “no difference” is weak. In the second, the chi-square p = 0.0246 says reject but Fisher’s exact p = 0.0698 says do not — which is why small counts need Fisher’s test.

    Worked examples

    Example 1 — A/B test, not significant at 5%

    Group 1: 45 of 100 say yes (p̂₁ = 0.45). Group 2: 32 of 100 say yes (p̂₂ = 0.32). Difference = 0.13. Pooled p̂ = 0.385 and pooled SE = 0.0688, so z = 0.13 / 0.0688 = 1.8891. The two-tailed p-value is 0.0589 and the critical z is 1.960, so |1.8891| < 1.960 and we fail to reject H₀ at α = 0.05. The one-tailed p-value is 0.0294 — the same data would be significant if you had predicted the direction in advance. Cohen’s h = 0.2681 (small-to-medium) and the Wald 95% CI is [−0.0037, 0.2637] while the Newcombe 95% CI is [−0.0047, 0.2583] — both contain 0, consistent with the test.

    Example 2 — small counts, why Fisher’s exact test matters

    A 2×2 table [[8, 2], [3, 7]]: the odds ratio is 9.3333. Pearson’s chi-square (no Yates correction) is 5.0505 with p = 0.0246 — it says reject. Fisher’s exact two-sided p is 0.0698 — it says fail to reject. The expected counts [[5.5, 4.5], [5.5, 4.5]] are small, so Fisher’s exact test is the safer test here. This is why the calculator shows Fisher’s exact p whenever any expected count is below 5.

    How to do a two-proportion z-test in Excel

    In Excel, get the two-tailed p-value from the z-statistic with =2*(1-NORM.S.DIST(ABS(z),TRUE)) and the critical z with =NORM.S.INV(1-alpha/2) — for example, =NORM.S.INV(0.975) gives 1.96 at the 5% level. Note that Excel’s Z.TEST is a one-sample test for a MEAN; it does not do two proportions, so build the pooled z by hand from the formula above.

    Frequently asked questions

    Pooled or unpooled standard error — which one?

    The test itself uses the pooled standard error, because the null hypothesis says the two proportions are equal, so the best estimate of the common proportion pools both samples. The confidence interval uses the unpooled standard error, because the interval does not assume the proportions are equal. That is why the Wald interval uses a slightly different SE (0.0682) from the test (0.0688).

    When is the normal approximation valid?

    When n·p̂ and n·(1−p̂) are both at least 5 in each group, where p̂ is the pooled proportion. The calculator checks this for you and warns you when a group is too small. With very small counts the normal approximation breaks down — see the small-counts example above.

    What if my counts are small?

    With small counts, Fisher’s exact test is the safer test — the calculator shows its p-value automatically whenever any expected count is below 5. In the worked example above, the chi-square test says reject (p = 0.0246) while Fisher’s exact test says fail to reject (p = 0.0698); with expected counts of 5.5 and 4.5, Fisher’s is the honest answer.

    Is this the same as a chi-square test?

    Yes, for a 2×2 table. The two-proportion z-test and the chi-square test of independence are the same test: z² = χ², without a continuity correction. The z-test adds a direction and a confidence interval for the difference; the chi-square test does not. You can run the same numbers through the chi-square test calculator and check that the chi-square statistic equals z² — the two tests give the same p-value.

    What is Cohen’s h?

    Cohen’s h measures the size of the difference between two proportions on the arcsine scale: h = 2·arcsin(√p̂₁) − 2·arcsin(√p̂₂). Roughly, 0.2 is a small effect, 0.5 is medium and 0.8 is large. In the first worked example, h = 0.2681 is a small-to-medium effect. Unlike the p-value, h does not depend on sample size, so it says how big the difference is, not just whether it is significant.

    Can I use this for paired proportions?

    No. This test needs two independent samples. Paired proportions — the same people measured twice, for example before and after a treatment — need McNemar’s test, not this page.

    Source: the pooled z-statistic follows the NIST/SEMATECH e-Handbook of Statistical Methods, 7.3.3. How can we determine whether two processes produce the same proportion of defectives? — z = (p̂₁ − p̂₂) / √(p̂(1−p̂)(1/n₁ + 1/n₂)). All examples on this page were checked against that method.

    See all 62 free statistics tools on Empirical Rule Calculators.