Sample Size Calculator
Find the survey sample size for a target margin of error.
Results update as you type.
About this calculator
This sample size calculator finds how many people you need to survey for a chosen margin of error and confidence level — the planning step before you run a poll or study. It uses the standard formula n = z²·p(1 − p) / e², where z is the critical value for the confidence level, p the expected proportion and e the target margin of error as a decimal.
When you supply a total population size it also applies a finite-population correction, n = n₀ / (1 + (n₀ − 1)/N), which lowers the required sample when you are surveying a large fraction of a small group. A table shows the sample needed at several common margins of error, and the result is always rounded up because you cannot survey a fraction of a person.
Worked example: for a 5% margin at 95% confidence with an unknown proportion (p = 0.5), n = 1.96² × 0.5 × 0.5 ÷ 0.05² = 3.8416 × 0.25 ÷ 0.0025 ≈ 384.16, so you need 385 respondents. Tightening the margin to 3% pushes that to about 1,068. The default 50% proportion gives the largest, safest sample; entering a better estimate of the true proportion reduces it.
Frequently asked questions
How is sample size calculated?
The base formula is n = z²·p(1 − p) / e², where z is the confidence critical value, p the expected proportion and e the margin of error as a decimal. The result is rounded up because you cannot survey a fraction of a person.
What is the finite population correction?
When your population is small, you need fewer responses than the base formula suggests. The correction n = n₀ / (1 + (n₀ − 1)/N) shrinks the sample toward the population size N. It matters most when the sample is a large fraction of the whole.
How many people do I need for a 95% confidence level?
It depends on the margin of error you can accept. At 95% confidence with a 5% margin and no prior estimate you need about 385 respondents; a 3% margin needs about 1,068 and a 1% margin about 9,604.
Why is the sample size rounded up?
You cannot survey part of a person, so any fractional result is rounded up to the next whole number. Rounding up rather than down guarantees the margin of error is no larger than your target.
Should I leave the population size blank?
Leave it at zero (or blank) when the population is very large or unknown, which gives the standard "infinite population" sample size. Enter a real population only when it is small enough that the correction meaningfully reduces the sample.
How can I reduce the required sample size?
Accept a larger margin of error, use a lower confidence level, or supply a proportion further from 50% if you have a reliable estimate. Each of these lowers the number of responses the formula demands.
API — use this calculator from code
Call this calculator as a free JSON endpoint — no key required. Send the field values below as query parameters or JSON. Read the full API docs →
Endpoint
GET https://calculator.free/api/v1/sample-size/
curl
curl "https://calculator.free/api/v1/sample-size/?conf=1.96&e=5"
JavaScript fetch()
const r = await fetch(
"https://calculator.free/api/v1/sample-size/?" + new URLSearchParams({
"conf": "1.96",
"e": "5"
}));
const data = await r.json();
console.log(data.results);
Results are estimates for general guidance only, not financial, medical or tax advice.