Confidence Interval for a Proportion Calculator

StatisticsLast updated: August 22, 2026

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.

The number of observations carrying the characteristic of interest; the proportion is computed as x/n.
The total number of trials or participants.
The probability that the interval covers the true parameter.
The selected method is highlighted at the top of the results; all three are computed in every case.
The calculator reports whether the interval contains this value. Enter 0.5 for 50%, or leave it empty.

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

Values derived from the binomial distribution and the standard normal approximation; they do not change over timeKaynak: Wilson (1927) score interval; Agresti & Coull (1998); Brown, Cai & DasGupta (2001) coverage comparisons

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 bound

The 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

  1. Enter the number of events (successes) and the total number of observations; the proportion is computed as x/n.
  2. Choose the confidence level — 95% is the standard choice in academic work.
  3. Decide which method to highlight; Wilson is recommended for small samples and extreme proportions.
  4. If you like, enter a comparison proportion (0.5 for 50%); the calculator reports whether the interval contains that value.
  5. Compare the Wilson, Wald, and Agresti-Coull intervals together with their widths.
  6. 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

Frequently Asked Questions

Why is Wilson recommended instead of Wald?
The Wald interval, p̂ ± z·√(p̂(1−p̂)/n), is symmetric around p̂ and has three serious problems: on small n its actual coverage falls far below the nominal level, its bounds can run outside 0–1, and it collapses to a zero-width point when p̂ = 0 or 1. The Wilson score interval suffers from none of these and gives reasonable coverage even on samples as small as n = 10.
If no event was observed (x = 0), is the proportion really zero?
No. x = 0 only says that no event was seen in the sample; it does not show that the proportion in the population is zero. Wald produces the interval [0; 0] here, which is misleading. The upper bound of the Wilson interval shrinks as n grows; the rough "rule of three" gives a similar answer: when x = 0, the 95% upper bound is about 3/n (roughly 15% for n = 20).
When should the Agresti-Coull interval be used?
Agresti-Coull corrects the Wald formula with an "add two successes and two failures" logic: z²/2 is added to x and z² to n, then the same formula is applied. It gives coverage as good as Wilson's, is easier to compute by hand, and is widely recommended in textbooks. Its bounds come out very close to Wilson's; it is enough to state which one you reported.
Is the Clopper-Pearson (exact) interval better?
Clopper-Pearson is derived from the binomial distribution itself and its coverage never falls below the nominal level, so it is preferred in safety-critical applications. The price is an unnecessarily wide (conservative) interval. For routine reporting, Wilson strikes a better balance between coverage and width.
Is the "±3 point margin of error" in surveys the same thing?
Yes, it is the same computation: the margin of error is z·√(p̂(1−p̂)/n) and reaches its widest value at p̂ = 50%. For n = 1,000 the 95% margin of error is at most ±3.1 points. That figure covers sampling error only; refusal to participate, question order, and sampling-frame errors are not included in the interval.
How do I get these intervals in Excel, SPSS, and R?
In R, prop.test(x, n) gives the Wilson interval with a continuity correction and binom.test(x, n) gives the Clopper-Pearson interval; for Wilson without the correction use prop.test(x, n, correct = FALSE). In SPSS, Analyze → Descriptive Statistics → Frequencies gives no interval by default; the Bootstrap add-on or custom syntax is needed. Excel has no built-in Wilson function, so the formula has to be written out by hand.
What should I do if the interval runs outside 0–1?
This happens only with the Wald interval and is a clear sign that the method is not appropriate. Clipping the bound to 0 or 1 hides the problem rather than solving it: the actual coverage of the clipped interval is still low. The right response is to switch to the Wilson, Agresti-Coull, or Clopper-Pearson interval.