Confidence Interval for a Proportion Calculator
A percentage observed in a sample ("32% of respondents said yes") is only an estimate of the true proportion in the population. A confidence interval for a proportion puts bounds around that estimate to show its uncertainty. The margin of error in a survey, the success rate in a clinical study, and the defect rate in quality control are all reported with such an interval.
This calculator computes the same data with three methods at once. The default is the Wilson score interval: its bounds never run outside 0–1, it does not collapse when p̂ = 0 or p̂ = 1, and on small samples it hits the target coverage far better than the classical Wald approximation. The Wald interval is computed for comparison, and Agresti-Coull is the easily corrected version of Wald. The comparison table shows numerically that, for the same n, Wald shrinks to a zero-width interval as the number of successes goes to the extremes (0 and n) while Wilson keeps producing a sensible interval.
Coverage Behavior by Method
Different interval methods applied to the same data produce different widths and different actual coverage rates. The values below are for a 95% confidence level.
- z critical value (95%)
- 1.9600
- All three methods use the same critical value
- z critical value (90% / 99%)
- 1.6449 / 2.5758
- The interval widens as the confidence level rises
- Wald when x = 0 or x = n
- Zero width
- Because p̂(1−p̂) = 0, the standard error comes out as 0 and the interval collapses to a single point
- Wilson when n = 10 and x = 0
- 0.00% – 27.75%
- Even when no event is observed, the upper bound is not zero
- Wilson when n = 10 and x = 10
- 72.25% – 100.00%
- Even at complete success, the lower bound is not 100%
- Wald reliability rule
- x ≥ 5 and n − x ≥ 5
- Preferably both counts should be above 10; when they fall below that, use Wilson
Confidence Interval Formulas for a Proportion
Sample proportion: p̂ = x / n
Wald: CI = p̂ ± z(1−α/2) · √( p̂(1 − p̂) / n )
Wilson center: c = (p̂ + z² / 2n) / (1 + z² / n)
Wilson half-width: h = z / (1 + z²/n) · √( p̂(1 − p̂)/n + z² / 4n² )
Wilson: CI = c ± h
Agresti-Coull: ñ = n + z², p̃ = (x + z²/2) / ñ
CI = p̃ ± z · √( p̃(1 − p̃) / ñ )
Width: W = upper bound − lower boundThe Wald interval is symmetric around p̂ and collapses to zero width when p̂(1−p̂) = 0; the Wilson interval is obtained by solving the score inequality for p, so it stays within the 0–1 bounds and does not collapse at extreme proportions.
How to Calculate
- Enter the number of events (successes) and the total number of observations; the proportion is computed as x/n.
- Choose the confidence level — 95% is the standard choice in academic work.
- Decide which method to highlight; Wilson is recommended for small samples and extreme proportions.
- If you like, enter a comparison proportion (0.5 for 50%); the calculator reports whether the interval contains that value.
- Compare the Wilson, Wald, and Agresti-Coull intervals together with their widths.
- Use the table below to see how Wald collapses at extreme success counts (0 and n) for the same n, and decide which method to report.
Worked Examples
Wilson versus Wald on a small sample
The event was observed in 8 of 25 observations; p̂ = 32.00%. The Wilson interval is 17.21% – 51.59% (a width of 34.38 points), while the Wald interval is 13.71% – 50.29% (36.57 points). The Agresti-Coull interval, 17.06% – 51.73%, is very close to the Wilson one. Because the Wilson interval contains 50%, it has not been shown that the proportion differs from 50%.
Wilson score 95% confidence interval: 17.21% – 51.59% · Sample proportion (p̂): 32.00% · Does the interval contain 50.00%?: Yes — the difference is not significant
When no event is observed (0/n)
No event was observed in 20 trials; p̂ = 0.00%. The Wald interval is 0.00% – 0.00%, that is, it collapses to a single point and gives the false impression that the risk is certainly zero. The Wilson interval, by contrast, is 0.00% – 16.11%: with 20 observations a true proportion as high as 16% cannot be ruled out.
Wilson score 95% confidence interval: 0.00% – 16.11% · Sample proportion (p̂): 0.00% · Wilson score interval: 0.00% – 16.11%
Large survey sample (95% margin of error)
220 of 400 respondents said yes; p̂ = 55.00%. The Wald interval is 50.12% – 59.88% and the Wilson interval is 50.10% – 59.80%; on a large sample the two methods give almost identical results. Because the interval does not contain 50%, the yes rate differs from 50% significantly at α = 0.05.
Wald 95% confidence interval: 50.12% – 59.88% · Sample proportion (p̂): 55.00% · Does the interval contain 50.00%?: No — the difference is significant