Sample Size Calculator
Determine how many survey responses you need to achieve a desired margin of error at a given confidence level. Optionally apply a finite population correction.
Sample size determines how precisely a survey, study, or experiment can estimate a population parameter. Too few responses produce wide error margins and unreliable conclusions; too many waste budget and time. A sample size calculation answers the fundamental planning question: how many people do I need to survey, how many users do I need in an A/B test, or how many patients must I enroll in a trial to detect a meaningful effect?
This calculator returns the minimum sample size for estimating a proportion (e.g., percentage of voters favoring a candidate, defect rate in a process, conversion rate in a marketing test) at your chosen confidence level and margin of error. It optionally applies a finite population correction (FPC) when the population is small enough that sampling materially reduces the required n.
The math behind sample size is the inverse of the margin-of-error formula. Where margin of error tells you how precise your current sample is, sample size tells you how large a sample you need to reach a target precision. The relationship is roughly: halving the margin of error quadruples the sample size. Going from ±5% to ±2.5% precision typically means 4× the respondents.
Common applications: political polling, market research, customer satisfaction surveys, public-health studies, quality-control sampling, A/B testing planning, academic research, and any planning task where the cost of additional observations must be balanced against statistical precision.
Inputs
Use 50% if unknown
Results
Required Sample Size
385
Infinite Pop. Sample Size
385
Before finite correction
Z-Value
1.960
Effective Margin
± 4.99%
Formula
How to use this calculator
- Enter desired margin of error as a percentage (e.g., 5 for ±5%).
- Choose confidence level (95% is the standard).
- Enter expected proportion if known; use 50% for the most conservative estimate.
- Enter population size if it is small (under ~100,000); otherwise leave at 0 for infinite.
- Calculator returns minimum respondents required.
- Add 10-20% buffer to account for non-response and ineligible respondents.
Worked examples
National political poll
**Scenario:** Pollster wants to estimate presidential approval to ±3% at 95% confidence. National adult population ≈ 250 million (treat as infinite). Unknown proportion → p = 0.5. **Calculation:** n = (1.96² × 0.5 × 0.5) / 0.03² = 0.9604 / 0.0009 ≈ 1,068. **Result:** Need ~1,068 completed interviews. With a typical 30% response rate, plan to contact ~3,600 voters. This matches the n ≈ 1,000 you see reported in major national polls.
Small-town satisfaction survey
**Scenario:** Town of 4,000 residents wants ±5% precision at 95% confidence on a satisfaction question. **Calculation:** Unadjusted n = (1.96² × 0.25) / 0.05² ≈ 385. Apply FPC: n_adj = 385 / (1 + 384/4000) = 385 / 1.096 ≈ 351. **Result:** Survey 351 residents — about 9% of the town. The finite-population correction saved 34 surveys vs. the infinite-population estimate.
A/B test planning
**Scenario:** E-commerce site has 5% baseline conversion. Wants to detect a 1-percentage-point lift (5% → 6%) at 95% confidence and 80% power. **Calculation:** Using two-proportion formula: n per group ≈ 8,146. **Result:** Need ~8,150 visitors per variant — about 16,300 total. At 1,000 visitors/day, the test runs ~16 days. If only 4,000 visitors/day are available, plan for ~4 days. Stopping early on apparent winners inflates false-positive rates — wait for the planned sample.
When to use this calculator
**Use sample-size calculations to plan:**
- **Surveys and polls**: determine respondents needed for target precision. - **A/B tests**: determine traffic per variant before launching. - **Clinical trials**: determine patients per arm to detect a clinically meaningful effect. - **Quality control**: determine inspection sample size for a process. - **Customer research**: determine review counts needed to estimate satisfaction. - **Academic studies**: justify n in grant applications and IRB submissions.
**Key inputs to choose carefully:**
- **Margin of error**: how precise must the answer be? Tighter precision = larger n (quadratic relationship). - **Confidence level**: 95% is standard. 99% requires ~70% more sample; 90% needs ~30% less. - **Expected proportion**: if completely unknown, use 50% (maximum variance). If you have prior estimates, use them — extreme proportions need smaller n. - **Population size**: matters only when small (under ~10,000) relative to sample. Otherwise treat as infinite. - **Power (for tests)**: 80% is convention; clinical trials often require 90%.
**Real-world adjustments:**
- **Non-response**: typical online surveys 5-30% response, phone 10-20%, mail 20-40%. Inflate contact list accordingly. - **Ineligibility**: some respondents won't qualify. Add 10-25% buffer. - **Stratified sampling**: if subgroup analysis is needed, calculate n per stratum separately. - **Multiple comparisons**: testing 10 hypotheses at α = 0.05 inflates false-positive rate; use Bonferroni or FDR correction and recalculate n.
**Common contexts:**
- **Political polling**: ±3% at 95% → ~1,000. - **Market research**: ±5% at 95% → ~400. - **Customer satisfaction**: ±5% at 95% → ~400. - **Manufacturing QC**: lot-acceptance sampling tables (ANSI/ASQ Z1.4). - **Clinical trials**: power analysis with effect size, often hundreds to thousands per arm.
**Software:**
- **R**: pwr package (proportions, t-tests, ANOVA). - **G*Power**: free desktop tool, widely cited in clinical literature. - **Python**: statsmodels.stats.power. - **SAS/SPSS**: built-in power and sample size modules.
**Pitfalls:**
- **Underestimating drop-out**: trials lose 10-30% of enrollees; inflate n. - **Optimistic effect sizes**: small estimated effects need huge n. Be honest. - **Ignoring clustering**: classroom or clinic-level sampling needs design effect adjustment (often 1.5-3× n). - **Single estimate when comparing groups**: comparison tests need substantially more n than estimation. - **Stopping early without planned interim analysis**: inflates type-I error.
**Don't oversize either:** unnecessarily large samples waste resources, prolong studies, and may be unethical in clinical contexts (exposing more subjects than needed to risk).
Common mistakes to avoid
- Using estimation sample size for comparison tests (A/B tests need more).
- Forgetting to inflate for non-response (final n much smaller than contacted).
- Using 50% proportion when known proportion is much smaller (overestimates n).
- Ignoring population size for small populations (overestimates n).
- Failing to plan for subgroup analyses (each subgroup needs its own n).
- Treating margin of error as the same as confidence interval width (it is half-width).
- Stopping data collection early when results look favorable (inflates false positives).
- Confusing 95% confidence with 95% power (different concepts).