How to use the sample size and margin of error calculator
- Choose Sample size needed to plan a survey, or Margin of error to check the accuracy of results you already have.
- Pick a confidence level, such as 95%.
- For sample size, enter the margin of error you can accept. For margin of error, enter the sample size.
- Enter the expected proportion, using 50 if you do not know, and the population size if it is small and known. Leave the population blank for a large or unknown group.
Formula
z = the point on the normal curve with (1 + confidence) / 2 of the area below it
n0 = z squared x p x (1 - p) / e squared
With a population N: n = n0 / (1 + (n0 - 1) / N)
Margin of error = z x square root of (p x (1 - p) / n), times square root of ((N - n) / (N - 1)) with a population
p is the expected proportion as a decimal and e is the margin of error as a decimal. The result is rounded up to a whole person.
Worked example
For 95% confidence, z is 1.96. With a 5% margin and p = 50%, n0 = 1.96 squared x 0.25 / 0.05 squared = 384.15, so you need 385 responses.
If the population is only 10,000 people, the correction gives 384.15 / (1 + 383.15 / 10,000) = 369.97, which rounds up to 370.
Going the other way, 1,000 responses at 95% confidence and p = 50% give a margin of error of plus or minus 3.1%, and it falls to 2.77% if the whole population is 5,000.
What confidence level and margin of error mean
The margin of error is how far a survey result might be from the true value for the whole group. Confidence level is how often a method built this way would capture the true value. A 95% confidence level with a 5% margin means that, if you repeated the survey many times, about 95 in 100 results would land within 5 percentage points of the truth.
Why 50% is the safe choice
The sample you need is largest when the proportion is 50%, so using 50 gives a number that is safe whatever the real answer turns out to be. If you have good reason to expect that, say, only 10% will answer yes, you can enter 10 and need a smaller sample. For a 3% margin the sample falls from 1,068 to 385 in that case.
Beyond the minimum
Not everyone you contact answers, so you may need to invite many more people than the sample size. If you want results for subgroups, each subgroup needs its own sample. The formula also assumes a random sample, which is hard to get in practice. To work with the results afterward, see the z-score calculator and the percentage calculator.
Assumptions and limits
- The answer is a yes or no style proportion from a simple random sample.
- The z value comes from the normal curve for the confidence level you pick.
- A population is used only for the finite population correction and should be a whole number.
- Nonresponse, clustering and weighting are not modeled.
Frequently asked questions
How many survey responses do I need?
For a 95% confidence level and a 5% margin of error, about 385 responses for a large population. A smaller margin or higher confidence needs more.
Does population size matter?
Only when the population is small. Above tens of thousands, the sample size barely changes. For a small group, the correction lowers the number you need.
What is a good margin of error?
Many surveys use 3% to 5%. The right choice depends on how precise you need to be and how many people you can reach, since halving the margin takes about four times the sample.
What does the expected proportion do?
It is your guess at the share who will give a particular answer. Sample size is largest at 50%, so it is the cautious choice when you are unsure.