Skip to content
Calcapedia
Statistics & Data

Sample Size Calculator

Work out how many survey responses or measurements you need to estimate a proportion or a mean within a chosen margin of error.

Level: Grade 12 to college

Printable worksheet

Sample Size Calculator

Inputs
Estimating

How close your result should be to the true value, in percentage points.

Use 50% if you're not sure. It gives the largest, safest sample size.

The size of the whole group you're sampling from. Leave blank if it's large or unknown.

Confidence level

Result

Required sample size

385 responses

You need at least 385 responses for 95% confidence at the margin you chose.

Before rounding up
384.1459
Critical value (z*)
1.96

See the step-by-step solution ↓

Step-by-step solution

  1. Look up the z value (z*) for 95% confidence. The surer you want to be, the bigger it gets, and the more responses you need

    z*=1.96
  2. For a percentage, use your expected share (p) and margin (E) as decimals. Square z*, times p × (1 − p), then divide by E squared

    n₀=1.962×0.5×(1−0.5)0.052=384.145882
  3. Round up to the next whole number, because rounding down would miss your margin

    round up=385

Test yourself

20 quick questions built from this calculator's formula: work out results, predict what happens when an input changes, and work backward from an answer. Every answer comes with the working.

What this calculator does

Find out how many survey responses or measurements you need for a result you can trust. Before you run a survey or study, it pays to know this number. Too few, and the result is too vague to act on. Too many, and you spend time and money on precision nobody needed.

The right number depends on three things. How close do you need to be (your margin of error)? How sure do you want to be (your confidence level)? And how much does the thing you're measuring vary?

This calculator finds the smallest sample that gets you there. It works for a proportion, such as the percentage of customers who would recommend you. It also works for a mean (an average), such as average spend. For small groups, it applies the finite population correction, an adjustment that can cut the number you need by a lot.

Where it's used

Why this math matters outside the classroom:

  • Election polls. A pollster who wants ±3 points at 95% confidence needs 1.96² × 0.25 ÷ 0.03², or about 1,068 respondents.
  • Customer surveys. A business accepting a ±5-point margin at 95% confidence needs about 385 survey responses.
  • Quality testing. A lab estimating mean fill weight within ±1 g, with SD 5 g, needs (1.96 × 5 ÷ 1)², rounded up to 97 samples.
  • Small populations. A school of 800 students needs about 260 responses, not 385, for ±5 points thanks to the finite population correction.
  • Research planning. Graduate students justify how many participants they plan to recruit by showing the sample size their target margin needs.

How to use it

  1. Choose whether you're estimating a proportion (a percentage of yes answers) or a mean (an average measurement).
  2. For a proportion, enter the margin of error in percentage points and your best guess of the proportion. If you have no idea, leave it at 50%. For a mean, enter the margin in the measurement's own units, plus a guess of the standard deviation (how spread out the values are).
  3. If you're sampling from a small, known group, enter its size.
  4. Choose the confidence level. Then read the sample size you need, which is always rounded up.

What the inputs mean

Margin of error
How close your result should be to the true value, in percentage points.
Expected proportion
If you expect around 20% to say yes, entering 20% lowers the sample you need. If you're unsure, 50% is the safe choice, because it gives the largest number.
Expected standard deviation
The sample size for a mean depends a lot on this. Take it from a small trial run (a pilot study), earlier data or published figures. If you only know the likely range of values, range ÷ 4 is a rough, cautious guess.
Population size (optional)
This only matters when your sample would be a noticeable share of the whole group, such as 300 out of 1,000 members. For large groups, leave it blank.
Custom confidence level
Between 50% and 99.99%.

Formula and method

Proportion:  n₀ = z*² × p(1 − p) ÷ E²
Mean:  n₀ = (z* × σ ÷ E)²
Finite population of N:  n = n₀ ÷ (1 + (n₀ − 1) ÷ N)
Final answer:  round n up to the next whole number

