Sample Size Calculator
Power analysis · margin of error · proportion & mean
Result
Enter parameters and click Calculate
Compute required sample size for surveys, A/B tests, and research studies.
Sample Size Visualization
Python Compiler
What Is Sample Size?
Sample size is the number of observations or respondents needed in a study to draw reliable conclusions about a population. Choosing the right sample size balances statistical rigor with practical constraints like cost and time.
Precision
Larger samples yield narrower confidence intervals and smaller margins of error, giving more precise estimates.
Power
Adequate sample size ensures enough statistical power to detect real effects and avoid false negatives.
Efficiency
Too large wastes resources; too small produces unreliable results. Proper calculation finds the optimum.
Sample Size Formulas
Key Factors Affecting Sample Size
| Factor | Effect on Sample Size | Explanation |
|---|---|---|
| Confidence Level | Higher → larger n | 99% confidence requires more data than 90% for the same precision |
| Margin of Error | Smaller → larger n | Halving the margin of error quadruples the required sample size |
| Variability | Higher → larger n | More variable populations need larger samples to estimate accurately |
| Power | Higher → larger n | 90% power needs about 30% more samples than 80% power |
| Effect Size | Smaller → larger n | Detecting small differences requires substantially more observations |
Statistical Power
Statistical power (1 − β) is the probability that a study will detect a true effect when one exists. Under-powered studies waste resources because they are unlikely to produce significant results even when the effect is real.
80% power: zβ = 0.842 → n ≈ 3,623 per group
90% power: zβ = 1.282 → n ≈ 4,862 per group
Going from 80% to 90% power increases sample size by ~34%.
Rule of thumb: Use 80% power as a minimum for most studies. Use 90% for confirmatory trials or when the cost of a false negative is high.
Practical Tips
📋 Surveys
Use p=0.5 when unsure of the true proportion. Apply finite population correction when sampling >5% of the population. Account for expected non-response by inflating the sample size (e.g. divide by expected response rate).
🔍 A/B Tests
Define the minimum detectable effect before starting. Smaller effects need much larger samples. Consider using sequential testing to stop early if the effect is large. Always run the test for the full planned duration.
🏥 Clinical Research
Regulatory agencies typically require 80–90% power. Account for dropout rates by over-enrolling. Pre-register your sample size calculation. Use interim analyses with appropriate alpha-spending functions.