How Big a Sample Do You Need? Sample Size and Margin of Error
Before running a survey or an experiment, the first practical question is how many responses you need. Too few and the result is too imprecise to act on. Too many and you spend time and money for little extra accuracy.
For a simple yes/no survey the answer comes from a short formula built on three choices: how confident you want to be, how small a margin of error you can accept, and a rough guess of the proportion you expect. This guide works through it with numbers and points out the limits of the method.
The three choices behind every sample size
- Confidence level: usually 95%, which corresponds to a z-value of 1.96. Higher confidence needs a larger sample.
- Margin of error (E): the plus-or-minus you can live with, such as 5 percentage points. A smaller margin needs a larger sample.
- Expected proportion (p): your guess of the share who will say yes. If you have no idea, use 0.5, which gives the largest, safest sample size.
The margin of error describes sampling noise only. It says nothing about badly worded questions, people who refuse to answer, or a sample that is not random.
The formula and a worked example
n = z² × p × (1 − p) ÷ E²Sample size for estimating a proportion with a simple random sample.
Worked example: you want 95% confidence, a margin of error of 5 percentage points (E = 0.05), and you have no prior estimate, so p = 0.5.
n = 1.96² × 0.5 × 0.5 ÷ 0.05² = 3.8416 × 0.25 ÷ 0.0025 = 384.16. Always round up, so you need 385 responses.
If you can narrow your guess, the number drops. With p = 0.2 and the same margin, n = 3.8416 × 0.2 × 0.8 ÷ 0.0025 = 245.9, which rounds up to 246.
To check a result, or to try other settings, use the power and sample size calculator.
Why precision gets expensive
The margin of error sits under a square in the formula, so halving it multiplies the sample by four. The table uses 95% confidence and p = 0.5.
| Margin of error | Sample size needed |
|---|---|
| ±5 points | 385 |
| ±3 points | 1,068 |
| ±2 points | 2,401 |
| ±1 point | 9,604 |
Going from ±5 to ±1 points makes the result five times more precise but needs about 25 times as many responses. This is why a sample of about a thousand, with a margin of roughly three points, is a common compromise between precision and cost.
Changing the confidence level and allowing for non-response
The formula's z-value comes from your confidence level. With p = 0.5 and a ±5 point margin, 90% confidence (z = 1.645) needs 271 responses, 95% needs 385 and 99% (z = 2.576) needs 664. Higher confidence is paid for in sample size.
The result is the number of completed responses, not the number of people to invite. If you expect only 40% of those contacted to reply, divide by the response rate: 385 ÷ 0.40 = 962.5, so invite about 963 people. A low response rate also raises the risk that those who answer differ from those who do not, which no formula can repair.
When the population is small
The formula above assumes a very large population. If you are sampling from a small, known group, such as 2,000 members of a club, you can reduce the number using a finite population correction:
adjusted n = n ÷ (1 + (n − 1) ÷ N)N is the population size; n is the figure from the basic formula.
With n = 385 and N = 2,000, the adjusted size is 385 ÷ (1 + 384 ÷ 2,000) = 385 ÷ 1.192 ≈ 323.0, so about 323 responses. The saving is modest because 385 is already a sizeable share of 2,000. For a population of millions, the correction makes no practical difference.
If you are estimating an average
When the quantity is a number rather than a yes/no, the formula uses the standard deviation (σ) instead of p:
n = (z × σ ÷ E)²
Suppose past data suggests σ = 15 and you want to estimate the mean to within ±3 at 95% confidence. Then n = (1.96 × 15 ÷ 3)² = 9.8² = 96.04, so you need 97 observations. If you do not know σ, a small pilot sample can supply a rough value.
A large sample does not fix bias. A million responses from a self-selected group can be less trustworthy than a few hundred chosen at random. Once your data is in, the confidence interval calculator shows how precise the result actually is.
- Power & Sample Size Calculator: Work out how many observations a test needs to detect an effect of a given size, or how much power a planned sample size gives you. Choose the design, enter the baseline and the minimum effect of interest, and read off the result.
- Confidence Interval Calculator: Get a confidence interval for a single average, or for the gap between two groups measured as means or proportions, in absolute or relative terms. Choose your confidence level and read both the two-sided and one-sided bounds.
This article is general information, not professional advice. See our Disclaimer and Editorial Policy.
More articles
How to Add and Subtract Fractions With Different Denominators
You cannot add 1/2 and 1/3 by adding the tops and bottoms. This guide shows the common-denominator method, with worked examples and mixed numbers.
Common Probability Mistakes and How to Avoid Them
Probability is full of results that feel wrong. Here are five classic mistakes, each with a short calculation showing the correct answer.
Converting Between Fractions, Decimals and Percentages
Fractions, decimals and percentages are three ways of writing the same quantity. Learn the six conversions, repeating decimals and the equivalents worth memorising.