Sample Size Calculator: Surveys, Means & Margin of Error
It seems natural that a survey of a whole country needs far more people than a survey of one town. For a ±5% margin of error at 95% confidence, it doesn’t. A town of 10,000 needs 370 completed responses. A country of 100 million needs 385. Beyond a few thousand people, the size of the population hardly moves the answer; the precision you want does.
This calculator finds the sample size for a survey percentage or for an average, and it works the other way too: give it the number of responses you have and it tells you the margin of error. It takes an optional population size, response rate and design effect, rounds up as it should, and draws how the margin shrinks as the sample grows. It is set to the worked example below.
For a yes/no or multiple-choice question. Type 5 for ±5%. 50% gives the largest, safest sample when you don't know the answer in advance.
To estimate an average, such as a mean weight or score, within ± E. Use the standard deviation from a pilot or an earlier study.
Already have the responses? See how precise a percentage from them is.
Four Choices That Set the Number
Before any formula, a sample size needs four decisions. Each one moves the answer in a predictable direction:
| Choice | What it means | Common setting | Effect on the sample |
|---|---|---|---|
| Margin of error | How far the survey percentage may be from the true one | ±5% (±3% for polls) | Halving it needs about 4× the people |
| Confidence level | How often the method’s range would catch the true value | 95% | 99% needs about 1.73× the people of 95% |
| Expected percentage | Your guess at the answer, such as 30% saying yes | 50% if unsure | Further from 50% needs fewer people |
| Population size | How many people you could survey in total | Leave empty if large | Matters only when the sample is a big share of it |
The margin of error is the “±” part of a result. If 62% of your sample says yes and the margin is ±5%, the population figure is likely between 57% and 67%. It is the half-width of that range, not the whole range.
The confidence level describes the method, not one survey. At 95%, if you repeated the survey many times, about 95 in 100 of the ranges you’d get would contain the true value. It doesn’t mean your result is 95% accurate.
Working It Out: 2,500 Employees, ±5% at 95%
A company with 2,500 employees wants to know what share of them would use a new benefit, to within ±5% at 95% confidence. Nobody knows the answer yet, so the expected percentage is 50%. From earlier staff surveys, about 30% of employees reply.
- The z-value. 95% confidence leaves 2.5% in each tail, so z = 1.96 (1.959964 to more decimals).
- The basic sample size. n₀ = z² × p(1 − p) ÷ E² = 1.96² × 0.5 × 0.5 ÷ 0.05² = 384.15.
- Adjust for the population. n = n₀ ÷ (1 + (n₀ − 1) ÷ N) = 384.15 ÷ (1 + 383.15 ÷ 2,500) = 333.10.
- Round up. You can’t survey part of a person, and rounding down would leave the margin a little wider than ±5%. The answer is 334 completed responses.
- Allow for non-response. At a 30% response rate, invite 334 ÷ 0.3 = 1,114 employees.
Rounding always goes up, even from 333.10. With 334 responses the margin is ±4.99%; with 333 it would creep just past ±5%.
Why the Population Size Barely Matters
Here is the sample needed for ±5% at 95% confidence, with an expected 50%, for populations of different sizes:
| Population | Sample needed |
|---|---|
| 100 | 80 |
| 500 | 218 |
| 1,000 | 278 |
| 2,500 | 334 |
| 10,000 | 370 |
| 100,000 | 383 |
| 1,000,000 | 384 |
| Very large | 385 |
What sets the precision is how many people answered, not what fraction of the population they are. A spoonful of soup tells you how salty the pot is whether the pot holds a quart or a barrel, as long as it is stirred. The population size only matters when the sample is a large share of it. Then each response removes a noticeable part of the remaining uncertainty, and the finite population correction in step 3 above lowers the number.
For small groups, the numbers get close to “ask everyone”. A team of 100 needs 80 responses for ±5%. If you need most of the group anyway, surveying all of them is simpler, and the calculator says so when the sample passes half the population.
Halving the Margin Means Four Times the People
The margin of error shrinks with the square root of the sample size. To cut it in half, you need four times the responses:
| Margin of error | Sample needed (95%, very large population) |
|---|---|
| ±10% | 97 |
| ±5% | 385 |
| ±4% | 601 |
| ±3% | 1,068 |
| ±2% | 2,401 |
| ±1% | 9,604 |
Going from ±5% to ±3% nearly triples the sample. Going from ±2% to ±1% takes another 7,203 responses. A poll of 1,000 people gives a margin close to ±3%, which is why that size turns up in many published polls: it balances precision against cost. The calculator’s curve shows the same thing: steep at first, then flat, so each extra response buys less precision than the one before.
Why 50% Is the Safe Guess
The formula uses p(1 − p), which is largest when p = 50%. That makes 50% the cautious choice when you don’t know the answer in advance:
| Expected percentage | p(1 − p) | Sample needed (±5%, 95%) |
|---|---|---|
| 50% | 0.25 | 385 |
| 40% or 60% | 0.24 | 369 |
| 30% or 70% | 0.21 | 323 |
| 20% or 80% | 0.16 | 246 |
| 10% or 90% | 0.09 | 139 |
| 5% or 95% | 0.0475 | 73 |
A lower expected percentage saves responses only if the guess holds. Plan for 30% and collect 323 responses, and if the true figure turns out to be 50%, the margin will be ±5.45%, not ±5%. Use a figure below 50% only when an earlier survey or pilot backs it up.
90%, 95% or 99% Confidence
A higher confidence level means a larger z-value, and the sample grows with z²:
| Confidence | z | Sample needed (±5%) |
|---|---|---|
| 80% | 1.2816 | 165 |
| 90% | 1.6449 | 271 |
| 95% | 1.9600 | 385 |
| 98% | 2.3263 | 542 |
| 99% | 2.5758 | 664 |
| 99.9% | 3.2905 | 1,083 |
95% is the conventional default in surveys and research. 90% can be enough for a quick internal check where a wrong call is cheap. 99% suits decisions where being wrong is costly, but it nearly doubles the sample. The z-values here are the same ones that sit in the ∞ row of a t table.
Responses Are Not Invitations
Every formula above gives the number of completed responses. If only some of the people you contact reply, divide by the response rate to find how many to invite. For 385 responses at a 20% response rate, invite 385 ÷ 0.2 = 1,925 people.
Low response brings a bigger problem than cost. If the people who reply differ from those who don’t, for example because only those with strong opinions bother, the results can be off no matter how many responses arrive. Sending more invitations raises the count but does nothing about that bias. Reminders, short questionnaires and following up with non-responders help more.
Subgroups Need Their Own Sample
A margin of ±5% applies to the whole sample. If you plan to report results for parts of it, such as each of four regions, each part has its own, wider margin. A subgroup of 100 people within a sample of 385 has a margin of about ±9.8%.
To get ±5% for every one of four regions, each region needs about 385 responses on its own, so plan for around 1,540 in total. Decide which breakdowns you’ll report before choosing the sample size, not after.
Small groups are the hard case. If one region holds only 10% of the population, a random sample of 385 contains about 39 people from it, and their margin is about ±15.7%. Surveys handle this by sampling that region more heavily than its share, then weighting the results back to its true share when reporting totals. The weighting itself adds a design effect, covered next.
Comparing two groups, such as whether more women than men agree, is a different question again. That needs a power calculation based on the size of difference you want to detect, and the p-value calculator page explains how power and sample size relate.
Design Effect: When the Sample Isn’t Simple Random
The formulas assume a simple random sample, where every person has the same chance of being chosen, independently of everyone else. Many real surveys pick groups first, such as whole classrooms, branches or streets, and then people within them. People in the same group tend to answer alike, so each response adds less new information.
The design effect measures that loss. A design effect of 1.5 means the survey needs 1.5 times the simple-random sample: 384.15 × 1.5 = 576.2, so 577 responses for ±5%. There is no universal value: it depends on how alike people in the same group are and how many you take from each group. An earlier survey with the same design gives the best figure. Leave the box empty for a simple random sample.
Estimating an Average Instead of a Percentage
To estimate a mean, such as the average weight of a product or an average test score, the formula uses the standard deviation σ instead of p(1 − p):
n = (z × σ ÷ E)²
Say past batches show a standard deviation of 12 g and you want the mean to within ±2 g at 95% confidence: (1.96 × 12 ÷ 2)² = 138.29, so 139 items. Use the Average (mean) tab for this.
The standard deviation has to come from somewhere: a pilot study, earlier data, or a published figure. Without any, a rough guess is the range of likely values divided by 4. Since the sample grows with σ², a guess that is 20% too low leaves the sample about 36% smaller than it should be, so round the guess up rather than down. The standard deviation calculator works it out from pilot data.
Two Rules of Thumb That Mislead
“Survey 10% of the population.” A fixed percentage gives very different precision depending on the population. For 100,000 people, 10% is 10,000 responses and a margin of about ±0.93%, roughly 26 times the 383 responses that a ±5% margin requires. For a group of 500, 10% is 50 responses, and the margin is about ±13.2%, too wide to say much. The number of responses sets the precision, not the percentage.
“30 responses is enough.” The number 30 comes from a rule about when averages start to behave like a normal curve. It says nothing about precision. A percentage from 30 responses has a margin of about ±17.9% at 95% confidence: a result of 50% could mean anything from about 32% to 68%.
The Margin of Error of a Survey You Already Ran
The Margin from sample size tab runs the formula backwards. For 1,000 responses and a result near 50%, the margin at 95% confidence is ±3.1%. A poll reporting 52% against 48% with that margin can’t separate the two sides, because both ranges overlap.
The margin is widest at 50% and narrower for results near 0% or 100%. With the same 1,000 responses, a result of 20% has a margin of ±2.48%, and a result of 5% has ±1.35%. So a headline margin worked out at 50% overstates the uncertainty for small shares. The calculator also shows the margin at 99% confidence and how many responses it would take to halve it.
Doing the Same Calculation in a Spreadsheet
The formulas work in Excel or Google Sheets, with NORM.S.INV giving the z-value:
| What you want | Formula | Result |
|---|---|---|
| Sample for ±5% at 95% | =ROUNDUP(NORM.S.INV(0.975)^2*0.5*0.5/0.05^2, 0) | 385 |
| Same, for a population of 2,500 in A1 | =ROUNDUP((NORM.S.INV(0.975)^2*0.25/0.05^2)/(1+(NORM.S.INV(0.975)^2*0.25/0.05^2-1)/A1), 0) | 334 |
| Margin of error for 1,000 responses | =NORM.S.INV(0.975)*SQRT(0.25/1000) | 0.031 (±3.1%) |
Use 0.975 for 95% confidence, 0.95 for 90% and 0.995 for 99%: the argument is the confidence level plus half of what is left over. Use ROUNDUP, not ROUND, so the sample never falls short.
What No Sample Size Can Fix
A margin of error covers one thing: the random chance of who happened to be picked. It doesn’t cover:
- Who could be reached. An online survey can’t reach people who aren’t online. A larger sample from the same list repeats the same gap.
- Who chose to answer. Non-response bias, described above.
- How the question was asked. Leading wording, an unclear scale or a question that depends on the one before it can shift answers by more than the margin.
- Whether people answer honestly. Questions about income, health or habits can draw answers people think they should give.
A smaller, well-drawn random sample beats a huge self-selected one. Get the sampling right first, then use the calculator to decide how many responses that sample needs.
