Home › Statistics & Probability Calculators › Sample Size Calculator for a Mean
Sample Size Calculator for a Mean
Before collecting data, use this calculator to find the sample size needed to estimate a population mean within a target margin of error. Enter an estimate of the population standard deviation (from a pilot study, previous research or the range ÷ 4 rule), the margin of error you can accept, and the confidence level.
The formula is n = (z × σ ÷ E)². The result is rounded up to the next whole number, because a fractional observation cannot be collected and rounding down would leave the margin of error slightly too large. The steps show the critical value, the substitution and the rounding.
Halving the margin of error requires four times the sample size, and moving from 95% to 99% confidence increases n by about 73%, so it is worth being realistic about the precision you need. After you collect the data, compute the actual interval with the confidence interval for a mean.
Result and step-by-step solution
To estimate the mean within ±3 with 95% confidence when σ ≈ 15.
- Formulan = (z × σ ÷ E)²
- Critical valuez0.025 = 1.96
- Substituten = (1.96 × 15 ÷ 3)² = (9.7998)² = 96.0365
- Round upAlways round up to the next whole person or unit: n = 97
Frequently asked questions
- What if I don't know the population standard deviation?
- Use the sample SD from a pilot study or a published study of a similar population, or estimate it as (largest plausible value − smallest) ÷ 4.
- Why round up rather than to the nearest number?
- Rounding down gives a margin of error larger than E. Rounding up guarantees the target precision is met.
- Why does the formula use z rather than t?
- Because the sample size is not yet known, so the t degrees of freedom are unknown. The z value is a close approximation for the n values this formula usually produces.
- How does the margin of error affect sample size?
- n is proportional to 1/E². Cutting the margin of error in half needs four times as many observations.
Last reviewed: September 25, 2026. Calculations run in your browser and were validated against SciPy.
