Home · Statistics · Inference & Tests · Sample Size Calculator

Sample Size Calculator

The sample size needed to estimate a proportion or a mean to within a chosen margin of error at a chosen confidence level, rounded up to a whole number.

Your figures

Example result — edit the figures to make it yours

385

Unrounded n384.145882
Critical value z1.959964

What this calculator does

The sample size needed to estimate a proportion or a mean to within a chosen margin of error at a chosen confidence level, rounded up to a whole number. Every figure on this page is computed from the standard definition stated below — the same definition used in textbooks and reference tables — with no hidden rounding steps, and the method notes name the exact convention where more than one exists.

The formula and method

Proportion: n = z²·p(1−p) / E²; Mean: n = (z·s / E)² — always rounded up

Proportion mode uses n = z²·p(1−p)/E² with the z value for the chosen confidence level; p defaults to 0.5, the most conservative (largest-n) choice.

Mean mode uses n = (z·s/E)² with your best estimate of the standard deviation s.

The result is rounded up, because rounding down would leave the margin slightly wider than requested.

Worked example

With the example inputs this page opens with (margin of error e 0.05, assumed proportion p (proportion mode) 0.5, standard deviation s (mean mode) 15), the result is 385. Change any figure and the result updates with the same formula.

Quick reference

Quick reference — varying margin of error e
Margin of error EResult
0.0251,537
0.04601
0.05385
0.0625246
0.075171
0.197

Computed with the same formulas as the calculator above — enter any values there for figures beyond this table.

Common questions

Why does p = 0.5 give the largest sample size?

The variance p(1−p) peaks at p = 0.5. If you have no prior idea of the proportion, 0.5 guarantees the margin for any true value; a prior estimate away from 0.5 legitimately reduces the required n.

Does the population size matter?

Only when the sample is a noticeable fraction of a small population, where a finite-population correction can shrink n. For large populations the required n depends on the margin and confidence level, not on how big the population is.

How does the Sample Size Calculator work?

The sample size needed to estimate a proportion or a mean to within a chosen margin of error at a chosen confidence level, rounded up to a whole number. Mode · Confidence level · Margin of error · Assumed proportion or SD → Required sample size. The result updates as you type, and the formula and method on this page state the exact definitions used, so you can reproduce the calculation by hand.

What inputs does the Sample Size Calculator need?

Mode · Confidence level · Margin of error · Assumed proportion or SD → Required sample size. Invalid entries — such as a zero denominator, an out-of-range value or a malformed list — produce a plain-language message instead of a misleading number.