In the formulas, n₀ is the sample size for a very large group, and n is the size after adjusting for a group of N people. z* is a number set by your confidence level: about 1.96 for 95%. p is the share you expect, E is your margin of error and σ (sigma) is the standard deviation.

Both formulas come from turning the margin-of-error formula around. The margin of error is z* times the standard error, a measure of how much results bounce around from sample to sample. The standard error shrinks with √n, the square root of the sample size. So the size you need grows with the square of z* and falls with the square of the margin. That's why halving the margin needs four times as many responses.

The finite population correction reflects a simple idea. When you sample a large share of a small group, there's less room for error. The result is always rounded up, because rounding down would give a margin a little bigger than you asked for.

Worked example

You want to estimate the share of customers who are satisfied, to within ±5 percentage points at 95% confidence, with no earlier estimate to go on.

  1. The z value for 95% confidence: z* ≈ 1.96.
  2. With p = 0.5 and E = 0.05: n₀ = 1.96² × 0.5 × 0.5 ÷ 0.05² ≈ 384.1459.
  3. Round up: 385 responses.
  4. If you have only 1,000 customers in total: 384.1459 ÷ (1 + 383.1459 ÷ 1,000) ≈ 277.733, which rounds up to 278.
  5. For a mean with σ = 15 and a margin of ±5: (1.96 × 15 ÷ 5)² ≈ 34.5728, so 35 measurements.

Result: You need 385 responses, or 278 if the whole customer base is 1,000.

Understanding the result

The result is the number of finished, usable responses, not the number of people you invite. If you expect 20% of people to respond, you'd need to contact about five times as many.

If you plan to report results for smaller groups, such as each region, each one needs a big enough sample of its own. So the total grows quickly.

The sample size only delivers your margin if the assumptions below hold. A bigger sample doesn't fix a biased one, for example one where the people who answer differ from those who don't.

Assumptions and limitations

  • Responses come from a simple random sample, and each one is independent of the others.
  • It relies on the bell-curve (normal) approximation. That's reasonable for the sample sizes this formula usually gives.
  • For a mean, the standard deviation you enter is close to the real one. If you guess too low, your real margin will be wider than planned.
  • For a mean, the formula uses z rather than t (a version for small samples). For small results, below about 30, a t-based calculation would ask for a few more measurements.
  • It sizes a study to estimate one number with a given precision. Sizing a study to detect a difference between groups, with a given power, is a different calculation.
  • Clustered, stratified or weighted designs (sampling in groups or layers, or weighting answers) usually need more responses than this formula shows. That extra need is called the design effect.
  • People who don't respond or drop out aren't included. Add extra on top of the result to cover them.

Frequently asked questions

Why is 385 such a common answer?

It's the sample size for a ±5% margin at 95% confidence when you assume 50%, the most cautious guess. Once a group is large, its size barely matters. So the same 385 works for a city or a whole country.

Does a bigger population need a bigger sample?

Only up to a point. Below a few thousand, the finite population correction lowers the number noticeably. Beyond tens of thousands, the answer hardly changes. Precision depends on how many responses you get, not on what share of the group you sample.

What if I don't know the standard deviation for a mean?

Use results from a small trial run, earlier research on similar people, or a rough guess of range ÷ 4. It's better to guess a little high. Guessing high costs some extra responses, while guessing low leaves you with a wider margin than you planned.

Why does halving the margin quadruple the sample?

The margin of error shrinks with the square root of the sample size. To make it half as big, √n has to double. That means n itself must be four times as big.

How this calculator is checked

Method: Standard sample size formulas for estimating a proportion (z²p(1 − p)/E²) and a mean ((zσ/E)²), obtained by solving the normal-approximation margin of error for n, with the usual finite population adjustment n₀/(1 + (n₀ − 1)/N). The calculation is covered by automated tests with known reference values and edge cases. Last updated 2026-10-18. Found a problem? Tell us.

Embed this calculator

Put this Sample Size Calculator on your own website or blog for free. Paste this code where you want it to appear: