Sample Size for a Target Margin of Error
Before running a survey or an experiment, it is worth knowing in advance how many respondents or trials are actually needed — too few and the result is too noisy to trust, too many and time and budget are wasted collecting data past the point of diminishing returns. This formula converts a target margin of error directly into a required sample size.It is the standard tool behind "margin of error ±3%, 95% confidence" claims seen in political polling and market research. Because sample size grows with the square of 1/E, tightening the margin of error from 5% to 2.5% roughly quadruples the number of respondents needed — a cost trade-off worth understanding before committing to a survey design.
The required sample size is n = Z²·p·(1−p)/E², from the normal approximation to a binomial proportion. where Z_conf is the z-value for the desired confidence level, p_est is the estimated proportion (0.5 is the most conservative, worst-case choice), and E_marg is the desired margin of error.
Combine the confidence z-value, the worst-case variance p(1−p), and the target margin of error to get the minimum number of respondents needed.
Results
For a 95% confidence level with a ±5% margin of error and no prior information about the true proportion, roughly 385 respondents are needed — the classic number behind many national opinion polls. Using p_est = 0.5 is deliberately conservative (it maximizes p(1−p) and therefore n); if a rough estimate of the true proportion is already known, a smaller, more targeted sample can suffice. The result should always be rounded up to the next whole respondent.