Sample Size Calculator
Calculate the required sample size for your survey or study to achieve a desired level of precision. Determine how many observations you need based on your confidence level, margin of error, and expected variability. See also our Margin of Error Calculator, Confidence Interval Calculator, and Standard Error Calculator.
How to Use the Sample Size Calculator
Determining the right sample size is one of the most important steps in planning a research study or survey. Too small a sample may fail to detect meaningful effects (low statistical power), while too large a sample wastes resources. This calculator helps you find the minimum sample size needed to achieve your desired precision, measured by the margin of error at a given confidence level.
For proportion-based studies (surveys, polls, A/B tests), enter the desired confidence level, target margin of error as a percentage, and your best estimate of the population proportion. If you have no prior estimate, use p = 0.5 for the most conservative (largest) sample size. For studies measuring continuous variables (means), enter the confidence level, desired margin of error in the same units as your measurement, and an estimate of the population standard deviation from pilot studies or previous research.
If your population is finite and relatively small, enter the population size to apply the finite population correction (FPC). This reduces the required sample size because sampling a larger fraction of the population provides more information. The FPC is most impactful when the sample would be more than 5% of the population. For very large populations (over 100,000), the correction is negligible and can be ignored.
Sample Size Formulas
For Proportion:
n = z² × p(1-p) / E²
where E is the margin of error as a decimal
For Mean:
n = (z × σ / E)²
where E is the margin of error in measurement units
Finite Population Correction:
n_adj = n / (1 + (n-1)/N)
where N is the population size
Maximum Sample Size (p=0.5):
n_max = z² / (4E²)
This gives the largest possible n for any proportion
Example Calculation
A market researcher wants to estimate the proportion of customers who prefer a new product design with a margin of error of ±3% at 95% confidence. No prior estimate of the proportion is available.
Given: confidence = 95%, E = 3% = 0.03, p = 0.5 (conservative)
z* for 95% confidence = 1.960
n = z² × p(1-p) / E²
n = 1.960² × 0.5 × 0.5 / 0.03²
n = 3.8416 × 0.25 / 0.0009
n = 0.9604 / 0.0009
n = 1067.11 → round up to 1068
Required sample size: 1,068 respondents
If population = 10,000:
n_adj = 1068 / (1 + 1067/10000) = 1068/1.1067 = 965
Required Sample Sizes Reference Table (p=0.5)
| Margin of Error | n (95% CI) | n (99% CI) |
|---|---|---|
| ±1% | 9604 | 16587 |
| ±2% | 2401 | 4147 |
| ±3% | 1068 | 1844 |
| ±4% | 601 | 1037 |
| ±5% | 385 | 664 |
| ±7% | 196 | 339 |
| ±10% | 97 | 166 |
Frequently Asked Questions
How do I estimate the standard deviation for sample size calculation?
You can estimate the standard deviation from: (1) Pilot studies or preliminary data, (2) Previous research on similar populations, (3) The range rule: σ ≈ range/4 for roughly normal data, (4) Expert judgment. If unsure, it's better to overestimate σ (which gives a larger, more conservative sample size) than to underestimate it and end up with insufficient precision.
Should I account for non-response in my sample size?
Yes. The calculated sample size assumes all selected participants respond. In practice, response rates are often 20-60% for surveys. Divide the required sample size by the expected response rate to determine how many people to contact. For example, if you need n=400 and expect a 50% response rate, you should contact 800 people. Also consider whether non-respondents differ systematically from respondents.
What if I need to compare two groups?
For comparing two proportions or means, you need the sample size per group, not total. The formula for comparing two proportions is: n = (z_α/2 + z_β)² × [p₁(1-p₁) + p₂(1-p₂)] / (p₁-p₂)². For comparing two means: n = 2(z_α/2 + z_β)² × σ² / δ², where δ is the minimum detectable difference. These formulas incorporate statistical power (typically 80%).
What is statistical power and how does it relate to sample size?
Statistical power is the probability of detecting a true effect (rejecting H₀ when it's false). Power = 1 - β, where β is the Type II error rate. Standard practice is to aim for 80% power. Larger sample sizes increase power. The relationship between sample size and power depends on the effect size — smaller effects require larger samples to detect. Power analysis should be conducted before data collection to ensure adequate sample size.
Why does halving the margin of error quadruple the sample size?
Because sample size is inversely proportional to the square of the margin of error: n ∝ 1/E². If you want half the MOE (E/2), you need n ∝ 1/(E/2)² = 4/E², which is 4 times the original sample size. This quadratic relationship means that achieving very high precision becomes increasingly expensive. Going from ±5% to ±2.5% MOE requires 4× the sample, and from ±5% to ±1% requires 25× the sample.
Is there a minimum sample size I should always use?
While there is no universal minimum, practical guidelines suggest: (1) At least 30 observations for the Central Limit Theorem to apply, (2) At least 10 successes and 10 failures for proportion estimates (np ≥ 10 and n(1-p) ≥ 10), (3) At least 15-20 per group for t-tests, (4) At least 5 expected observations per cell for chi-square tests. These are minimums — larger samples are always better for precision and power.