Code tool

Sample Size Calculator

Estimate the sample size for a population proportion using confidence, margin of error, and an optional finite population. Choose a preset or enter your own positive Z; an entered Z is not assigned an invented confidence percentage. Enter response rate separately from estimated proportion. All numeric inputs start empty.

In-browser processingNo account requiredPrivacy details ↗

Choose a preset or enter your own positive Z; an entered Z is not assigned an invented confidence percentage. Enter response rate separately from estimated proportion. All numeric inputs start empty.

Enter 1–20 positive margins separated by commas or whitespace; use a dot for decimals. Rows are yours, with no preset error values.

For one population proportion under simple random sampling with independent observations. Confidence uses a two-sided standard-normal z value. Margin is an absolute percentage-point margin, not a relative percentage.

Convert margin and proportion to fractions: n₀ = z²p(1−p)/e². For finite population N: n = Nn₀/(N+n₀−1). First completed = ceil(n), then invitations = ceil(completed/(response rate/100)). For p = 0 or 1, n₀ and n are 0 by the degenerate formula; no precision guarantee follows.

Approximate planning for simple random sampling, not a guarantee of precision or an exact binomial interval. Invitation gross-up models an expected response percentage; it does not correct nonresponse bias. Clustering, weighting, design effects and hypothesis-test power are excluded. Means, rare proportions, small samples and separately reported subgroups require suitable methods.

A QUICK WALKTHROUGH

How to use this tool

  1. Choose a two-sided confidence level.
  2. Enter the margin in percentage points and an estimated proportion; use 50% when unknown.
  3. Optionally enter the finite population size, then calculate.
  4. Choose the confidence input mode and supply a level or positive Z.
  5. Enter your expected response rate and 1–20 comparison margins.
  6. Review unrounded sizes, rounded completed counts and invitations; copy or download the frozen report.

Two-sided confidence level

For one population proportion under simple random sampling with independent observations. Confidence uses a two-sided standard-normal z value. Margin is an absolute percentage-point margin, not a relative percentage.

n₀ = z²p(1−p)/e²

Convert margin and proportion to fractions: n₀ = z²p(1−p)/e². For finite population N: n = Nn₀/(N+n₀−1). First completed = ceil(n), then invitations = ceil(completed/(response rate/100)). For p = 0 or 1, n₀ and n are 0 by the degenerate formula; no precision guarantee follows.

Approximate planning result; always rounded upward.

Approximate planning for simple random sampling, not a guarantee of precision or an exact binomial interval. Invitation gross-up models an expected response percentage; it does not correct nonresponse bias. Clustering, weighting, design effects and hypothesis-test power are excluded. Means, rare proportions, small samples and separately reported subgroups require suitable methods.

Completed-observation comparison

The three columns retain existing 90%, 95% and 99% two-sided normal Z approximations (more digits than the source’s rounded values). They use your proportion and population, independent of selected Z and response rate. Custom mode adds your Z as a separate column.

Expected response rate (%)

Choose a preset or enter your own positive Z; an entered Z is not assigned an invented confidence percentage. Enter response rate separately from estimated proportion. All numeric inputs start empty.

GOOD TO KNOW

Common questions

Why use 50%?

p = 0.5 gives the largest variance and most conservative size for this formula. Count completed observations; invitations may need to be higher for nonresponse.

Are inputs uploaded?

No. The calculation runs locally in your browser.