Sample Size Calculator
This sample size calculator tells you how many completed responses you need to estimate a proportion or a mean within a chosen margin of error, at confidence levels from 80% to 99.9%. Add the population size if it is small, and the result shrinks accordingly. You can also run it in reverse to find the margin of error a sample you already have gives you.
Updated
Results
- Unrounded n₀, unlimited populationBefore population correction and rounding
- Critical value (z)
- Finite population correctionMargin mode with a population size
| Margin of error | Your confidence level | 90% | 95% | 99% |
|---|
Results are estimates. See the methodology below.
How to use the sample size calculator
- Choose a mode: proportion (survey questions with a percentage answer), mean (a measurement), or margin of error (reverse: you know n).
- Pick the confidence level. 95% is the usual choice.
- Proportion mode: enter the margin of error and the expected proportion. If you have no idea, leave it at 50%, the most conservative value.
- Mean mode: enter a prior estimate of the standard deviation, from a pilot or earlier study, and the margin you can accept, both in the data's units.
- Population size is optional. Fill it in when the population is small, such as the employees of one company. The finite population correction factor appears in margin mode when you enter it.
Formulas used
- Proportion (Cochran): n₀ = z² × p(1 − p) / e², where z is the two-sided normal critical value, p the expected proportion and e the margin. p = 50% maximizes p(1 − p), so it gives the largest, safest n.
- Finite population: n = n₀ / (1 + (n₀ − 1) / N), the correction in the cochranSize package documentation. Results are always rounded up.
- Mean: n₀ = (z × σ / E)², the formula in the NIST/SEMATECH e-Handbook. When σ is unknown, NIST replaces z with t and iterates; this calculator does not, so for small samples a t-based answer is slightly larger.
- Margin of error: e = z × √(p(1 − p) / n), multiplied by √((N − n) / (N − 1)) when N is given.
Sample size examples
1. Survey, ±5% at 95%, p = 50%
n₀ = 384.15, rounded up to 385 responses. If the population is 10,000 people you need 370; with 1,000 people, 278; with 100, 80. Expecting 20% instead of 50% lowers the requirement to 246.
| Margin | 90% | 95% | 99% |
|---|---|---|---|
| ±1% | 6,764 | 9,604 | 16,588 |
| ±2% | 1,691 | 2,401 | 4,147 |
| ±3% | 752 | 1,068 | 1,844 |
| ±5% | 271 | 385 | 664 |
| ±10% | 68 | 97 | 166 |
Halving the margin roughly quadruples the sample.
2. Mean, σ ≈ 15, margin ±2, 95%
n₀ = 216.08, so 217 observations. Accepting ±3 cuts it to 97; tightening to ±1 needs 865.
3. Reverse: what margin does my sample give?
400 responses at 95% and p = 50% give ±4.90%; 1,000 give ±3.10%. With 278 responses from a population of 1,000, the correction factor is 0.8501 and the margin comes out just under ±5%, matching example 1.
Before you send the survey
- Plan for non-response. The result is completed responses. Divide by the response rate you expect: at 25%, 385 ÷ 0.25 = 1,540 invitations.
- Subgroups need their own n. If you will report results for each region or age group, each one needs enough responses for the margin you want.
- Random samples only. The margin of error assumes a simple random sample. Convenience samples, opt-in online panels and cluster or stratified designs, which have a design effect, are not covered.
- Not a power analysis. Detecting a difference between groups with a hypothesis test is a different question, with different formulas.
Frequently asked questions
Why is 385 the answer so often?
It is the result for ±5% at 95% confidence with p = 50% and a large population: z² × 0.25 / 0.05², with z = 1.959964, is 384.15, rounded up to 385.
Does population size matter?
Only when the sample is a sizeable share of the population. For 10,000 people the requirement drops from 385 to 370; for 1,000 it drops to 278.
What proportion should I enter if I don't know it?
50%. It produces the largest sample, so the margin holds whatever the true answer turns out to be.
What is a good sample size for a survey?
It depends on the margin you need. The table shows the trade-off: ±10% needs 97 responses at 95%, ±3% needs 1,068.
How do I find the margin of error for my sample?
Use the margin of error mode and enter your n. For confidence intervals from actual results, use the confidence interval calculator.
Sources
Results assume a simple random sample and cover sampling error only. For a study with a complex design or a hypothesis test, have the sample size checked by a statistician.