Sample Size Calculator
Decide how many people to ask before you collect a proportion — a yes/no, a vote share, a defect rate. This is a planning formula, not an analysis of a list you already have.
Updated
How to use
- Choose a confidence level. 95% is the usual poll default; 90% shrinks n and 99% grows it.
- Set the margin of error in percentage points (5 means ±5 points, not 5% of the population).
- Enter an expected proportion. Use 50 if you have no better guess — that is the most conservative p.
- Leave population blank for a large group. Fill N only when the group is small enough that sampling without replacement should shrink n.
How it works
Sample size is a design choice. You have not yet knocked on doors or opened the survey; you are asking how many completed answers Cochran’s formula wants so that a single proportion can be estimated to a chosen precision. The formula is n = z² p (1 − p) / E², then rounded up to the next whole person. It is not a descriptive summary of pasted numbers, and it is not a confidence interval for a mean. Those belong on other pages, after the data exist.
p is the expected proportion on a 0–1 scale (the field is a percentage: 50 means 0.5). p(1 − p) peaks at one half, so n is largest when you type 50%. That is why pollsters use 50% when they refuse to guess the outcome — the plan stays conservative. If you already know the outcome is rare, say 10%, n drops, but you are betting on that guess. E is the margin as a decimal (5% → 0.05). It is plus-or-minus around the estimated percentage, not a percentage of the population size and not a relative error.
z is the two-sided normal quantile for the confidence level (about 1.96 at 95%). The same z family appears on the confidence-interval page, but that page analyses a finished sample mean. Here the z only scales how many observations you should collect. A typical opinion-poll plan — 95% confidence, p = 50%, E = 5% — needs 385 completed answers when the population is treated as infinite.
If you type a finite population N (an integer of at least 2), the page applies the finite-population correction n′ = n / (1 + (n − 1) / N) and then rounds up. Leave N blank when the group is huge or unknown; the correction barely moves n once N is many times larger than the uncorrected sample. N smaller than 2 is rejected.
This is not a power calculation for a clinical trial, an A/B test or a difference of two means. Those need an effect size, two groups and a different formula. It is also not a tool for analysing a list you already collected — paste that list into the statistics or mean-median pages instead.
Formula
n = z² p (1 − p) / E² n′ = n / (1 + (n − 1) / N) (optional FPC) Then round up.
Worked examples
A typical opinion poll
95% confidence, p = 50%, E = 5% → 385
Useful notes
- This is not a power calculation for a clinical trial or an A/B test.
- z values are two-sided standard-normal quantiles.
- The result is a planned n. It does not summarise data you have already collected.
FAQ
- Why use 50% for the proportion?
p(1−p) is largest at 0.5, so the sample size is conservative when you do not know the outcome rate.
- What does the margin of error mean?
It is the plus-or-minus around the estimated percentage, not a percentage of the population size.
- When do I fill in population?
When the group is small enough that sampling without replacement shrinks the needed n. Leave it blank for a large or unknown population.
- Can I paste my collected answers here to see if n was large enough?
No. This page only plans n from a confidence level, a margin and an expected proportion. Analyse a finished list on the statistics or confidence-interval calculators.
- Why is the result rounded up?
You cannot interview a fraction of a person. Cochran’s n is ceiled so the margin you asked for is not undershot by truncation.
Related tools
Confidence Interval
Build a z-interval for a mean from x̄, a standard deviation, n and a confidence level.
Z-score Calculator
Convert a value to a z-score, or a z-score back to the original scale, given a mean and standard deviation.
Probability Calculator
Combine two event probabilities as independent, mutually exclusive, or overlapping, plus complements and “at least one”.
See all Statistics tools.