Sample Size Calculator

Plan a sample size for a target margin of error at a stated confidence level. For a proportion, n = z² p (1 − p) / E², and p = 0.5 is used when you are unsure, because that choice maximises n. For a mean, n = (z σ / E)². Results are rounded up to the next whole person or item. The calculation assumes a simple random sample and a normal (z) approximation. It ignores finite-population corrections, clustering, dropout and design effects, and it is not a clinical-trial power calculation.

By Rashid MehmoodLast updated and reviewed Free, no sign-up

Sample size calculator

–

How to use the sample size calculator – mean or proportion, z approximation

  1. Choose a proportion or a mean. A proportion needs a planning p (0.5 if you are unsure) and a margin E as a fraction, such as 0.03 for ±3 percentage points. A mean needs a planning standard deviation and a margin in the same units.
  2. Pick a confidence level. 90%, 95%, 99%, or a custom percent. z is the same critical value as on the confidence-interval page.
  3. Read n as a lower bound under simple assumptions. The result is ceiled. Real surveys often need more people after non-response and design effects, which are not modelled here.
Embed this calculator

Paste this iframe on your own site. The embed view already includes a visible “Calculator by CalcTen” credit, which must stay visible. See the developers page for the conditions.

Formulas on this page

For a planned proportion p and a target margin of error E at a two-sided confidence level with critical value z,

n = z² p (1 − p) / E²,

then rounded up to the next whole observation. E is a fraction: 0.03 means ±3 percentage points, not ±3%.

For a planned standard deviation σ and the same z and E (now in the units of σ),

n = (z σ / E)²,

again ceiled. z is Φ⁻¹(1 − α/2): about 1.645 at 90%, 1.960 at 95%, and 2.576 at 99%.

These identities invert the half-width of the z intervals on the confidence-interval calculator. They assume a simple random sample, a normal approximation, no clustering, and that every selected unit responds. A design effect of 1.5, or a 20% non-response rate, would raise the number you actually field; those adjustments are yours to apply, not invented here.

What this page is not

It is not a two-sample power calculator, not a “how many patients do I need for 90% power”, and not a finite-population or cluster-sample planner. If you only want the interval for data you already have, use the confidence-interval calculator. If you need s from a list, use the standard-deviation calculator first.

Worked figures

  • Proportion, 95%, p = 0.5, E = 0.03: n = 1,068.
  • Proportion, 95%, p = 0.2, E = 0.03: n = ceil(682.93) = 683.
  • Mean, 95%, σ = 10, E = 2: n = ceil((1.960×10/2)²) = ceil(96.04) = 97.

Those identities are unit-tested against the same TypeScript functions the browser runs. Copy result, Copy link and Reset work as on the other GenericCalc tools. Report a mistake from the about box if a figure disagrees with a hand check.

Frequently asked questions

How many observations for a 95% proportion with p = 0.5 and a ±3 percentage-point margin?

E = 0.03, z ≈ 1.960, n = ceil(1.960² × 0.25 / 0.03²) = ceil(1067.07) = 1,068. That is the default example.

Why does p = 0.5 give the largest sample?

The product p(1 − p) is largest at 0.5. If you have a better planning value, you can type it and n will usually fall.

How is the mean formula different?

n = (z σ / E)², ceiled. E and σ must be in the same units, for example both in kilograms or both in centimetres.

Is this a power calculation for a clinical trial?

No. Power calculations need an effect size, a test, and often two groups or a non-inferiority margin. This page only inverts a simple margin-of-error identity.

Do you apply a finite-population correction?

No. If the population is small, a correction would reduce n; that is left to a specialist tool or a statistician.

Where does z come from?

The same standard-normal critical value as the confidence-interval calculator, from Φ and Abramowitz and Stegun 7.1.26.

Should I add more for dropout?

Often yes in practice, but this page will not invent a dropout rate. Inflate n yourself if you expect missing data.

Sources and references

About this calculator

Written and maintained by Rashid Mehmood, founder of CalcTen. The formulas are unit-tested against hand-worked examples, and the content is reviewed whenever product sizes or guidance change. Last updated and reviewed 15 November 2026. See our editorial policy. If you spot a mistake, report it.

Results are calculated from the numbers you enter and shown with the working. Rounding is applied only when displaying results. Grade and GPA scales, and weighting rules, vary by school, so confirm with your institution. Read the disclaimer.

Calculator by CalcTen — free online calculators.