Sample Size Calculator for a Proportion
This calculator finds how many people or items you need to sample to estimate a proportion (like "what percent prefer X") within a chosen margin of error, at a chosen confidence level. Enter the confidence level, margin of error, and (if you have one) a rough estimate of the proportion itself.
The Formula
This is Cochran's formula for a proportion: n = z²·p·(1−p) / E², where z is the score for your confidence level, p is the estimated proportion, and E is the margin of error as a decimal (0.05 for ±5%).
Worked Example
At 95% confidence, a ±5% margin of error, and p = 0.5: n = 1.96² × 0.5 × 0.5 / 0.05² = 0.9604 / 0.0025 = 384.16, rounded up to 385 — the sample size commonly cited for a standard 95%/±5% survey.
When You Have a Prior Estimate
If a pilot study or earlier survey suggests the true proportion is closer to, say, 0.2 or 0.8 rather than 0.5, entering that estimate shrinks the required sample size — p(1−p) is smaller the further p sits from 0.5.
Frequently Asked Questions
Why does this use p = 0.5 if I don't know the proportion?
p(1−p) is largest when p = 0.5, which gives the biggest — and therefore safest — required sample size. Without prior data, assuming p = 0.5 guarantees your margin of error holds no matter what the true proportion turns out to be.
What confidence levels does this support?
The three most common in practice: 90% (z = 1.645), 95% (z = 1.96), and 99% (z = 2.576). Higher confidence always demands a larger sample for the same margin of error.
Why round the sample size up?
A fractional respondent doesn't exist — if the formula gives 384.16, you need at least 385 full responses to guarantee the stated margin of error, so the result is always rounded up (ceiling), never down.
How does margin of error affect sample size?
Margin of error appears squared in the denominator, so halving it (say from 5% to 2.5%) roughly quadruples the required sample size — tighter precision gets expensive fast.
Where does the z-score come from?
It's the value on the standard normal distribution that cuts off the chosen confidence level in the two tails — 95% confidence leaves 2.5% in each tail, which lands at z = 1.96.