Confidence Interval for a Proportion Calculator

Estimate a population proportion with a confidence interval. Enter the number of successes and the sample size, choose a confidence level, and compare the Wald, Wilson score and Agresti–Coull intervals side by side, along with the margin of error and every step of the calculation.

Formula p̂ ± z·√(p̂(1 − p̂) ⁄ n)

Try an example
Method

Wald vs Wilson vs Agresti–Coull Intervals

A confidence interval for a proportion can be built three common ways from the same data. The Wald interval is p̂ ± z*·√(p̂(1 − p̂)/n); the Wilson score and Agresti–Coull intervals adjust the centre and width so they stay reliable when p̂ is near 0 or 1 or the sample is small.

MethodFormulaBest for
Waldp̂ ± z·√(p̂(1 − p̂)/n)Large samples, p̂ away from 0 and 1. The one in most textbooks.
Wilson score(p̂ + z²/2n ± z·√(p̂(1 − p̂)/n + z²/4n²)) / (1 + z²/n)Any sample size. Never leaves 0–1. The usual recommendation.
Agresti–Coullp̃ ± z·√(p̃(1 − p̃)/ñ), ñ = n + z², p̃ = (x + z²/2)/ñA hand-friendly stand-in for Wilson: add ~2 successes and ~2 failures at 95%.

Find p̂

p̂ = x ÷ n — the sample proportion is the centre of the Wald interval.

Pick z*

1.645 for 90%, 1.960 for 95%, 2.576 for 99%. Higher confidence means a wider interval.

Add the margin

Margin of error E = z*·SE. The interval is p̂ − E to p̂ + E.

Worked examples

Confidence Interval for a Proportion Examples

These examples build a confidence interval for a proportion step by step. In the first, 540 of 1,200 people support a proposal, so p̂ = 0.45, the standard error is about 0.0144, and the 95% Wald interval runs from about 0.422 to 0.478, a margin of error of roughly ±2.8 percentage points.

Large sample

In a poll, 540 of 1,200 people support a proposal. Find a 95% interval.

p̂
540 ÷ 1200 = 0.45
SE
√(0.45 × 0.55 ÷ 1200) = 0.01436
Margin
1.96 × 0.01436 = 0.0281
Wald
0.4219 to 0.4781
Wilson
0.4221 to 0.4783

45% ± 2.8 points — methods agree

Small sample

3 of 25 items fail inspection. Find a 95% interval for the failure rate.

p̂
3 ÷ 25 = 0.12
Wald
−0.0074 to 0.2474 (goes below 0)
Wilson
0.0417 to 0.2996
Agresti–Coull
0.0333 to 0.3079

Use Wilson: 4.2% to 30.0% — Wald goes negative

Background

Why Does the Wald Interval Fail Near 0 or 1?

The Wald interval centres on p̂ and uses p̂ to estimate its own standard error. When p̂ is close to 0 or 1, that standard error is underestimated and the interval is too narrow — a "95%" Wald interval can cover the true value far less than 95% of the time. With x = 0 it collapses to a single point, which is plainly wrong.

The Wilson interval fixes this by inverting the z-test: it collects every value of p that a test would not reject. Its centre is pulled slightly towards 0.5 and its width never collapses, which is why statistics references recommend it as the default. Brown, Cai and DasGupta's review of binomial intervals in Statistical Science (2001, doi:10.1214/ss/1009213286) recommends the Wilson interval for small samples, which is the rule this calculator follows when there are fewer than 10 successes or failures. The full method is on the methodology page.

Margin of error in polls

The "±3 points" quoted with opinion polls is the 95% margin of error for a proportion, usually computed at p = 0.5 where it is largest. A sample of about 1,068 gives ±3 points; see the sample size calculator for the arithmetic. For comparing two groups — say, support among two age bands — use the two proportion confidence interval. The guide to proportions in statistics explains the sampling distribution behind all of these.

Questions

Confidence Interval for a Proportion FAQ

Methods, meaning and how to narrow the interval.

What is the formula for a confidence interval for a proportion?
The textbook (Wald) interval is p̂ ± z* × √(p̂(1 − p̂) ÷ n), where p̂ = x ÷ n and z* is the critical value for your confidence level — 1.645 for 90%, 1.960 for 95%, 2.576 for 99%. The part after ± is the margin of error.
Which method should I use: Wald, Wilson or Agresti–Coull?
With a large sample and a proportion not near 0 or 1, all three agree to two or three decimal places. For small samples or extreme proportions, the Wald interval is unreliable — it can even extend below 0 or above 1 — and the Wilson score interval is the standard recommendation. Agresti–Coull ("add two successes and two failures" at 95%) is a simple approximation that behaves almost as well.
What does a 95% confidence interval actually mean?
If you repeated the sampling many times and built an interval each time, about 95% of those intervals would contain the true population proportion. It does not mean there is a 95% probability that this particular interval contains it — the true proportion is fixed; it is the interval that varies.
How do I make the interval narrower?
Increase the sample size or lower the confidence level. Because the margin of error shrinks with √n, halving it needs four times the sample. To plan a study around a target margin, use the sample size for a proportion calculator.
What conditions does the interval need?
A confidence interval for a proportion needs a random sample and independent observations. The Wald interval also needs at least 10 successes and 10 failures in the sample, because it relies on the normal approximation. The Wilson score interval remains reasonable with smaller counts, which is why the calculator shows Wilson as the main answer when either count is below 10.
How does this relate to a hypothesis test?
A confidence interval and a hypothesis test use the same information. A 95% interval contains roughly the values p₀ that a two-tailed test at α = 0.05 would not reject, so a claimed value outside the interval would be rejected. To test one specific value directly and get a p-value, use the one proportion z-test calculator.