n = z² · p(1 − p) / E²
z is the z-value for the confidence level (1.96 for 95%, 2.576 for 99%), p the
proportion you expect and E the margin of error, both as decimals.
95% confidence, margin ±5 percentage points, expected share 30%:
n = 1.96² · 0.3 · 0.7 / 0.05² ≈ 322.7 — so 323 respondents. Always round up.
When you have no idea what p is
p(1 − p) is largest at p = 0.5, so that is the safe assumption: it gives the largest n, and any other true
share only makes the result more precise.
| Confidence |
Margin |
n at p = 0.5 |
| 95% |
±5 points |
385 |
| 95% |
±3 points |
1,068 |
| 99% |
±3 points |
1,844 |
Many opinion polls ask about a thousand people, which matches the middle row.
Precision is expensive
E is squared in the denominator: halving the margin of error takes four times as many respondents. Going
from ±3 to ±1 point takes nine times as many — from about a thousand to over nine thousand.
The population size does not appear in the formula, which assumes the population is much larger than the
sample. Then a thousand people pin down a share just as well in Sweden as in India, provided they are
chosen at random.
Common mistakes
- Percent instead of decimals. E = 5 and p = 30 give nonsense; use 0.05 and 0.3.
- Rounding down. 322.7 means 323; 322 falls short of the margin you asked for.
- Counting invitations instead of answers. If half reply, send out twice as many.
Questions people ask
How do I get the margin of error from n instead?
Turn the formula round: E = z · √(p(1 − p) / n). With 1,000 respondents and p = 0.5 it is about ±3.1 points.
The calculator solves for any of the four.
Does it work for averages too?
Not this one. For a mean, replace p(1 − p) with the variance: n = z² · s² / E².