How to calculate sample size
To calculate the sample size for a percentage, choose a confidence level (which sets z*), the margin of error E you can accept and a guess p of the percentage, then compute n = z*² × p(1 − p) ÷ E² and round up.[1] Rounding is always up, because 384.16 people would leave the margin slightly wider than ±5%.[1] If you have no idea what p will be, use 50%: p(1 − p) is largest there, so the sample is big enough whatever the answer turns out to be.[3]
For an average (a mean), the formula uses the standard deviation σ instead: n = (z* × σ ÷ E)².[2] With σ = 15 and a margin of ±2 at 95% confidence, n = (1.96 × 15 ÷ 2)² = 216.08, so 217 measurements. σ has to come from a pilot study or earlier data; a guess that is too small gives a sample that is too small.
Survey sample size table
The table below is the answer for most surveys and class projects: a large population, p = 50%, three confidence levels.
| Margin of error | 90% confidence | 95% confidence | 99% confidence |
|---|---|---|---|
| ±1% | 6,764 | 9,604 | 16,588 |
| ±2% | 1,691 | 2,401 | 4,147 |
| ±3% | 752 | 1,068 | 1,844 |
| ±4% | 423 | 601 | 1,037 |
| ±5% | 271 | 385 | 664 |
| ±10% | 68 | 97 | 166 |
Halving the margin of error roughly quadruples the sample, because E is squared in the denominator. Going from ±5% to ±2.5% at 95% takes you from 385 to 1537 responses.
Small populations: the finite population correction
When you survey a known, small group, such as the 2,000 students of one school, fewer responses are needed. The corrected size is n = n₀ ÷ (1 + (n₀ − 1) ÷ N), where n₀ is the size for a large population and N is the population size.[4]
Worked example: a school of 2,000 students
Large-population size at 95% and ±5%: n₀ = 384.15 (with the exact z* = 1.959964; 384.16 with z* rounded to 1.96).
Corrected: 384.15 ÷ (1 + 383.15 ÷ 2,000) = 322.39, so survey 323 students.
For a population of 100,000 the correction changes almost nothing (383), which is why national polls do not depend on the size of the country.
Responses, not invitationsThe formula counts completed, usable answers from a random sample. If you expect 1 in 4 people to reply, invite about four times as many, and remember that a large but self-selected sample is still biased.
Margin of error for a sample you already have
Switch the calculator to “margin of error for a sample size” to run the formula backwards: E = z* × √(p(1 − p) ÷ n). A poll of 1,000 people has a margin of about ±3.1% at 95% confidence, which is where the familiar “plus or minus 3 points” comes from. Once the results are in, the confidence interval calculator turns your actual answers into an interval.
Common sample size mistakes
- Typing the margin as a decimal. The box takes percent: 5 means ±5%.
- Using the planned p after the fact. The interval you report should use the observed proportion; the planning p only sets the size.
- Splitting the sample later. If you will report boys and girls separately, each group needs its own sample size.
Related tools: the normal distribution calculator for the z* values behind the formula, the probability calculator and the t-test calculator for comparing groups after you collect the data.
How we check this calculator
Tests reproduce the textbook results: 385 for ±5% at 95% (384.15 with the exact z*, 384.16 with 1.96, both rounded up), 323 for a population of 2,000, 1,068 for ±3%, and ±3.10% for n = 1,000. The calculator never returns more people than the population.
- 14 November 2026: page and calculator published.
More statistics calculators
- Statistics calculatorMean, median, mode, SD, quartiles and outliers
- Standard deviation calculatorSample and population SD, step by step
- Z-score calculatorz, percentile and area under the normal curve
- P-value calculatorFrom z, t, chi-square or F
- Confidence interval calculatorMeans and proportions, t or z
- t-test calculatorOne-sample, Welch, pooled and paired
- Binomial distribution calculatorExactly, at most, at least x successes
- Normal distribution calculatorAreas, percentiles and the 68-95-99.7 rule
- Probability calculatorAnd, or, neither, given; at least once in n tries
Frequently asked questions
What sample size do I need for a survey?
For a large population at 95% confidence and ±5%, 385 completed responses; for ±3%, 1068. Smaller populations need fewer.
What is the sample size formula?
For a percentage, n = z² × p(1 − p) ÷ E²; for a mean, n = (zσ ÷ E)². Round up to a whole number.
Why use 50% as the expected proportion?
p(1 − p) is largest at p = 0.5, so it gives the most conservative (largest) sample when you do not know the answer in advance.
Does population size matter?
Only when it is small. For 2,000 people, 323 instead of 385; for 100,000 or more the difference is a few people.