Sample size calculator
Precision is expensive: halving the margin of error takes four times the sample. The curve shows the trade-off for your settings.
- z* for 95% = 1.96
- n₀ = z²·p(1 − p) / E² = 1.96² × 0.5 × 0.5 / 0.05² = 384.15
- Round up: n = 385
Where the formula comes from
The margin of error of a confidence interval is E = z* × (standard error). For a proportion the standard error is √(p(1 − p)/n), so solving E = z*√(p(1 − p)/n) for n gives n = z*² p(1 − p) / E². The same algebra for a mean gives n = (z*σ / E)².
The square-root law
Because n depends on 1/E², halving the margin of error needs four times the sample. The curve above shows the cost: the last few points of precision are by far the most expensive. That is why most national polls settle for about ±3 points with roughly 1,000 respondents.
Why p = 50% is the safe choice
p(1 − p) is largest at p = 0.5 (0.25). If you have no prior estimate, using 50% guarantees your sample is big enough whatever the true proportion turns out to be.
What sample size cannot fix
These formulas assume a random sample. A huge but biased sample, such as the 1936 Literary Digest poll of over 2 million people that wrongly predicted Landon would beat Roosevelt, is worse than a small random one. Check your interval afterwards with the confidence interval calculator.
Still not clicking? Ask the tutor
An AI tutor that sees the numbers you entered above and explains them. It can make mistakes, so check anything important against the worked steps.
Questions students ask
How do you calculate sample size for a survey?
n = z² × p(1 − p) / E², where z is the critical value (1.96 for 95%), p the expected proportion and E the margin of error. Use p = 0.5 if you have no idea; it gives the largest, safest n.
Why is 385 such a common sample size?
It is the answer for 95% confidence and a ±5% margin of error with p = 0.5: 1.96² × 0.25 / 0.05² = 384.16, rounded up to 385.
Does population size matter?
Barely, unless the sample is a sizeable fraction of the population. The finite population correction n₀ / (1 + (n₀ − 1)/N) reduces n for small populations.
What about sample size for a mean?
n = (z × σ / E)², where σ is an estimate of the standard deviation from past data or a pilot study.