What This Calculator Handles
The calculator determines required sample size for two broad categories of study:
- Estimation — survey, prevalence, and mean estimation from confidence level and margin of error, with optional finite population correction and reverse directions (margin of error from n, implied population from n).
- Experiment / study — power-based sample size for single-sample, two-group, and paired designs with continuous or binary outcomes, under superiority, non-inferiority, or equivalence hypotheses.
It also keeps the statistical sample separate from the recruitment target when nonresponse, attrition, or complex sampling designs are expected.
How to Calculate Sample Size
- Decide whether you are estimating a quantity (survey, prevalence, mean) or testing a hypothesis (experiment, trial, A/B test).
- For estimation, choose confidence level and margin of error. For experiments, choose significance level α and target power.
- Specify the expected proportion, mean, or effect size, and variability where required.
- Enter the population size if it is finite and known.
- Calculate the statistical sample size.
- Apply finite-population correction or design-effect adjustments when appropriate.
- Account separately for nonresponse, attrition, and oversampling to get the recruitment target.
- Round up to the next whole participant.
Sample Size Formula
Two standard formulas cover the estimation cases.
Proportion: n₀ = Z² × p × (1 − p) / e²
Mean: n₀ = (Z × σ / e)²
Z is the critical value for the chosen confidence level, p is the expected proportion, σ is the population standard deviation, and e is the margin of error. For a finite population N, apply the finite-population correction: n = n₀ / (1 + (n₀ − 1) / N).
For a two-group experiment with continuous outcome, per-group sample is approximately n₁ = (zα + zβ)² σ² (1 + 1/r) / δ², where δ is the expected mean difference, σ is the SD, and r = n₂/n₁ is the allocation ratio.
Sample Size for a Proportion
The proportion formula uses the expected percentage of the population that has the characteristic. The product p × (1 − p) is largest at p = 0.50 and smaller near the extremes — so the required sample is largest when p is around 0.50.
Example: 95% confidence, 5% margin of error, p = 0.50 gives n₀ ≈ 384.16 → 385 responses. Change the margin to 3% and the requirement jumps to ≈ 1,067. This inverse-square sensitivity is why small margins of error demand large samples.
Sample Size for a Mean
Mean sample size needs a different input: the standard deviation σ of the measurement. Unlike proportions, the formula uses only variability, not an expected value.
Example: for 95% confidence, margin of error 2 units, and σ = 15, n₀ = (1.96 × 15 / 2)² ≈ 216. Halving the margin to 1 unit quadruples the requirement to ≈ 865. Mean sample size is very sensitive to σ — if your estimate of σ is wrong, the sample size will be wrong in proportion.
Sample Size for a Finite Population
When the population is finite and known, the required sample can be smaller than the infinite-population figure. The finite population correction (FPC) adjusts n₀ downward: n = n₀ / (1 + (n₀ − 1) / N).
For N = 1,000 with 95% confidence, 5% margin of error and p = 0.50, the FPC reduces n from ≈ 385 to ≈ 278. For N = 10,000 the reduction is smaller (≈ 370). As N becomes large relative to n₀, the FPC has almost no effect. Do not apply FPC when population size is unknown.
The sampling fraction is n / N. A sample of 385 from a population of 1,000 has a sampling fraction of 38.5%.
How Confidence Level Affects Sample Size
Higher confidence uses a larger Z, which increases n. Moving from 90% to 95% adds about 21% to the required sample for the same margin of error and proportion. Moving from 95% to 99% adds about 73% more. Common choices are 90%, 95%, and 99%, with 95% as the standard default.
A 95% confidence level means that, if you repeated the study many times and built a confidence interval from each sample, about 95% of those intervals would contain the true population parameter. It is not the probability that a specific calculated interval contains the fixed parameter.
How Margin of Error Affects Sample Size
Sample size is inversely proportional to the square of the margin of error: n ∝ 1 / e². Halving the margin of error quadruples the required sample. For large populations at 95% confidence with p = 0.50: 10% margin → ≈ 96; 5% → ≈ 385; 3% → ≈ 1,067; 2% → ≈ 2,401; 1% → ≈ 9,604. This is the single most important trade-off in survey design.
Why Is 50% Used for Sample Size?
The product p × (1 − p) is maximized at p = 0.50, where it equals 0.25. Using 50% produces the largest required sample for a given confidence level and margin of error, so the result is conservative — it will not understate the requirement.
This is a safe default when no prior proportion estimate is available. If you have a reliable prior estimate from a pilot, a previous survey, or published data, use it. A p of 0.30 requires a smaller sample than p = 0.50.
How Many Survey Responses Do I Need?
Survey sample size depends on population size, confidence level, margin of error, expected proportion, sampling design, and expected response rate. The statistical calculation gives the number of completed responses required. The number of people you must invite is larger.
Recruitment target = required completed responses ÷ expected response rate. For 385 completed responses at an 80% response rate: 385 / 0.80 = 481.25 → 482 invitations. For a 30% response rate: 385 / 0.30 = 1,283 invitations.
Sample Size Based on Statistical Power
For hypothesis-testing studies, sample size is driven by statistical power rather than estimation precision. Four inputs determine the required n:
- Significance level α — the tolerated Type I error rate (typically 0.05).
- Desired power (1 − β) — the probability of detecting the effect if it exists (typically 80% or 90%).
- Expected effect size — the difference between groups, in the units of the outcome or standardized.
- Variability — standard deviation for continuous outcomes, baseline rate for binary outcomes.
Anything that makes the effect harder to detect increases the required sample:
- Higher desired power → larger sample.
- Smaller expected effect → larger sample.
- Higher variability → larger sample.
- Lower α → larger sample.
- Unequal allocation → slightly larger total sample than 1:1 for the same power.
The two-group continuous formula shown in the Sample Size Formula section above produces the per-group n directly; multiply by (1 + r) to get the total.
Sample Size Based on Effect Size
For continuous outcomes, the effect is specified as a mean difference with a standard deviation, or as a standardized effect (Cohen's d = mean difference ÷ SD). For binary outcomes, the effect is a proportion difference — for example, 40% conversion in the control group and 55% in the treatment group, giving an absolute difference of 15 percentage points.
Smaller effects always require larger samples. Detecting a standardized effect of 0.2 typically requires about 16 times the sample of detecting 0.8 — because sample size scales roughly with 1/d².
Sample Size for Two Groups
Two-group studies have a control or reference group and a treatment or experimental group. Standard calculation assumes 1:1 allocation because it produces the smallest total sample for a given power. Unequal allocation (1:2, 1:3) reduces the effective information per participant and increases the total sample required — but it may be justified when one group is more expensive or risky to recruit.
When the two groups have very different standard deviations, the calculation should use a Welch-style adjustment rather than assuming a common SD. The calculator supports both.
Sample Size for Means vs Proportions
| Situation | Main inputs |
|---|---|
| Population proportion | Confidence, margin of error, expected proportion |
| Population mean | Confidence, margin of error, standard deviation |
| Experimental mean | Alpha, power, expected mean difference, SD |
| Experimental proportion | Alpha, power, baseline and comparison rates |
Sample Size vs Power Analysis
The Sample Size Calculator answers "how many observations or participants do I need?" for estimation and common experiments. The dedicated Power Analysis Calculator answers broader questions: what power does this n give, what is the minimum detectable effect, and what does the power curve look like across a range of n? Use the Power Analysis Calculator when the primary question is about power or MDE rather than sample size.
Sample Size vs Slovin's Formula
Slovin's formula (n = N / (1 + N × e²)) is a simplified approach that assumes p = 0.5 and confidence implicitly at 95%, and does not take confidence level as an input. This calculator supports the standard confidence-level / margin-of-error methods plus finite population correction and power-based calculations. Slovin's is fine for quick planning when a single formula is required. Use the Slovin's Formula Calculator when that specific method is intended.
Response Rate, Attrition, and Design Effect
Three practical adjustments sit on top of the statistical sample size.
Response rate and attrition. If only a fraction of invited participants provide usable data, you must invite more than the statistical n. Recruitment target = statistical n ÷ (1 − attrition rate), or statistical n ÷ (response rate × completion rate), depending on which path applies. Do not stack response rate and attrition — the calculator uses one or the other.
Design effect. Clustered or complex sampling designs inflate variance relative to simple random sampling. Adjusted sample = base sample × design effect. For simple random sampling, design effect is 1.0 and no adjustment is needed — do not enter arbitrary values.
Oversampling. Sometimes you oversample to ensure a minimum number in small subgroups. The oversampling percentage multiplies the base sample before the response-rate adjustment.
How Should Sample Size Be Rounded?
Always round up to the next whole participant. A calculated sample of 384.16 means 385 participants. Ordinary mathematical rounding could give 384, which is smaller than the calculation requires and would not meet the specified precision or power.
Worked Examples
Survey, finite population. N = 10,000, 95% confidence, 5% margin of error, p = 0.50. Infinite-population n₀ ≈ 384.16. FPC: n = 384.16 / (1 + 383.16 / 10,000) ≈ 370. Required: 370 completed responses.
Survey, large population. 95% confidence, 5% margin of error, p = 0.50. n₀ ≈ 384.16 → 385 responses. At an expected 80% response rate, invite 385 / 0.80 = 481.25 → 482 people.
Mean estimation. σ = 15, 95% confidence, margin of error = 2. n₀ = (1.96 × 15 / 2)² ≈ 216. Required: 216 observations.
Two-group experiment, continuous outcome. Expected mean difference δ = 5, common SD σ = 10, α = 0.05 two-sided, power = 80%, 1:1 allocation. Standardized effect d = 0.5. n per group ≈ 64, total ≈ 128.
Two-group experiment, binary outcome. Control rate 40%, treatment rate 55%, α = 0.05, power = 80%, 1:1 allocation. Absolute difference 15 percentage points. n per group ≈ 148, total ≈ 296.
Limitations
Sample size calculation addresses the precision or power of a statistical estimate or test. It does not eliminate selection bias from recruitment, nonresponse bias (the possibility that responders differ from nonresponders), measurement error, poor study design unrelated to size, dependence between observations, incorrect effect or variability assumptions, or nonrepresentative samples. Statistical sample size is only one input to a research design.
What This Calculator Is For
Estimation. Survey and population sample size for proportions and means, with confidence level, margin of error, expected proportion, standard deviation, and finite population correction. Reverse directions: margin of error from sample size, and implied finite population from sample size and precision.
Experiment / study. Power-based sample size for single-sample, two-group, and paired designs with continuous or binary outcomes. Superiority, non-inferiority, and equivalence hypotheses. Allocation ratio, alpha, power, and expected effect.
What This Calculator Is Not
It is not a full power-analysis workbench. For calculating power from an existing sample size, exploring minimum detectable effects, drawing power curves, or running advanced reverse calculations, use the dedicated Power Analysis Calculator.
For the specific Slovin's formula method, use the Slovin's Formula Calculator. ANOVA, chi-square, t-test, correlation, and regression sample-size calculations are handled by their dedicated SILDIL calculators.