Sample size and power calculator

Sample size calculator for surveys and studies: n for a margin of error on a proportion or mean, and the per-group n for a target power.

Drafted with AI writing toolsUpdated Checked examples: 6

%
%
Use 50% when you have no prior estimate: it gives the largest, safest sample.
%
In percentage points: 5 means ±5%.
Applies the finite population correction.
Try
Sample size needed
Sample size needed: 385
Whole number; Nearest, ties away from zero
Before rounding up
384.1459
z for the confidence level or α
1.959964

The planning formula requires 385 observations for a nominal 95% confidence level and margin ±5 percentage points. Using p = 50% gives the largest sample requirement under this approximation. Without population correction, halving the margin quadruples the unrounded sample size. This assumes simple random sampling and the stated variance; it does not account for non-response or bias.

Sample size against margin of error

05001,0001,5002.557.51012.515Margin of error (percentage points)nn = 385
How it's calculated S
  1. Critical z

    z=Φ−1 ⁣(1+0.952)=1.959964z = \Phi^{-1}\!\left(\tfrac{1 + 0.95}{2}\right) = 1.959964
  2. Sample size for a large population

    n0=z2p(1−p)E2=1.9599642×0.5×0.50.052=384.145882n_0 = \frac{z^2 p(1-p)}{E^2} = \frac{1.959964^2 \times 0.5 \times 0.5}{0.05^2} = 384.145882
  3. Round up

    n=⌈384.145882⌉=385n = \lceil 384.145882 \rceil = 385

    Always rounded up: rounding down would miss the target margin.

About the sample size and power calculator

For a survey proportion the sample size is n₀ = z²p(1 − p)/E², where z is the critical value for the confidence level and E the margin of error; for a mean it is (zσ/E)². A known population size N reduces this through the finite population correction, n = n₀/(1 + (n₀ − 1)/N). To compare two means, each group needs 2(z₁₋α/₂ + z₁₋β)²/d², where d is the difference to detect divided by σ and n_g is the size per group. This is a normal approximation, not an exact t-test power calculation.

Survey planners and researchers use it before collecting data. The default, 95% confidence and ±5 points with p = 50%, needs 384.1 respondents, rounded up to 385; for a population of 10,000 the correction lowers that to 370.

Results are always rounded up. The formulas assume simple random sampling; cluster samples, weighting and non-response all call for a larger sample.

How to calculate sample size for a survey

Cochran's formula gives the sample size for estimating a proportion: n₀ = z² × p(1 − p) ÷ E². At 95% confidence (z = 1.96), an expected 50% and a margin of ±5 points, n₀ = 1.96² × 0.25 ÷ 0.05² ≈ 384.2, which rounds up to 385 respondents.

Worked by hand:

  1. Convert the percentages to proportions: p = 0.50 and E = 0.05.
  2. Take z for the confidence level: 1.959964 at 95%.
  3. Compute n₀ = 1.959964² × 0.50 × 0.50 ÷ 0.05² = 384.146.
  4. Round up, never to the nearest, so n = 385.

The formula assumes a simple random sample of independent responses and uses a normal approximation. Cluster samples, weighting and non-response all call for a larger sample.

Margin of error and sample size

The margin shrinks with the square root of n, so halving it takes four times the sample. At 95% confidence and p = 50%:

  • ±5 points: 385
  • ±3 points: 1,068
  • ±2.5 points: 1,537
  • ±2 points: 2,401
  • ±1 point: 9,604

The confidence level moves the requirement too. For ±5 points, 90% confidence needs 271 and 99% needs 664.

The ±2.5 figure is 1,537, not 4 × 385 = 1,540, because the factor of four applies before rounding: 4 × 384.146 = 1,536.6.

Why p = 50% is the safe choice

p(1 − p) is largest at p = 0.5, so 50% gives the biggest requirement for a given margin. Use it unless a reliable earlier estimate exists.

A prior estimate of 20% lowers the requirement to 246 for ±5 points at 95%. If the true share turns out nearer 50%, the achieved margin will be wider than planned. 20% and 80% give the same answer, since p(1 − p) is symmetric.

Does population size matter?

Only when the sample is a noticeable share of the population. The finite population correction is n = n₀ ÷ [1 + (n₀ − 1) ÷ N], rounded up:

  • N = 100: 80
  • N = 1,000: 278
  • N = 10,000: 370
  • N = 100,000: 383
  • N = 1,000,000: 384

A sample of 1,000 gives about ±3.1 points whether the population is 100,000 or 300 million. When the requirement is over half the population, a census may be simpler.

The correction applies to random sampling without replacement from a defined population of N. It is no discount for having only N volunteers or contacts.

Sample size for estimating a mean

For a mean, the formula is n₀ = (z × σ ÷ E)², with the standard deviation σ and the margin E in the same units. With σ = 15, E = 3 and 95% confidence, n₀ = (1.959964 × 15 ÷ 3)² = 96.04, so n = 97.

σ is the spread of individual observations, usually from a pilot study or earlier data, not the standard error of a mean. Underestimating σ underestimates n, and n grows with σ²: doubling σ quadruples the sample (NIST).

Sample size for comparing two means (power)

To detect a difference δ between two equal-sized groups with common SD σ, each group needs n = 2(z₁₋α/₂ + z₁₋β)² ÷ d², where d = δ ÷ σ and 1 − β is the power.

Detecting δ = 7.5 when σ = 15 gives d = 0.5. With a two-sided α of 0.05 and 80% power, n = 2 × (1.959964 + 0.841621)² ÷ 0.25 = 62.79, so 63 per group and 126 in total.

