Calculators
Sample Size Calculator
Calculate the required sample size for a survey or experiment from confidence level, margin of error, and expected proportion locally in your browser.
Enter your desired confidence level, margin of error, and expected proportion. Optionally add a finite population size to apply the finite population correction. Calculations run locally in your browser; your values are not uploaded or stored.
Find the sample size you need for reliable results.
Enter your desired confidence level (90%, 95%, or 99%), margin of error, and expected proportion. Optionally add a finite population size to apply the finite population correction. The calculator uses the standard formula: n = (z² × p × (1 − p)) ÷ e² for infinite populations, with the correction n / (1 + (n − 1) ÷ N) for finite populations. Everything runs locally in your browser, so your values are not uploaded or stored.
Frequently Asked Questions
Everything you need to know about this tool, how it works, and privacy.
What formula does the sample size calculator use?
For an infinite population, it uses n = (z² × p × (1 − p)) ÷ e², where z is the z-score for the confidence level, p is the expected proportion, and e is the margin of error. For a finite population of size N, it applies the finite population correction: n / (1 + (n − 1) ÷ N). The calculator uses z = 1.645 for 90%, 1.96 for 95%, and 2.576 for 99% confidence.
When should I use the finite population correction?
Use the finite population correction when your target population is small enough that sampling a large fraction of it would be possible. The correction reduces the required sample size because each person sampled provides more information about the remaining population.
What expected proportion should I use?
Use 50% when you have no prior estimate, as this maximizes the required sample size and gives a conservative result. If you have a prior estimate from a pilot study or similar research, use that value instead.
How do confidence level and margin of error affect the sample size?
A higher confidence level (e.g., 99% vs 95%) increases the required sample size because the z-score is larger. A smaller margin of error (e.g., 3% vs 5%) increases the required sample size quadratically. These trade-offs are fundamental to study design.
Do my inputs stay private?
Yes. The calculation and copy action run locally in your browser. CodeASystem does not upload or store the values you enter.