Proportion confidence interval calculator
Enter a count and a sample size to get the proportion with its confidence interval by five methods side by side, and an exact binomial test against any benchmark proportion.
Enter the count and sample size
For a percentage from a sample: survey answers, pass rates, error rates, conversion rates.
LIVE RESULT
INSTANTProportion and confidence interval
The interval covers sampling error from a random sample only. It does not correct for non-response, a convenience sample or measurement error.
Which confidence interval for a proportion?
The textbook interval p ± 1.96 √(p(1 − p) ÷ n), the Wald interval, is easy to compute but often wrong. Its actual coverage can fall well below 95% even with hundreds of observations, and it breaks down completely when the proportion is near 0% or 100%, giving zero-width intervals or limits outside 0–100%. Brown, Cai and DasGupta (2001) showed this in detail and recommended the Wilson or Jeffreys interval instead.
Wilson: (p + z²/2n ± z √(p(1 − p)/n + z²/4n²)) ÷ (1 + z²/n)
Clopper–Pearson: limits from the Beta(x, n − x + 1) and Beta(x + 1, n − x) quantiles
Jeffreys: Beta(x + ½, n − x + ½) quantiles
Agresti–Coull: Wald interval after adding z²/2 successes and z²/2 failures
- Wilson is the best general choice: close to the nominal coverage on average and never outside 0–100%. It is the default in many modern texts and packages.
- Clopper–Pearson (the “exact” interval) guarantees at least the nominal coverage, so it is wider than needed; use it when a regulator or protocol requires a conservative interval.
- Jeffreys behaves like Wilson and is slightly better in the tails; at 0 or n events its open end is set to 0% or 100%, as Brown, Cai and DasGupta recommend.
- Wald is shown for comparison only.
The intervals match Python's statsmodels.stats.proportion.proportion_confint, and the exact binomial test matches SciPy's binomtest.
The methods side by side
| Result | Wilson score | Clopper–Pearson | Jeffreys | Agresti–Coull | Wald |
|---|---|---|---|---|---|
| 12 of 40 | 18.1–45.4 | 16.6–46.5 | 17.6–45.2 | 18.0–45.5 | 15.8–44.2 |
| 3 of 200 | 0.5–4.3 | 0.3–4.3 | 0.4–3.9 | 0.3–4.5 | 0.0–3.2 |
| 0 of 25 | 0.0–13.3 | 0.0–13.7 | 0.0–9.5 | 0.0–15.8 | 0.0–0.0 |
| 19 of 20 | 76.4–99.1 | 75.1–99.9 | 78.9–99.5 | 74.6–100.0 | 85.4–100.0 |
With 12 of 40 the methods roughly agree. With 3 of 200 the Wald interval runs into zero and has to be cut off there, and with 0 of 25 it collapses to a single point, as if zero events proved the true rate is exactly zero. The Clopper–Pearson upper limit for 0 of 25, 13.7%, is close to the “rule of three”, 3 ÷ n = 12.0%.
Worked example
In a usability test, 12 of 40 participants failed to complete a task: 30.0%, 95% Wilson CI 18.1% to 45.4%. Is the failure rate different from 50%? The exact binomial test gives p = 0.017. With 40 participants, the failure rate could plausibly be anywhere from about one in five to almost half.
Planning and comparing
To find the sample needed for a given margin of error, use the survey sample size calculator. To compare two proportions, such as conversion rates in an A/B test or outcomes in two groups, use the two proportions calculator.