How to calculate the sample size for a survey
Last reviewed 16 October 2026
A survey needs enough respondents to estimate a proportion, such as the prevalence of a disease, with a precision you can defend. The calculation takes four decisions: the expected proportion, the precision you will accept, the confidence level and the adjustments for how people are sampled.
Open the sample size calculatorThe formula
For a proportion p, a confidence level with critical value z and a precision (half-width of the confidence interval) d, the sample size is n = z² × p × (1 − p) ÷ d².
At 95% confidence z is 1.96. If you have no idea what the proportion is, use p = 0.5: it gives the largest sample, so it can only be too cautious.
A worked example
Unknown prevalence (p = 0.5), 95% confidence and a precision of ±5 percentage points gives 385 respondents. Tightening the precision to ±3 points gives 1,068. If earlier studies suggest a prevalence near 20%, the same ±5 points needs only 246, which is why a credible prior estimate is worth citing.
Adjust for non-response
Do not add a percentage for people who refuse or drop out: divide by the proportion you expect to keep. With 10% expected loss, 385 becomes 385 ÷ 0.9 = 428 (rounded up), not 424.
Adjust for clustering
If you sample whole villages, schools or clinics, people in a cluster resemble each other, so the effective sample is smaller. Multiply by the design effect, 1 + (m − 1) × ICC, where m is the average cluster size and the ICC the intra-cluster correlation. See the guide on design effect and ICC.
What to write in a protocol
State the expected proportion and where it comes from, the precision, the confidence level, the formula, the adjustments and the final number. Reviewers look for the source of the expected proportion first.
Common questions
- What sample size do I need if I do not know the prevalence?
- Use 50%. For a 95% confidence interval of ±5 percentage points that gives 385 respondents, before any adjustment for non-response or clustering.
- Does the population size matter?
- Only when the sample is a large share of a small population, for example more than about 5% of it. Then a finite population correction reduces the sample. For a large population it makes no difference.
- Is a bigger sample always better?
- A larger sample narrows the interval, but a biased sample stays biased however large it is. Sampling method and response rate matter as much as the number.
Keep reading
General methods guidance, not a substitute for advice from a statistician on your specific study.