Math · Statistics
Sample size and margin of error calculator.
How many responses do you need for a survey, or how accurate are the ones you have? Choose a mode, confidence level and expected proportion. Everything runs in your browser.
At 95% confidence, a 5% margin of error and the worst-case 50% proportion you need 385 responses from a large population: 1.962 × 0.5 × 0.5 / 0.052 = 384.16, rounded up. In a population of 1,000 the finite-population correction cuts that to 278.
Inputs
Your result
Fill the form and press Calculate.
The formula
For a yes/no survey question, the standard error of a sample proportion p is √(p(1−p)/n). To keep the error within a margin e at a chosen confidence level, set e = z × √(p(1−p)/n) and solve for n:
n0 = z2 × p(1−p) / e2
This is Cochran's sample-size formula for a proportion. The critical values z come from the standard normal distribution: 1.645 for 90%, 1.960 for 95% and 2.576 for 99% (two-sided). The result is always rounded up.
Finite population. If you sample a meaningful share of a known population of size N without replacement, the variance shrinks by (N−n)/(N−1). Solving again gives n = N × n0 / (N − 1 + n0). For the margin of error from a given sample, e = z × √(p(1−p)/n) × √((N−n)/(N−1)).
Worked example
You want 95% confidence and a 5% margin of error, and you have no idea of the true proportion, so use p = 0.5. n0 = 1.962 × 0.25 / 0.052 = 3.8416 × 0.25 / 0.0025 = 384.16, so you need 385 responses. If the population is 1,000 people, n = 1,000 × 384.16 / (999 + 384.16) = 277.7, so 278. At 90% confidence the same target needs 271 and at 99% it needs 664 (large population).
Limits of this calculator
It assumes a simple random sample and a large-sample normal approximation, so it is a planning estimate, not a guarantee. It does not adjust for non-response, clustering, weighting or very small or very extreme proportions (below about 5% or above 95%), where an exact or Wilson interval is better. For means of measured quantities you need the standard deviation instead of p(1−p).
Sources, read 1 October 2026: NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.6.7.1 normal distribution critical values (1.645, 1.960, 2.576); 7.2.2.2 sample sizes required (N ≥ (z/δ)2σ2); 7.2.4 proportion defective (standard error of a proportion). The finite-population step is algebra on the variance factor and is not taken from NIST. For summary statistics of your results, try the statistics calculator.
Frequently asked questions
Why is 385 the usual survey sample size?
It is the answer for 95% confidence, a 5% margin of error and p = 50%, rounded up from 384.16. Fifty percent maximises p(1−p), so it is the safe default.
Does the population size matter?
Only when the sample is a sizeable share of it. For populations in the tens of thousands the answer barely moves from the large-population figure. For small populations the correction can cut the sample a lot.
What does the margin of error mean?
It is the half-width of the confidence interval. If 52% of 385 respondents say yes at 95% confidence, the true share is estimated at roughly 52% plus or minus 5 points, assuming a random sample.
How do I halve the margin of error?
Quadruple the sample. The margin falls with the square root of n, so going from 5% to 2.5% takes about 1,537 responses instead of 385.
Planning estimate only
Results assume a simple random sample and a normal approximation. Non-response, bias and survey design can matter more than sample size, so treat the number as a minimum.