Skip to content
UnitFormula

To estimate a mean within a margin of error E at a chosen confidence level, the minimum sample size is n = (z·σ/E)², rounded up, where z is the critical value (1.645 for 90%, 1.96 for 95%, 2.576 for 99%) and σ is the standard deviation. For σ = 1 and a margin of 0.2 at 95% confidence, n = (1.96 × 1 / 0.2)² = 96.04, which rounds up to 97.

Sample Size Calculator — for estimating a mean

Sample size to estimate a mean within ±0.2 at 95% confidence (σ = 1).

Required sample size97

Quick examples

How it's calculated

  1. n = ⌈(z × σ ÷ E)²⌉ — rounded upn=(zσE)2n = \left\lceil \left( \dfrac{z \, \sigma}{E} \right)^2 \right\rceil
    z
    = 1.96
    sigma
    = 1
    E
    = 0.2
    97
Required sample size97

How it works

Before collecting data you often need to know how many measurements to take so your estimate of the mean is precise enough. For a known standard deviation σ and a target margin of error E, the minimum sample size is:

n = ⌈(z × σ ÷ E)²⌉

This is the confidence-interval margin E = z·σ/√n solved for n. It has three levers:

  • z, the critical value for your confidence level: 1.645 (90%), 1.960 (95%) or 2.576 (99%). More confidence needs a bigger sample.
  • σ, the standard deviation — noisier data needs more measurements.
  • E, the margin of error you will accept — a tighter margin costs more data, and because E is squared, halving it quadruples the sample size.

The result is always rounded up: a fractional sample size would leave the achieved margin slightly larger than your target, so you take the next whole measurement.

Worked example

Suppose the standard deviation is σ = 1 and you want to estimate the mean within E = 0.2 at 95% confidence. Then n = (1.96 × 1 / 0.2)² = (9.8)² = 96.04, which rounds up to 97 measurements. Tighten the margin to 0.1 and the requirement jumps to 385; drop to 90% confidence and it falls to 68. For a noisier quantity like IQ (σ = 15) estimated within 5 points at 95%, n = (1.96 × 15 / 5)² = 34.57 → 35.

Frequently asked questions

What is the formula for sample size when estimating a mean?

n = (z·σ/E)², rounded up, where z is the confidence-level critical value, σ is the standard deviation and E is the margin of error. It comes from rearranging the confidence-interval margin E = z·σ/√n to solve for n.

Why is the sample size always rounded up?

Because you cannot take a fraction of a measurement, and rounding down would let the real margin of error exceed your target. Rounding up guarantees the interval is at least as precise as you asked for.

How does the margin of error affect sample size?

Strongly — E is squared in the denominator, so precision is expensive. Halving the margin of error quadruples the required sample size; cutting it to a third needs nine times as much data.

Where do I get the standard deviation before I have data?

Use the best estimate available: a pilot study, a previous experiment, or a published value for a similar measurement. If none exists, run a small pilot first to estimate σ, then compute the full sample size. The formula requires σ as an input.

Does higher confidence need a larger sample?

Yes. Moving from 90% to 95% to 99% raises z from 1.645 to 1.960 to 2.576, and since z is squared, the sample size grows with it. Being more certain your estimate is close to the truth requires more data.

Is this the same as sample size for a survey or proportion?

Not quite. This calculator sizes a sample for estimating a **mean** using the standard deviation. Surveys that estimate a **proportion** (a percentage) use a related formula, n = z²·p(1−p)/E², where p is the expected proportion. The idea is the same — z, spread and margin — but the spread term differs.