Sample Size for a Mean Calculator
Find how many observations you need to estimate a population mean within a chosen margin of error at a given confidence level.
How it works
n = (z · σ ÷ E)² · z = two-sided critical value for the confidence level
The width of a confidence interval for a mean shrinks with the square root of the sample size, so halving your margin of error costs four times the data. This formula inverts that relationship: pick the precision (E) and confidence you want, plug in an estimate of the population standard deviation, and it returns the smallest n that delivers it. Because you rarely know σ in advance, use a pilot sample or the SD from earlier work.
Worked example
For a ±5 margin at 95% confidence with σ ≈ 15: n = (1.96 × 15 ÷ 5)² = 5.88² = 34.6, which rounds up to 35 observations.
Frequently asked questions
Why do I need to know the standard deviation first?
Sample size depends on how spread out the data are — a more variable population needs more observations for the same precision. When σ is unknown, estimate it from a pilot study, a previous survey, or by dividing the plausible range by 4.
What if my population is small?
For finite populations you can apply a correction: n_adjusted = n ÷ (1 + (n − 1)/N), where N is the population size. It meaningfully reduces the requirement only when your sample is a large fraction of the whole population.
Should I always round up?
Yes. Rounding down would leave the interval slightly wider than your target margin of error, so sample-size results are always rounded up to the next whole subject.
Related calculators
This calculator is for educational purposes. Double-check important results before acting on them.