Sample Size Calculator
Calculate the sample size needed for a mean or a proportion using your desired confidence level and margin of error. Includes optional finite population correction, a conservative proportion mode, quick picks, a small sample-size visual, and clear step-by-step explanations.
Background
Sample size planning helps you decide how many observations you need before collecting data. In general, a smaller margin of error or a higher confidence level requires a larger sample. For proportions, using p = 0.5 gives the most conservative (largest) sample size when no estimate is available.
How to use this calculator
- Choose whether you need a sample size for a mean or a proportion.
- Enter your target confidence level and desired margin of error.
- For mean mode, enter an estimate of σ. For proportion mode, use either p = 0.5 for the most conservative answer or enter your own estimated p.
- Optionally enter a finite population size if your population is not very large.
- Click Calculate to see the raw sample size, rounded-up required sample size, optional finite-population adjustment, and step-by-step solution.
How this calculator works
- Mean mode: starts with n = (z*σ / E)².
- Proportion mode: starts with n = z*² p(1−p) / E².
- If a finite population size is entered, the calculator applies the finite population correction: n_adj = n₀ / (1 + (n₀ − 1)/N).
- For proportions, choosing p = 0.5 gives the largest required sample size and is often used when no prior estimate exists.
- The final required sample size is always rounded up to the next whole number.
Formula & Equations Used
Sample size for a mean: n₀ = (z*σ / E)²
Sample size for a proportion: n₀ = z*² p(1−p) / E²
Finite population correction: n_adj = n₀ / (1 + (n₀ − 1)/N)
Conservative proportion choice: p = 0.5
Example Problem & Step-by-Step Solution
Example 1 — Sample size for a mean
You want a 95% confidence level, a margin of error of E = 2, and you estimate σ = 12. Find the required sample size.
- Use n = (z*σ / E)².
- For 95% confidence, z* ≈ 1.96.
- Substitute: n = (1.96 · 12 / 2)².
- Compute the raw value, then round up to the next whole number.
Example 2 — Sample size for a proportion
You want a 95% confidence level and a margin of error of E = 0.03, but you do not know p.
- Use the conservative choice p = 0.5.
- Apply n = z*² p(1−p) / E².
- For 95% confidence, use z* ≈ 1.96.
- Compute the raw value, then round up to the next whole number.
Example 3 — Finite population correction
If the raw sample-size result is based on a very large-population formula but your actual population has only N = 500 members, you can reduce the sample size using the finite population correction.
- First compute the raw sample size n₀.
- Then use n_adj = n₀ / (1 + (n₀ − 1)/N).
- Round the adjusted result up to the next whole number.
Frequently Asked Questions
Q: Why does a smaller margin of error require a larger sample?
Because tighter precision means less uncertainty is allowed, so you need more data to shrink the sampling variability.
Q: Why is p = 0.5 called conservative?
Because p(1−p) is largest when p = 0.5, which produces the largest required sample size.
Q: Should I always use the finite population correction?
Usually only when your target population is not very large and your sample would be a noticeable fraction of that population.
Q: Why does the calculator round up?
Because sample size must be a whole number, and rounding down could leave you with less precision than requested.