Statistics & Probability · Formula v1.0

Sample Size Calculator

Calculate the sample size needed for a target margin of error and confidence level.

Smaller margins of error require disproportionately larger samples. Enter desired margin of error in percent and estimated population proportion in percent (5 means 5%). At the worked-example inputs, the required sample size is 385. The result is the number of responses needed to estimate a proportion within the chosen margin. On the example, a 5% margin at 95% confidence with an unknown proportion needs about 385 responses, the figure behind many polls. Halving the margin of error quadruples the sample size, so precision gets expensive. Add extra for the expected nonresponse rate and for subgroups you want to analyze separately. It returns required sample size, z-value used.

FreeNo sign-upInputs stay in-browserCSV exportReviewed August 28, 2026
LAST REVIEWEDAugust 28, 2026Inputs stay in your browser
Live calculation

Enter your numbers

Calculated result
Required sample size385
Z-value used2
Sensitivity check

What if desired margin of error changes?

-10% input475
0% input385
+10% input318

Transparent method

The formula

n = (z² × p × (1−p)) ÷ marginOfError²

Worked example

Required sample size385
Z-value used2

Example inputs

Desired margin of error5.0%
Confidence level95%
Estimated population proportion50.0%

How to interpret the result

Cutting a margin of error in half doesn't double the sample size needed: it roughly quadruples it, because required sample size scales with the square of how tight the margin needs to be. A survey aiming for a very precise result can need dramatically more respondents than one accepting a looser estimate, out of proportion to how much tighter the target actually is.

Before you rely on it

What to check

Check the relationship between your target margin and the resulting sample size before committing to a survey budget: small precision gains get expensive fast.

The common error

Where people go wrong with sample size calculator

Assuming sample size scales in a straight line with precision. Wanting a margin of error half as wide isn't a modest ask; it's close to a fourfold increase in the respondents needed.

Sensitivity evidence

How desired margin of error changes the required sample size

Sample Size Calculator: required sample size and z-value used across a range of desired margin of error, every other input held at the worked-example value.
Desired margin of errorRequired sample sizeZ-value used
3.0%1,0682
4.0%6012
5.0%worked example3852
6.0%2672
7.0%1962

Every input, tested

Which input moves the required sample size most

Sample Size Calculator: required sample size with each input moved on its own, every other input held at the worked-example value.
InputTested fromToRequired sample size at each endSwing
Confidence level90%99%271 to 664393 (102%)
Desired margin of error4.0%6.0%601 to 267334 (87%)
Estimated population proportion48.0%52.0%384 to 384none

Two variables at once

Required sample size by desired margin of error and estimated population proportion

Sample Size Calculator: required sample size at each combination of desired margin of error (rows) and estimated population proportion (columns).
Desired margin of error \ Estimated population proportion46.0%50.0%54.0%
3.0%1,0611,0681,061
4.0%597601597
5.0%382385382
6.0%266267266
7.0%195196195

Step by step

The worked example, input by input

Worked-example inputs and the results they produce for the sample size calculator.
InputValue usedWhat it means
Desired margin of error5.0%
Confidence level95%How confident the result should be.
Estimated population proportion50.0%
Required sample size385
Z-value used2

Inputs, definitions and assumptions

Desired margin of error

Confidence level

How confident the result should be.

Estimated population proportion

Where the inputs come from

Enter the desired margin of error as a percentage, the z value for your confidence level, 1.96 for 95%, and the expected proportion, which is 50% when you have no idea, since that gives the largest sample. Use this for surveys where you are estimating a percentage. A smaller margin of error or higher confidence increases the required sample. The population size matters only when the sample is a large share of it.

When the result stops applying

The calculation assumes a random sample and ignores bias from who responds. If the population is small, a correction reduces the needed sample. Surveys of means rather than proportions need a different formula. Statistical power for comparing groups requires another calculation.

What to compare it with

See the interval that results on the confidence interval calculator, the normal distribution on the z-score and normal probability pages, and testing on the p-value calculator. The binomial probability page covers success counts, and the percentage calculator helps with reporting.

People also ask

Frequently asked questions

Why does the sample size stop growing with the population?

Because the precision of a random sample depends mainly on its size, not on the population size, unless the sample is a large fraction of it.

What proportion should I use if I do not know it?

Use 50%, which gives the largest and therefore most conservative sample size, so your survey will be precise enough whatever the true proportion turns out to be.

How do I reduce the margin of error?

Increase the sample size. Cutting the margin of error in half requires four times as many responses, so precision gets expensive quickly.

Common statistics & probability questions

Sources and evidence