Sample Size Formula
Formula for calculating the minimum sample size needed for surveys and research studies at a given confidence level and margin of error.
Need to calculate, not just reference? Use the interactive version.
Open Sample Size Calculator →
The Formula (Infinite Population)
n = (z² × p × (1 - p)) / e²
With Finite Population Correction
n_adj = n / (1 + (n - 1) / N)
Variables
| Symbol | Meaning |
|---|---|
| n | Required sample size |
| z | Z-score for desired confidence level |
| p | Expected proportion (use 0.5 if unknown) |
| e | Margin of error (as a decimal) |
| N | Total population size |
| n_adj | Adjusted sample size for finite population |
Z-Values for Common Confidence Levels
| Confidence Level | Z-Value |
|---|---|
| 80% | 1.282 |
| 85% | 1.440 |
| 90% | 1.645 |
| 95% | 1.960 |
| 99% | 2.576 |
Quick Reference
| Margin of Error | 95% Confidence | 99% Confidence |
|---|---|---|
| ±1% | 9,604 | 16,590 |
| ±3% | 1,068 | 1,844 |
| ±5% | 385 | 664 |
| ±10% | 97 | 166 |
Example
How many people should you survey for ±5% margin at 95% confidence?
z = 1.960, e = 0.05, p = 0.5 (unknown proportion)
n = (1.96² × 0.5 × 0.5) / 0.05²
n = (3.8416 × 0.25) / 0.0025
n = 0.9604 / 0.0025 = 385 responses needed
Common Mistakes
- Using p = 0 or p = 1 when the true proportion is unknown — always default to p = 0.5, which maximizes (and thus gives the safest) required sample size
- Skipping the finite population correction for small populations — when N < 10,000, the adjusted n_adj is meaningfully smaller than the infinite-population n
- Confusing margin of error with confidence level — they are independent: you can have a ±3% margin at either 90% or 99% confidence; more confidence simply requires a larger sample
Key Notes
- Formula for means: n = (z × σ / E)²: z is the z-score for the desired confidence level (1.96 for 95%), σ is the population standard deviation, and E is the maximum acceptable margin of error. If σ is unknown, use a pilot study or a conservative estimate.
- Formula for proportions: n = z²p(1−p)/E²: When the population proportion p is unknown, use p = 0.5 — it maximizes n and gives the most conservative (largest) sample size requirement. Any other p value gives a smaller required n.
- Quadrupling for precision: Sample size scales as 1/E² — to halve the margin of error, you need four times the sample size. Cutting E from 5% to 2.5% requires 4× more respondents. This is why polling precision is expensive.
- Finite population correction: n_adj = n / (1 + n/N): When the sample is more than 5% of the population N, the standard formula overcounts — the correction factor reduces the required sample size. For very small populations, even a small sample covers a large fraction.
- Applications: Sample size formulas are used to design clinical trials (ensuring statistical power), opinion polls, quality control sampling plans, A/B tests, and any study where the cost of data collection must be balanced against the precision needed.