z test for two proportions calculator

Two-Proportion z Test Calculator

Compare two independent proportions and test whether the difference is statistically significant.

What is a z test for two proportions?

A z test for two proportions checks whether the difference between two population proportions is likely to be real or just random noise. You use it when each group has a binary outcome, such as:

  • Clicked vs not clicked
  • Purchased vs did not purchase
  • Recovered vs not recovered
  • Passed vs failed

The calculator above is useful for A/B testing, healthcare studies, survey research, and quality control where outcomes are measured as counts of successes out of total observations.

How the calculator works

1) Compute sample proportions

p̂₁ = x₁ / n₁,    p̂₂ = x₂ / n₂

2) Build the pooled proportion under H₀: p₁ = p₂

p̂ = (x₁ + x₂) / (n₁ + n₂)

3) Compute standard error for the test statistic

SE = √[ p̂(1 - p̂)(1/n₁ + 1/n₂) ]

4) Compute the z statistic

z = (p̂₁ - p̂₂) / SE

5) Convert z into a p-value

Depending on your alternative hypothesis (two-sided, greater, or less), the p-value is computed from the standard normal distribution. If p-value < α, reject H₀.

Interpreting your result

The calculator returns:

  • Sample proportions for each group
  • Difference p̂₁ − p̂₂
  • Pooled proportion used in the hypothesis test
  • z statistic
  • p-value
  • Decision at your selected α level
  • Confidence interval for p₁ − p₂ (unpooled SE)

A statistically significant result does not automatically mean the difference is practically important. Always consider effect size, business impact, cost, and risk.

Example use case

Imagine you run an email campaign test:

  • Version A: 56 clicks out of 120 users
  • Version B: 43 clicks out of 115 users

Enter those values in the calculator and test at α = 0.05. The tool tells you whether the observed lift is statistically significant and provides a confidence interval for the difference in click rates.

Assumptions and conditions

The two-proportion z test relies on several assumptions:

  • Two independent random samples (or properly randomized groups)
  • Binary outcome in each group
  • Large-sample normal approximation is reasonable
  • No observation appears in both groups

A common rule is to check expected successes and failures are each at least 10. The calculator reports whether this condition appears acceptable for the test setup.

Common mistakes to avoid

  • Using percentages directly instead of counts and sample sizes
  • Comparing non-independent groups as if they were independent
  • Ignoring one-tailed vs two-tailed hypothesis direction
  • Claiming causation from observational data
  • Focusing only on p-values while ignoring interval estimates

FAQ

Is this the same as a chi-square test for a 2×2 table?

For two groups and binary outcomes, the two-sided two-proportion z test and the chi-square test (without continuity correction) are mathematically equivalent in many settings.

Can I use this with very small samples?

Be careful. If expected counts are too low, the normal approximation may be poor. Consider exact methods (such as Fisher's exact test) for small sample situations.

What does the confidence interval tell me?

It gives a plausible range for the true difference p₁ − p₂. If the interval excludes 0, that aligns with significance at the corresponding level.

Final takeaway

The z test for two proportions is one of the most practical tools for comparing conversion rates, response rates, and pass/fail outcomes. Use it with good sampling practice, check assumptions, and report both p-values and confidence intervals for a complete statistical story.

🔗 Related Calculators