Power is the probability of detecting the effect if it is real. Cohen (1988) proposed 80% as a conventional minimum; 90% power raises the example to 85 per group.

A one-sided test at the same α needs 50 per group, but the direction must be fixed before any data are seen.

This is a normal approximation. Cohen's t-based table gives 64 per group for the same case, and very small samples call for an exact t-based calculation.

Sample size examples

ScenarioRequired n
Default385
Half margin1537
Population ten thousand370
Population hundred80
Mean97
Power63
Power one sided50

"Default" is the 95%, ±5-point survey at p = 50%, and the next three rows change one input each: margin ±2.5, N = 10,000 and N = 100. "Mean" is σ = 15 with E = 3. The power rows are per group, for d = 0.5, α = 0.05 and 80% power.

Inputs worth checking

  • Percentages are whole numbers: an expected proportion of 50 means 50%, and a margin of 5 means ±5 percentage points.
  • Population size is optional. Left blank, the population is treated as large.
  • Power results are per group. Double them for the total, and add allowances for dropout separately.

Mistakes that change the plan

  • Reading ±5% as 5% of the estimate. ±5 points around 50% is 45% to 55%. A margin of 5% of 50% would be ±2.5 points and needs 1,537.
  • Picking an extreme p to shrink n. An expected 10% needs 139 respondents instead of 385, but only if 10% is right.
  • Ignoring non-response. If 40% of those invited are expected to respond, invite 385 ÷ 0.4 = 963 people.

For the interval itself once data are in, use the confidence interval calculator. To test the two groups after the study, use the t-test calculator.

Worked examples

Survey at 95%, ±5%, p = 50% (defaults)

Plan for
Estimating a proportion (survey)
Confidence level
95%
Expected proportion
50%
Margin of error
5%
Sample size needed
385
Before rounding up
384.1459

Checked against: Cochran's formula 1.959964² × 0.25 / 0.05² = 384.146; the widely published figure is 385

Same survey, population of 10,000

Plan for
Estimating a proportion (survey)
Confidence level
95%
Expected proportion
50%
Margin of error
5%
Population size
10,000
Sample size needed
370
Before rounding up
369.9706

Checked against: Independent calculation

Small population of 100

Plan for
Estimating a proportion (survey)
Confidence level
95%
Expected proportion
50%
Margin of error
5%
Population size
100
Sample size needed
80
Before rounding up
79.5093

Checked against: Independent calculation

Mean within ±3 when σ = 15

Plan for
Estimating a mean
Confidence level
95%
Standard deviation σ (estimate)
15
Margin of error (same units as σ)
3
Sample size needed
97
Before rounding up
96.0365

Checked against: Independent calculation

Questions

Why is 385 the standard survey sample size?

It is what Cochran's formula gives for 95% confidence, a ±5-point margin and p = 50%: 1.96² × 0.25 / 0.05² = 384.1, rounded up to 385. Because p = 50% maximizes p(1 − p), 385 is the conservative requirement under this normal-approximation formula for a large population. A population of 1,000 needs only 278, because each respondent is a larger share of it.

Does population size matter for sample size?

Only when the sample is a noticeable fraction of the population. The finite population correction turns the 385 needed for ±5 points at 95% into 370 for a population of 10,000 and 80 for a population of 100, while any population above 100,000 needs 383 to 385. A sample of 1,000 gives about ±3.1 points whether the population is 100,000 or 300 million.

What expected proportion should I use?

Use 50% unless you have a reliable prior estimate. p(1 − p) is largest at p = 0.5, so this formula gives its largest sample requirement at that value. A prior estimate lowers the requirement: at 95% confidence and ±5 points, an expected 20% needs 246 respondents instead of 385. If the guess is wrong, the achieved margin will be wider than planned.

How does sample size change with the margin of error?

The margin shrinks with the square root of n, so halving it needs four times the sample. At 95% confidence and p = 50%, ±5 points needs 385 respondents, ±3 points 1,068, ±2 points 2,401 and ±1 point 9,604. Choosing 90% confidence instead of 95% lowers the ±5-point figure to 271.

What does statistical power mean?

Power is the probability that a test detects an effect of a stated size when that effect is real; 1 − power is the Type II error rate β. Cohen (1988) proposed 80% as a conventional minimum. Detecting a difference of 7.5 when σ = 15 (d = 0.5) with a two-sided test at α = 0.05 needs 63 per group for 80% power by the normal approximation; Cohen's t-based table gives 64.

About this calculator

n0=z2 p(1−p)E2,n0=(zσE)2,n=n01+(n0−1)/N,ng=2(z1−α/2+z1−β)2σ2δ2n_0 = \frac{z^2\,p(1-p)}{E^2},\quad n_0 = \left(\frac{z\sigma}{E}\right)^2,\quad n = \frac{n_0}{1 + (n_0-1)/N},\quad n_g = \frac{2(z_{1-\alpha/2} + z_{1-\beta})^2\sigma^2}{\delta^2}

Sources

  1. NIST/SEMATECH e-Handbook of Statistical Methods, §7.2.2.2 Sample sizes required
  2. Cochran, W. G. (1977). Sampling Techniques, 3rd ed., §4.4 (sample size for proportions and the finite population correction)
  3. Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences, 2nd ed., Table 2.4.1

Checked against references

This calculator includes 6 worked examples with independently sourced answers. They run in the test suite, and you can run them here too.

Put this calculator on your site

Paste this where you want the calculator to appear. It is free to use, it stays in step with corrections made here, and the credit line below it links back so your readers can find the full version.

Height
Preview the embed

Keep the credit line. It is the only condition, and it is what keeps these calculators free.