Two Proportion Confidence Interval Calculator

Estimate how far apart two population proportions are. Enter successes and sample sizes for two independent groups and choose a confidence level; the calculator gives the difference p̂₁ − p̂₂, its standard error, the margin of error and the confidence interval, and tells you whether the interval includes zero.

Formula (p̂₁ − p̂₂) ± z·SE

Group 1

Group 2

Try an example
Method

How to Calculate a Confidence Interval for Two Proportions

A confidence interval for the difference between two proportions is (p̂₁ − p̂₂) ± z* · √(p̂₁q̂₁/n₁ + p̂₂q̂₂/n₂), using each group's own proportion in an unpooled standard error. If the interval contains zero, no difference is still plausible at that confidence level; if it excludes zero, the groups differ.

Compute both sample proportions

p̂₁ = x₁/n₁, p̂₂ = x₂/n₂, and the point estimate p̂₁ − p̂₂.

Add the two variances

Variances of independent estimates add: SE = √(p̂₁q̂₁/n₁ + p̂₂q̂₂/n₂). Standard errors do not add directly.

Multiply by z* and add ±

Margin of error E = z*·SE; interval (p̂₁ − p̂₂) ± E.

Look for zero

Zero inside the interval means "no difference" is still plausible at this confidence level.

(p̂₁ − p̂₂) ± z*·√(p̂₁q̂₁/n₁ + p̂₂q̂₂/n₂)

Unpooled interval. Each group's own proportion sets its own variance.

Interval vs test

The two proportion z-test answers "is there a difference?"; this interval answers "how big is it, plausibly?". Report both.

Worked examples

Two Proportion Confidence Interval Examples

These two proportion confidence interval examples show a clear and a borderline result. When 45 of 150 patients improve on treatment and 30 of 150 on placebo, the difference is 0.10 with a 95% interval of 0.0027 to 0.1973, so zero is excluded, though only just.

Clear difference

45 of 150 improve on treatment, 30 of 150 on placebo. 95% interval for the difference?

Difference
0.30 − 0.20 = 0.10
SE
√(0.3·0.7/150 + 0.2·0.8/150) = 0.04967
Margin
1.96 × 0.04967 = 0.0973
Interval
0.0027 to 0.1973

0.3 to 19.7 points higher — zero excluded, just

Borderline

A/B test: 120 of 1,000 vs 150 of 1,000. 95% interval?

Difference
0.12 − 0.15 = −0.03
SE
√(0.12·0.88/1000 + 0.15·0.85/1000) = 0.01527
Margin
1.96 × 0.01527 = 0.0299
Interval
−0.0599 to −0.0001

B is 0.01 to 6 points better — barely clear of zero

Background

Why Report a Confidence Interval, Not Only a P-Value?

A p-value compresses the result into one number about one hypothesis. The interval keeps both pieces of information: where the difference probably is and how precisely it is known. In the A/B example, the p-value of 0.0496 says "significant"; the interval adds that the true improvement could be anywhere from almost nothing to six points — a much more honest summary for anyone deciding whether to ship version B.

A narrow interval needs large samples in both groups. If you are planning a comparison, the sample size calculator gives the size for one proportion; for a difference of two, roughly double the per-group requirement as a first estimate. For a single group, use the one-proportion confidence interval calculator, and see the guide to proportions in statistics for the background.

Questions

Two Proportion Confidence Interval Calculator FAQ

What is the formula for a confidence interval for p₁ − p₂?
The confidence interval for p₁ − p₂ is (p̂₁ − p̂₂) ± z* × √(p̂₁(1 − p̂₁)/n₁ + p̂₂(1 − p̂₂)/n₂), where z* is 1.96 for 95% confidence. Unlike the two-proportion z-test, the standard error is unpooled: each group keeps its own proportion, because an interval does not assume the two population proportions are equal.
What does it mean if the interval contains zero?
Zero is a plausible value for the true difference, so the data do not show a significant difference at the matching level (a 95% interval corresponds to a two-tailed test at α = 0.05). If the whole interval is above zero, group 1 is plausibly higher; if it is all below zero, group 2 is.
Why does the interval sometimes disagree with the z-test?
The z-test uses a pooled standard error and the interval an unpooled one, so in borderline cases — p-values very close to α — one can just reject while the other just includes zero. Neither is wrong; the result is simply on the edge.
What conditions are needed?
A two-proportion confidence interval needs two independent random samples and at least 10 successes and 10 failures in each group. With smaller counts the normal approximation is poor and the interval may be too narrow, so it covers the true difference less often than the stated confidence level. In that case, collect more data or use an exact method.
How do I report the difference?
Report the difference between two proportions in percentage points, with the interval: "Group 1 was 10 points higher (95% CI 0.3 to 19.7 points)" is clearer than quoting the two proportions alone. Say percentage points rather than percent, because a rise from 20% to 30% is 10 points but a 50% relative increase. To test the difference formally, use the two proportion z-test calculator.