How to use this calculator
- 1 Choose what to find: the sample size, or the margin of error for a sample you already have.
- 2 Pick a confidence level, such as 95%. Enter the margin of error you can accept, such as ±5%.
- 3 Enter the expected proportion. Use 50% when you are unsure, because it gives the largest sample size.
- 4 Enter the population size if it is small and known. Otherwise leave it at 0.
What is a sample size?
A sample is a subset of a group that you study in order to learn about the whole group. The sample size is the number of people or items in that subset. A larger sample usually gives more precise results.
Sample size is not a share of the population. A survey of 400 people can be very accurate for a country of 60 million, if the sample is random. The size of the population matters much less than most people expect.
The sample size is set by three choices: the confidence level, the margin of error and the variation in the data. Changing any one of them changes the answer.
Confidence level and margin of error
The confidence level, such as 95%, describes how often the method would capture the true value across repeated samples. Higher confidence needs a larger sample, because the range has to be wider or the sample bigger.
The margin of error is the range either side of your result. A survey that finds 60% support with a margin of ±3% suggests the true value lies between 57% and 63%, at the chosen confidence level.
Halving the margin of error needs about four times the sample size, because the margin shrinks with the square root of n. A tighter target can therefore become expensive quickly.
| Margin of error | Sample size |
|---|---|
| ±10% | 97 |
| ±5% | 385 |
| ±3% | 1,068 |
| ±2% | 2,401 |
| ±1% | 9,604 |
Why 50% is the safe choice
The sample size formula includes p × (1 − p), the variation in a yes or no answer. This product is largest at p = 50%, where it equals 0.25. When the true proportion is closer to 0% or 100%, the variation is smaller and you need a smaller sample.
Using 50% is therefore a safe, conservative choice when you do not know the answer in advance. You may end up with a slightly larger sample than strictly needed, which protects the margin of error.
If a pilot study shows a proportion near 20%, you can enter that value. The required sample then falls, but you should still plan for the uncertainty in the pilot result.
Population size and practical limits
For a small, known population, the sample can be smaller than the basic formula suggests. This is the finite population correction. It matters most when the sample is a large share of the group, such as 10% or more.
In practice, sample size is only one part of a good survey. Non-response, unclear questions and an unrepresentative sample can cause larger errors than a small margin of error. The standard margin describes random sampling error only.
Plan the sample size before you collect data. The confidence interval calculator shows the range once you have results, and the z-score calculator explains the z value used in the formula.
Tips for planning a sample
A good sample depends on the plan as much as the maths. These points help:
- Decide the margin first. Choose the smallest margin that the decision needs, not the smallest you can afford.
- Allow for non-response. If only half of contacted people reply, you may need to contact twice as many.
- Use random selection. The formula assumes every member has a known chance of being picked.
- Check the percentage. Convert proportions with the percentage calculator if your target is in another format.
- Look at the spread for numbers. For a measured average rather than a proportion, check the standard deviation calculator on pilot data.
The formula
Sample size for a proportion
n = z² × p × (1 − p) ÷ E²
- z
- the critical z value for the confidence level, such as 1.96 for 95%
- p
- the expected proportion, as a decimal
- E
- the margin of error, as a decimal, such as 0.05 for ±5%
Finite population correction
n = n₀ ÷ (1 + (n₀ − 1) ÷ N)
- n₀
- the sample size before the correction
- N
- the population size
Margin of error
E = z × √(p × (1 − p) ÷ n)
- n
- the sample size you have
Worked example
A survey of a town of 1,000 people at 95% confidence and ±5%
- 1.Before correction: 1.959964² × 0.5 × 0.5 ÷ 0.05² = 384.1459, rounded up to 385.
- 2.With the population correction: 385 ÷ (1 + 384 ÷ 1,000) = 278.2, rounded up.
- 3.Result: 279 people.
You need a sample of 279 people. Without the population correction you would need 385.
Frequently asked questions
How many people do I need for a survey?
For a large population at 95% confidence and ±5%, you need about 385 people, using p = 50%. Enter your own margin and confidence level to get the exact figure for your study.
Does a bigger population need a bigger sample?
Not by much. For large populations, the needed sample barely changes. A population of 1,000 needs about 279 people at 95% and ±5%, while a much larger one needs about 385.
Why use 50% for the proportion?
At 50% the variation is largest, so the sample size is largest too. Using it gives a safe answer when you do not know the true proportion.
What confidence level should I use?
The most common choice is 95%. Higher levels need larger samples. Choose the level that suits the stakes of your study and follow any standards your field or organisation uses.
Does a margin of error cover every kind of error?
No. It covers random sampling error only. Biased questions, poor response rates and an unrepresentative sample can cause errors that a larger sample does not remove.
Sources
Last reviewed by the GridCalculators team.