Proportions (approval ratings, defect rates, conversion rates, the share of patients who respond to a treatment) are estimated from samples, and every sample proportion p̂ = x/n carries sampling uncertainty. A confidence interval turns that uncertainty into a range of plausible values for the true population proportion.
The textbook Wald interval, p̂ ± z√(p̂(1 − p̂)/n), is simple but behaves badly when the sample is small or the proportion is near 0% or 100%: it can extend below zero, collapses to a single point when x = 0, and its real coverage is often well below the nominal level. Statisticians therefore recommend alternatives. The Wilson score interval (the default here) has excellent coverage and stays inside 0–100%. Agresti–Coull adds about two successes and two failures before using the Wald formula. Clopper–Pearson inverts the exact binomial distribution and guarantees at least the stated coverage, at the cost of being wide. Jeffreys uses Beta quantiles and sits between Wilson and Clopper–Pearson.
Enter the number of successes and the sample size, choose the confidence level and method, and the comparison table shows how much the choice matters for your data.
How to use the Confidence Interval for a Proportion Calculator
- Number of successes (x)
- Sample size (n)
- Confidence level
- Custom confidence level
- Interval method
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
The calculator computes p̂ = x ÷ n and z* for the chosen level, then each interval: Wald and Agresti–Coull from the normal formula, Wilson from the score formula, and Clopper–Pearson and Jeffreys from inverse Beta distribution functions. Bounds are kept within 0% and 100%.
Worked example
In a survey 42 of 120 customers say they would recommend the product, so p̂ = 35%. At 95% confidence z* = 1.96. Wilson: centre (0.35 + 1.96²/240) ÷ (1 + 1.96²/120) = 0.3547 and half-width 0.0841, giving 27.05% to 43.88%. Wald gives 26.47% to 43.53%, Agresti–Coull 27.04% to 43.89%, Clopper–Pearson 26.52% to 44.24% and Jeffreys 26.90% to 43.81%. With this many successes and failures the methods agree to within about one percentage point.
Which method should I use?
| Situation | Good choice |
|---|---|
| General use | Wilson score |
| Regulatory or “guaranteed” coverage | Clopper–Pearson |
| Bayesian-flavoured, small n | Jeffreys |
| Teaching, very large n and p̂ near 50% | Wald |
| Simple adjustment of Wald | Agresti–Coull |
Formula
p̂ = x ÷ n · Wald: p̂ ± z√(p̂(1 − p̂)/n) · Wilson: (p̂ + z²/2n ± z√(p̂(1 − p̂)/n + z²/4n²)) ÷ (1 + z²/n) · Clopper–Pearson: Beta quantiles B(α/2; x, n − x + 1) and B(1 − α/2; x + 1, n − x)
Worked example
Inputs: Number of successes (x): 42; Sample size (n): 120; Confidence level: 95%; Interval method: Wilson score (recommended).
Results: Confidence interval = 27.052% to 43.879% (Wilson score); Sample proportion (p̂) = 35 %; Lower bound = 27.052 %; Upper bound = 43.879 %; Half-width (margin of error) = 8.413 percentage points; Interval width = 16.827 percentage points.
Key terms
- Sample proportion (p̂)
- Successes divided by sample size.
- Coverage
- How often intervals from a method actually contain the true proportion.
- Wilson score interval
- Interval obtained by inverting the score test; good coverage for all n.
- Clopper–Pearson interval
- Exact interval based on binomial tail probabilities.
Frequently asked questions
What is the formula for a confidence interval for a proportion?
The basic (Wald) formula is p̂ ± z*√(p̂(1 − p̂)/n). For 42 out of 120 at 95%: 35% ± 1.96 × 4.35% = 26.47% to 43.53%.
Why is the Wilson interval recommended?
Its actual coverage stays close to the stated level even for small samples and extreme proportions, and it never goes below 0% or above 100%.
What should I do when there are zero successes?
Use Wilson, Clopper–Pearson or Jeffreys. The Wald interval collapses to 0–0%. With 0 of 30, the exact 95% upper bound is 11.6% (close to the "rule of three": 3/n = 10%).
What is the Clopper–Pearson interval?
An exact interval built from the binomial distribution. It always has at least the nominal coverage, so it is conservative (wider).
How do I make the interval narrower?
Increase the sample size: the width shrinks with √n, so four times the sample halves it.
What sample size gives ±5% at 95% confidence?
About 385 when the proportion is near 50%. Use the sample size calculator for other targets.
Is p̂ the same as the sample proportion?
Yes. p̂ = x/n is the observed share of successes and the point estimate of the population proportion.