Sample Size Calculator
How do you calculate sample size?
Sample size tells you how many responses you need for a survey to be reliable. For a proportion, the formula is n = z² × p(1−p) ÷ E². At 95% confidence with a 5% margin of error, that works out to 385 people.
The idea is simple. You cannot survey everyone, so you survey a smaller group and use it to estimate the whole population. The sample size is the smallest number that still gives you an answer you can trust, within a margin you decide up front. Too few responses and the result is shaky. Too many and you waste time and money.
Three things drive the number: how confident you want to be, how precise you need the answer, and, for smaller groups, the total population size. The calculator above handles all three, but the sections below show exactly how each one moves the result.
Sample size formula
For estimating a proportion or percentage, the formula is:
n = z² × p(1 − p) ÷ E²
Reading each part: n is the sample size you need, z is the z-score for your confidence level, p is the expected proportion (use 0.5 if you do not know it), and E is the margin of error as a decimal.
For estimating a mean instead of a proportion, the formula changes to n = (z × σ ÷ E)², where σ is the population standard deviation. The calculator above switches between the two automatically when you pick what you are estimating.
How to calculate sample size step by step
Take the most common survey setup: 95% confidence, a 5% margin of error, and no prior estimate of the proportion.
Step 1: Find the z-score. For 95% confidence, z = 1.96. This is fixed for each confidence level.
Step 2: Set the proportion. With no prior data, use p = 0.5. This gives the largest, safest sample.
Step 3: Convert the margin. 5% becomes 0.05.
Step 4: Plug in. n = (1.96² × 0.5 × 0.5) ÷ 0.05² = (3.8416 × 0.25) ÷ 0.0025 = 0.9604 ÷ 0.0025 = 384.16.
Round up, always, because you cannot survey a fraction of a person. The answer is 385. You need 385 responses for a survey with 95% confidence and a 5% margin of error.
Why round up and not down?
Sample size is always rounded up, never down. Rounding 384.16 down to 384 would leave your survey just short of the precision you asked for. Rounding up to 385 guarantees you meet or beat the margin of error. This is one place where the usual rounding rules do not apply.
Z-scores for common confidence levels
The confidence level sets the z-score in the formula. Higher confidence means a larger z, which means a bigger sample. These are the values the calculator uses:
| Confidence level | Z-score | Sample (5% margin, p=0.5) |
|---|---|---|
| 80% | 1.2816 | 164 |
| 85% | 1.4395 | 207 |
| 90% | 1.6449 | 271 |
| 95% | 1.9600 | 385 |
| 99% | 2.5758 | 664 |
| 99.9% | 3.2905 | 1083 |
Notice the jump from 95% to 99%: going from 385 to 664 responses, a 72% increase, just for that extra bit of certainty. That is why 95% is the standard choice for most surveys. It balances confidence against cost.
How margin of error changes the sample
The margin of error has the biggest effect of all, because it sits squared in the denominator. Halving the margin roughly quadruples the sample.
| Margin of error | Sample (95% confidence, p=0.5) |
|---|---|
| ±10% | 97 |
| ±5% | 385 |
| ±3% | 1068 |
| ±2% | 2401 |
| ±1% | 9604 |
The pattern is steep. Moving from a 5% to a 1% margin takes you from 385 to 9604 responses. This is why national polls, which aim for a 3% margin, need around a thousand people, and why a 1% margin is rarely worth the cost outside of critical research.
What is the finite population correction?
The base formula assumes a huge population. When your group is small, you need fewer people, because each response covers a larger slice of the whole. The finite population correction adjusts for this. Once you have your responses, you can turn them into a range estimate with the confidence interval calculator:
n = n₀ ÷ (1 + (n₀ − 1) ÷ N)
Here n₀ is the sample from the base formula and N is your total population. For a population of 691 at 95% confidence and a 5% margin, the base sample of 385 drops to 248 after correction. The calculator applies this automatically whenever you enter a population size, so leave the field blank for large or unknown populations and fill it in for small, defined groups.
Worked example: surveying a small group
A common exam problem: someone wants to survey gym members to decide what classes to offer. There are 450 members who attend classes. What is the least number they should survey for a reliable result?
Using 95% confidence, a 5% margin, and p = 0.5, the base sample is 385. But 450 is a small population, so apply the correction: 385 ÷ (1 + (385 − 1) ÷ 450) = 385 ÷ 1.853 = 207.7, which rounds up to 208.
So they should survey at least 208 of the 450 members. Without the population correction you would have said 385, which is more than needed and, in this case, close to the entire group.
Worked example: a specified population
Another standard setup: find the sample size for a population of 691, at 95% confidence, a 5% margin of error, with p = 0.5.
Base sample: n₀ = (1.96² × 0.5 × 0.5) ÷ 0.05² = 385. Apply the correction for N = 691: 385 ÷ (1 + 384 ÷ 691) = 385 ÷ 1.556 = 247.5, rounding up to 248.
You need 248 responses out of the 691. Enter the same numbers in the calculator above and it returns 248 with the full working shown.
Estimating a mean instead of a proportion
When you are measuring something numeric, like average height, income, or test score, rather than a yes/no split, you use the mean formula: n = (z × σ ÷ E)².
This needs the population standard deviation, σ. You rarely know it exactly, so estimate it from a past study, a small pilot sample, or the rough rule of range divided by 4. If you have raw data to work from, the standard deviation calculator gives you σ directly. Say you want to estimate average income within $500 at 95% confidence, and you expect a standard deviation of $4000. Then n = (1.96 × 4000 ÷ 500)² = (15.68)² = 246. You would need 246 people.
How to choose your inputs
Confidence level: use 95% unless you have a reason not to. It is the research standard.
Margin of error: 5% is fine for general surveys. Drop to 3% for polls or serious research, but expect the sample to roughly triple.
Proportion: if you have no idea what to expect, use 50%. It produces the largest sample, so you are always covered.
Population size: leave it blank unless your group is genuinely small and defined, like the staff of one company or the members of one club.
Common sample size mistakes
Rounding down. Always round up. A fraction of a person does not exist, and rounding down misses your target precision.
Using a 1% margin without thinking. It sounds precise but demands nearly 10,000 responses. For most surveys, 5% is the practical choice.
Guessing the proportion wrong. If you are unsure, 50% is the safe default. Picking a value near 0.5 when the truth is near 0.5 is fine; picking 0.9 when it is actually 0.5 leaves you short.
Ignoring a small population. For a group of a few hundred, skipping the finite population correction inflates your sample well beyond what you need.
Frequently asked questions
What sample size do I need for 95% confidence and a 5% margin?
385 responses, assuming a large population and a proportion of 0.5. This is the most common survey setup and the number worth memorizing.
How do you calculate sample size?
Use n = z² × p(1 − p) ÷ E². Put in the z-score for your confidence level, the expected proportion (0.5 if unknown), and the margin of error as a decimal, then round up.
Why is 385 the standard sample size?
Because it is what the formula returns for the most common settings: 95% confidence, a 5% margin, a proportion of 0.5, and a large population. Change any of those and the number changes.
Does population size affect sample size?
Only when the population is small. For large or unknown populations, the base formula is enough. For a few hundred or a few thousand people, the finite population correction lowers the number you need.
What happens if my sample size is too small?
Your results become unreliable and may not represent the population. The margin of error grows, and conclusions drawn from the data carry more risk of being wrong.
What proportion should I use if I do not know it?
Use 0.5, or 50%. It maximizes p(1 − p) in the formula, which gives the largest, safest sample. If the real figure is far from 0.5, you will have collected more than strictly needed, which is the safe direction to err.
How do I find sample size for a mean?
Use n = (z × σ ÷ E)², where σ is the population standard deviation. Estimate σ from past data or a pilot study if you do not know it exactly.
Try these next
- Standard Error Calculator — measure how much a sample mean varies.
- Hypothesis Testing Calculator — test whether your survey result is significant.
- P-Value Calculator — find the significance behind a test result.
- Z-Table — look up the z-scores behind each confidence level.