The formulas
The sample size you need depends on three choices: how confident you want to be, how precise the answer must be, and how variable the thing you are measuring is. It depends surprisingly little on how large the population is.
For a proportion: n₀ = z*² × p × (1 − p) ÷ E²
For a mean: n₀ = (z* × σ ÷ E)²
Finite population correction: n = n₀ ÷ (1 + (n₀ − 1) ÷ N)
In these formulas:
- z* is the critical value for the confidence level: 1.645 for 90%, 1.960 for 95% and 2.576 for 99%.
- E is the margin of error you will accept, as a decimal for a proportion (5 percentage points is 0.05) or in the units of the data for a mean.
- p is the proportion you expect to find, as a decimal. The product p × (1 − p) is largest at p = 0.5, so 50% is the cautious choice when you do not know.
- σ is the standard deviation of the measurement, estimated from earlier data or a pilot.
- n₀ is the sample size for a very large population, N is the actual population size and n is the corrected sample size.
Always round the final figure up. Rounding down would leave the margin of error slightly wider than you asked for.
Reverse, margin of error from a sample: E = z* × √(p × (1 − p) ÷ n) × √((N − n) ÷ (N − 1))
The last square root is the finite population correction again; leave it out when the population is large. For a mean, replace √(p × (1 − p) ÷ n) with σ ÷ √n.
Worked example by hand
You want to estimate the percentage of customers who would recommend your business, to within 5 percentage points, with 95% confidence. You have no idea what the answer will be.
- Values. z* = 1.96, p = 0.5, E = 0.05.
- Top line. 1.96² = 3.8416, and 3.8416 × 0.5 × 0.5 = 0.9604.
- Divide by E². 0.05² = 0.0025, and 0.9604 ÷ 0.0025 = 384.16.
- Round up. You need 385 responses.
Now suppose you only have 2,000 customers. Apply the correction: 384.16 ÷ (1 + 383.16 ÷ 2,000) = 384.16 ÷ 1.1916 = 322.4, so 323 responses are enough. With 500 customers the figure falls to 218.
A mean. To estimate average weekly spending to within $2, when earlier data suggests a standard deviation of $15, at 95% confidence: (1.96 × 15 ÷ 2)² = 14.7² = 216.09, which rounds up to 217.
What drives the answer
Precision is expensive
Because E is squared in the formula, halving the margin of error multiplies the sample by four. At 95% confidence and p = 50%, a margin of ±5 points needs 385 responses, ±3 points needs 1,068, ±2.5 points needs 1,537 and ±1 point needs 9,604. Most national opinion polls settle at around a thousand people for this reason: it buys about ±3 points, and doing much better costs far more.
Confidence costs less than precision
At ±5 points, moving from 90% to 95% confidence raises the sample from 271 to 385, and 99% takes it to 664.
Population size hardly matters once it is large
A population of 2,000 needs 323 responses, a population of 100,000 needs 383, and a population of 100 million still needs only 385. What matters is the absolute size of the sample, not the fraction of the population it covers. The correction is worth applying only when the sample would be more than about 5% of the population.
A better guess at p reduces the sample
If you are confident the proportion is near 20%, then p × (1 − p) is 0.16 instead of 0.25 and the requirement at 95% and ±5 points drops from 385 to 246. Be careful: if the guess is wrong in the direction of 50%, the survey will be less precise than planned.
Practical points and common mistakes
The figure is completed responses, not invitations
If you expect one person in four to reply, divide by the response rate: 385 ÷ 0.25 = 1,540 invitations. Low response rates also bring a risk of bias that no sample size can repair, since the people who answer may differ from those who do not.
The formulas assume a simple random sample
Every member of the population must have the same chance of being chosen. A large sample that is self-selected, such as a poll on a website, can be far less accurate than a small random one. Cluster or stratified designs need their own adjustments.
Subgroups need their own sample size
A survey of 385 gives ±5 points for the whole group. If you intend to report results separately for, say, four regions, each region is a sample of fewer than 100, with a margin of error near ±10 points. Size the survey for the smallest group you plan to analyse.
Reading a margin of error you have been given
Use the reverse mode to check published figures. A survey of 1,000 people has a margin of error of ±3.1 points at 95% confidence, and a survey of 400 has ±4.9 points. If those 400 came from a population of only 2,000, the correction reduces it to ±4.4 points. These margins apply to results near 50%; results near 0% or 100% are more precise. The confidence interval calculator gives the interval for a particular result.