How to Use the Sample Size Calculator

Choose estimation or experiment, enter the required inputs, review the statistical sample size, and plan recruitment separately from the statistical requirement.

  1. 1. Choose what you are calculating: Pick Estimation if you are sizing a survey, prevalence study, or mean estimate — inputs are confidence level, margin of error, and expected proportion or SD. Pick Experiment / study if you are planning a hypothesis test — inputs are α, target power, expected effect, and variability. The two paths use different formulas.
  2. 2. Choose the direction or the design: In estimation mode, choose Required sample size, Margin of error, or Population size — the calculator solves in any direction. In experiment mode, choose Single sample, Two independent groups, or Paired / matched, then Continuous or Binary outcome.
  3. 3. Enter the core inputs: Estimation: enter confidence level, margin of error, expected proportion (or use the 50% conservative option), and population size if finite. Experiment: enter α, target power, expected means or proportions, and variability. FPC applies automatically when a finite N is entered.
  4. 4. Set hypothesis and allocation (experiment only): Choose Superiority, Non-inferiority, or Equivalence. For superiority, choose one- or two-sided. For two-group designs, set the allocation ratio (1 for equal groups). For non-inferiority or equivalence, enter the margin.
  5. 5. Review the result: The hero figure shows the primary output for your direction — required sample size, margin of error, or implied population. The stats panel reports the exact and rounded sample, Z or α, power, effect used, and any recruitment adjustment. The calculation steps show the formula substitution so you can verify the arithmetic.
  6. 6. Review the sensitivity tables: Estimation mode shows sample size across margin-of-error values, across confidence levels, and across population sizes. Experiment mode shows sample size across power levels, across α values, and across effect scales. The highlighted row matches your current inputs.
  7. 7. Plan recruitment separately from statistical n: If you expect nonresponse, attrition, or a complex sampling design, open the Advanced panel. The calculator returns the recruitment target separately — statistical n divided by (response rate × completion rate) or (1 − attrition) — and applies design effect and oversampling before that. It never changes the statistical n used for precision or power.

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

  1. Decide whether you are estimating a quantity (survey, prevalence, mean) or testing a hypothesis (experiment, trial, A/B test).
  2. For estimation, choose confidence level and margin of error. For experiments, choose significance level α and target power.
  3. Specify the expected proportion, mean, or effect size, and variability where required.
  4. Enter the population size if it is finite and known.
  5. Calculate the statistical sample size.
  6. Apply finite-population correction or design-effect adjustments when appropriate.
  7. Account separately for nonresponse, attrition, and oversampling to get the recruitment target.
  8. 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

SituationMain inputs
Population proportionConfidence, margin of error, expected proportion
Population meanConfidence, margin of error, standard deviation
Experimental meanAlpha, power, expected mean difference, SD
Experimental proportionAlpha, 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.

Frequently Asked Questions

Q: What sample size do I need for a population of 1,000?

At 95% confidence, 5% margin of error and p = 0.50, the infinite-population figure is about 385. Applying the finite population correction for N = 1,000 gives approximately 278 completed responses.

Q: What sample size do I need for a population of 10,000?

At 95% confidence, 5% margin of error and p = 0.50, the finite population correction for N = 10,000 gives about 370 — only slightly below the infinite-population figure of 385. For populations this size and larger, FPC has a small effect.

Q: What sample size do I need for a 5% margin of error?

In a large or unknown population at 95% confidence with p = 0.50, a 5% margin of error requires 385 completed responses. A 3% margin requires about 1,067; a 1% margin requires about 9,604 — because sample size scales with 1/e².

Q: What confidence level should I use?

95% is the standard default in most research. 90% is acceptable when resources are limited and a wider interval is tolerable. 99% is used when the cost of missing the true value is high. Higher confidence always increases the required sample for the same margin of error.

Q: Why is 50% used in sample size calculations?

Because 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. If you have a reliable prior estimate of the proportion, use it instead; a p of 0.30 requires a smaller sample.

Q: How many survey responses do I need?

It depends on confidence level, margin of error, expected proportion, and population. For a large population at 95% confidence and 5% margin of error with p = 0.50, plan for 385 completed responses. At an 80% response rate, invite 385 / 0.80 = 482 people. At a 30% response rate, invite 1,283.

Q: What is the difference between sample size and recruitment target?

The statistical sample size is the number of completed, usable responses required by the formula. The recruitment target is larger — it accounts for nonresponse or attrition. For 385 completed responses at an 80% response rate, the recruitment target is 482. The calculator shows both separately.

Q: How should I adjust sample size for nonresponse?

Recruitment target = statistical n ÷ (1 − attrition), or statistical n ÷ (response rate × completion rate). Do not stack response rate and attrition — the calculator uses one path or the other depending on which is active. The adjustment affects only the recruitment target, not the statistical sample size.

Q: What is design effect in sample size calculation?

A multiplier applied to the base sample when a complex sampling design — clustering, stratification with unequal weights, multi-stage sampling — inflates 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.

Q: What is the difference between sample size and power analysis?

Sample size calculation answers "how many do I need?" for estimation and common experiments. Power analysis answers broader questions — what power does this n give, what is the minimum detectable effect, what does the power curve look like across a range of n. Use the dedicated Power Analysis Calculator when your primary question is about power rather than sample size.

Q: What is the difference between sample size and Slovin's formula?

Slovin's formula (n = N / (1 + N × e²)) is a simplified one-line method that assumes p = 0.50 and does not take confidence level as an input. This calculator supports the standard confidence-level and margin-of-error approach plus finite population correction and power-based calculations. Use the Slovin's Formula Calculator when that specific method is intended.

Loaded shared calculation