Skip to content

Sample Size Calculator for a Mean (Margin of Error and Confidence)

How many observations you need to estimate a mean within a chosen margin of error at 90%, 95% or 99% confidence.

Inputs

Required sample size
217

Use this calculator on your own site

Free embed

  • Two lines of HTML, unlimited views
  • Shows a small CalculateEveryday bar, with a credit link under the calculator

What each Sample Size for a Mean input means

Margin of error
The margin of error you can accept, in the units of the measurement: ±2 points, ±0.5 kg, ±5 minutes.
Expected std dev
Your best estimate of the standard deviation, from a pilot study, an earlier survey or the range ÷ 4.
Confidence
The confidence level: 90%, 95% or 99%, with z = 1.645, 1.96 or 2.576. 95% is what nearly every report means.

Sample Size for a Mean formula

n = (z × σ ÷ E)², rounded up · E = margin of error you will accept · z = 1.645 (90%), 1.96 (95%), 2.576 (99%)

n=(zα/2 σE)2n = \left(\frac{z_{\alpha/2}\, \sigma}{E}\right)^{2}

The error bound of a confidence interval is z × σ ÷ √n; turn that round to ask how big n must be for a bound you can accept, and it is n = (zσ ÷ E)². Three things go in: the margin you can live with, the confidence level, and a guess at the standard deviation — from a pilot study, an earlier survey or a range rule of thumb (range ÷ 4). The answer is always rounded up, because a fraction of an observation cannot be collected and rounding down would miss the target. The square is the expensive part: halving the margin multiplies the sample by four, and moving from 95% to 99% confidence multiplies it by (2.576 ÷ 1.96)² = 1.73.

Sample Size for a Mean worked example

To estimate a mean within ±2 with a standard deviation of about 15 at 95% confidence: (1.96 × 15 ÷ 2)² = (14.7)² = 216.09, rounded up to 217 observations. Accepting ±4 instead needs only (7.35)² = 54.02 → 55; wanting ±1 needs 865. At 99% confidence the ±2 answer rises to (2.576 × 15 ÷ 2)² = 373.3 → 374.

More Sample Size for a Mean examples

To estimate a mean within ±5 when the standard deviation is about 20, at 95%: (1.96 × 20 ÷ 5)² = 61.47, so a sample of 62. Halving the margin to ±2.5 needs 246.

A machine's average fill to within ±0.5 g, standard deviation 3 g, at 90%: (1.645 × 3 ÷ 0.5)² = 97.42, so weigh 98 packs.

Where the Sample Size for a Mean calculator can give the wrong answer

  • The standard deviation is a guess before the data exist, and the sample size scales with its square. If the pilot estimate is 20% low, the sample is 31% too small; err on the high side.
  • This is the formula for estimating a mean. Estimating a proportion (a poll percentage) uses n = z² p(1 − p) ÷ E², which at p = 0.5 and 95% gives 1,067.1 for ±3% — 1,068 once rounded up.
  • Non-response, dropouts and unusable records mean the collected sample has to be larger than the calculated one. Divide by the expected response rate: 217 needed at a 60% response means 362 approached.
  • For very small populations a finite-population correction reduces the required n; the page assumes the population is large compared with the sample.
  • The rounding is always up. 216.09 becomes 217, not 216, because 216 would leave the margin slightly above the target.

Spotted a mistake? Tell us

Sample Size for a Mean reference table

Sample size for a standard deviation of 15, by margin of error and confidence level
Margin of error90%95%99%
±16098651,494
±2153217374
±36897166
±5253560
±107915
Source: Arithmetic: n = (z × 15 ÷ E)², rounded up (OpenStax Introductory Statistics 2e, §8.1)

Sample Size for a Mean FAQ

n = (z × σ ÷ E)². For a margin of ±5, a standard deviation of 20 and 95% confidence: (1.96 × 20 ÷ 5)² = (7.84)² = 61.5, so 62 observations. Enter your margin, standard deviation and confidence level and the page does the arithmetic and the rounding.