Math · Live
Sample Size Calculator —
confidence & margin of error.
Find the minimum number of survey respondents required to achieve a target margin of error at a chosen confidence level. Supports finite population correction, custom proportions, and a reference table across all common margins of error, updated instantly.
Inputs
Survey parameters
50% maximises sample size (most conservative).
Population size
OptionalKnown population enables finite correction. Leave 0 for infinite.
- Sample size (n)
- 385
- Z-score
- 1.96
- Eff. margin
- ±4.995%
Required sample size
95% conf. · ±5% MOE
Z = 1.96 · p = 50% · E = ±5%
Z-score
1.96
Φ⁻¹(0.975)
Sensitivity
Sample size vs. margin of error
Reference table
95% confidence: sample size by margin of error
| Margin of error | Sample size (n) |
|---|---|
| ±1% | 9,604 |
| ±2% | 2,401 |
| ±3% | 1,068 |
| ±4% | 601 |
| ±5% | 385 |
| ±7% | 196 |
| ±10% | 97 |
| ±15% | 43 |
| ±20% | 25 |
| ±25% | 16 |
| ±30% | 11 |
Field guide
What is sample size?
In statistics, the sample size (n) is the number of observations drawn from a larger population for analysis. Choosing the right sample size is one of the most critical decisions in survey design, clinical trials, A/B testing, and any inferential study: too small a sample produces imprecise estimates; too large a sample wastes resources.
The sample size formula balances three competing goals — how confident you want to be in the result (confidence level), how precise you need the estimate to be (margin of error), and how much variation you expect in the population (proportion).
The sample size formula.
For an infinite (or very large) population, the required sample size for a proportion-based survey is:
Where:
- Z: the two-tailed z-score for the chosen confidence level: Φ⁻¹(1 − α/2). For 95% confidence, Z ≈ 1.9600. For 99% confidence, Z ≈ 2.5758.
- p: the expected proportion of the population that has the characteristic you’re measuring (0 to 1). If unknown, use p = 0.5, which maximises the product p(1 − p) = 0.25 and therefore maximises (most conservatively estimates) the required sample size.
- E: the desired margin of error as a fraction (e.g. 0.05 for ±5%). This is the maximum acceptable distance between the sample estimate and the true population value at the stated confidence level.
The ceiling function (⌈ ⌉) rounds up to the nearest integer, ensuring you have at least the minimum required observations.
The classic result: 384 (or 385) for 95% / 5%
At 95% confidence, ±5% margin of error, and p = 0.5:
This is the origin of the widely cited “384 responses for a reliable survey”, the difference between 384 and 385 is whether you floor or ceiling the raw result. The correct conservative approach is to ceiling (round up), giving 385.
Understanding confidence level.
The confidence level (commonly 90%, 95%, or 99%) quantifies how certain you are that the true population parameter falls within your confidence interval. A 95% confidence level means: if you repeated the survey 100 times, approximately 95 of the resulting intervals would contain the true value.
The z-score is the critical value from the standard normal distribution corresponding to the chosen confidence level. It increases rapidly as confidence approaches 100%:
| Confidence | α | Z (two-tailed) | n at ±5%, p=50% |
|---|---|---|---|
| 80% | 0.20 | 1.282 | 165 |
| 85% | 0.15 | 1.440 | 208 |
| 90% | 0.10 | 1.645 | 271 |
| 95% | 0.05 | 1.960 | 385 |
| 99% | 0.01 | 2.576 | 665 |
| 99.9% | 0.001 | 3.291 | 1,085 |
Going from 95% to 99% confidence requires more than 1.7× as many respondents at the same margin of error — a meaningful cost for a modest gain in certainty.
Understanding margin of error.
The margin of error (E) is the maximum expected distance between your sample’s result and the true population parameter, at the stated confidence level. If a survey reports “48% of respondents agree, ±3%,” it means the true value is between 45% and 51% with the stated confidence.
Because E appears squared in the denominator, the relationship between margin of error and sample size is quadratic: halving the margin of error quadruples the required sample size. This is the most impactful lever in survey design:
| Margin of error | Sample size | vs ±5% |
|---|---|---|
| ±1% | 9,604 | 25× |
| ±2% | 2,401 | 6.2× |
| ±3% | 1,068 | 2.8× |
| ±5% | 385 | — |
| ±10% | 97 | 0.25× |
| ±15% | 43 | 0.11× |
| ±20% | 25 | 0.06× |
The dramatic increase at 1% margin of error (nearly 10,000 respondents) explains why most commercial surveys use ±3–5% rather than striving for tighter precision.
The expected proportion (p).
The proportion p represents the expected fraction of your population that has the characteristic you’re estimating (e.g., the fraction who will vote “yes,” the percentage with a medical condition, or the conversion rate in an A/B test).
The quantity p(1 − p) reaches its maximum at p = 0.5 and decreases as p approaches 0 or 1. This means:
- If you have no prior estimate of p, use p = 0.5 for the most conservative (largest) sample size.
- If you know or expect p ≈ 0.1 (a rare characteristic), the sample size can be much smaller — at 95%/±5%: n = 139 vs. 385.
Using p = 0.5 is standard practice in political polling and general surveys where the outcome is unknown. When studying rare events (disease prevalence, defect rates), a lower p saves resources without sacrificing precision.
Finite population correction.
The infinite-population formula overestimates the required sample size when the population is finite and the sample represents a significant fraction of it. Cochran’s finite population correction adjusts the estimate:
Where N is the total population size. This formula always produces n_adj ≤ n and n_adj ≤ N.
Example: n = 385 (from 95%/±5%/50%), N = 1,000:
Instead of 385, you only need 279 respondents from a 1,000-person population — a 27% reduction. The finite correction is only significant when the sampling fraction n/N exceeds ~5%; for large populations (N > 10,000), the correction has negligible effect.
Applications: surveys, A/B tests, and clinical trials.
Survey research
This formula is the foundation of political polling, market research, customer satisfaction surveys, and social science studies. A standard commercial survey targeting ±3% margin of error at 95% confidence needs roughly 1,068 respondents — the basis for most “nationally representative” polls with 1,000+ sample sizes.
A/B testing (conversion rate optimisation)
In digital experimentation, the formula applies to proportion tests (e.g., click-through rates, conversion rates). If your baseline conversion is 5% (p = 0.05) and you want to detect a ±2 percentage-point change with 95% confidence, the required sample per group is:
Note: this is a simplified single-proportion formula. Full A/B test power analysis typically uses a two-proportion z-test with separate power (1 − β) parameter. The calculator above is best suited for proportion estimation rather than hypothesis testing power.
Clinical research
Regulatory agencies require prospective sample size calculations in clinical trial protocols. These follow the same underlying mathematics but often use dedicated power analysis software (G*Power, PASS, R) that incorporates effect sizes, multiple testing corrections, and dropout rates. The formula in this calculator estimates the basic sample for a proportion survey; clinical trials require a statistician’s review.
Quality control
Manufacturing quality control uses sample size formulas to determine how many units to inspect from a production batch. ISO 2859 and ANSI/ASQ Z1.4 acceptance sampling tables implement variants of this formula.
Practical notes and caveats
- Non-response bias. The formula gives the completed sample size. If your expected response rate is 30%, you need to contact roughly 3× as many people. Adjust: contacts needed = n / response_rate.
- Simple random sampling assumed. The formula applies to simple random sampling. Cluster sampling, stratified sampling, or systematic sampling require design-effect corrections (the “DEFF”), typically 1.2–2×.
- Single proportion only. This estimates the precision of a single proportion. Comparing two proportions (e.g., treatment vs. control) or continuous outcomes requires different formulas.