Enter the margin of error you can accept and a confidence level to get the minimum sample size for a survey percentage or for a mean. Add the population size if it is small, and the calculator applies the finite population correction and shows every step.
Show the working, step by step
Critical z for 95% confidence (two-sided).
z = 1.96
The margin of error for a proportion is z·√(p(1 − p)/n). Solve for n.
n = z² · p(1 − p) ÷ E² n = 1.96² × 0.5 × 0.5 ÷ 0.05² = 384.15
Round up — a fraction of a respondent cannot be surveyed, and rounding down would miss the target margin.
n = 385
p = 0.5 is the conservative choice: it maximises p(1 − p), so the sample is large enough whatever the true proportion turns out to be.
The sample size formula
There are two formulas, depending on what you are estimating. Both come from turning the margin of error of a confidence interval inside out: instead of asking "how wide is the interval for this n?", they ask "what n makes the interval this wide?".
For a proportion — a survey question answered yes or no, a conversion rate, a defect rate:
n = z² × p(1 − p) ÷ E²
With the defaults — p = 0.5, a margin of ±0.05 and 95% confidence — that is 1.96² × 0.5 × 0.5 ÷ 0.05² = 3.8415 × 0.25 ÷ 0.0025 = 384.15, which rounds up to 385. This is the figure behind the familiar "about 400 respondents" that most published polls quote.
For a mean — a measurement on a continuous scale such as a weight, a score or a response time:
n = (z × σ ÷ E)²
With σ = 15 and a margin of ±3 at 95%, that is (1.96 × 15 ÷ 3)² = 9.8² = 96.04, which rounds up to 97. An IQ-style scale with a standard deviation of 15 needs 97 people to pin the mean down to within three points.
Where each input comes from
z is fixed by the confidence level: 1.645 for 90%, 1.960 for 95% and 2.576 for 99%. It is the number of standard errors either side of the estimate that the confidence interval will reach, taken from the standard normal distribution — the same values a z-score table gives for the two-tailed cut-offs. Sample size calculations use z rather than t even for a mean, because t depends on n and n is what you are solving for.
E, the margin of error, is your decision. It is half the width of the confidence interval you are prepared to report. For a proportion it is expressed as a fraction — enter 0.05 for ±5 percentage points, 0.03 for ±3. For a mean it is in the same units as the measurement.
p is the proportion you expect to find. If you have no idea, and often even if you do, use 0.5. The term p(1 − p) is at its maximum of 0.25 there, so p = 0.5 gives the largest sample the formula can ask for and is therefore safe whatever the true value: if the real proportion turns out to be 0.3, a sample sized for 0.5 delivers a margin narrower than requested, never wider. Sizing for 0.3 instead would bring n down to 323, but only if that guess is right.
σ is the awkward one, because you need the population's standard deviation before you have collected the data. Three sources, in order of preference: a pilot study, whose SD you can compute with the standard deviation calculator; a published SD from an earlier study of the same measurement; or, as a last resort, the plausible range of values divided by four, which relies on nearly all of a roughly normal distribution falling within two standard deviations of the mean. If the pilot SD is uncertain, err on the high side — the formula squares it, so an underestimate of σ by 20% leaves you with a sample a third too small.
The finite population correction
Both formulas assume the population is effectively infinite, which is fine for a country or a customer base of millions. When the population is small — a company's staff, a school, a batch of parts — sampling a meaningful fraction of it reduces the uncertainty, and the required sample falls:
n′ = n ÷ (1 + (n − 1) ÷ N)
Applied to the 384.15 from the proportion example with N = 1,000: 384.15 ÷ (1 + 383.15 ÷ 1,000) = 277.73, rounded up to 278. The calculator applies the correction to the unrounded n and rounds once at the end, so the result is never inflated by rounding twice.
It matters only when N is under about twenty times the uncorrected n. For the ±5% survey that threshold is a population of roughly 7,700; at N = 10,000 the correction takes n from 385 to 370, and at N = 100,000 to 383. Above that, leave the field blank.
Why the answer is rounded up
The unrounded value is the exact n at which the margin of error equals E. One respondent fewer and the margin creeps above the target. So 384.15 has to become 385, even though 384 is the nearer whole number: the question is not "which integer is closest?" but "which is the smallest integer that keeps the margin inside E?". The grid shows both the unrounded figure and the rounded one so you can see how close to the boundary you are.
How the inputs trade off
The formulas square E and z, and that shapes every decision about a study's size.
- Halving the margin of error quadruples the sample. Going from ±5% to ±2.5% takes n from 385 to 1,537. Precision is expensive, and it gets more expensive the more you already have.
- Moving from 95% to 99% confidence adds about 73%. The z values are 1.960 and 2.576, and (2.576 ÷ 1.960)² = 1.727. Dropping to 90% cuts the sample by about 30%.
- Doubling σ quadruples n. A noisy measurement needs four times the data of one that is half as variable — which is why tightening the measurement procedure is often cheaper than recruiting.
For a proportion at p = 0.5 and 95% confidence, the sample needed for each common margin of error is:
| Margin of error | Unrounded n | Sample size |
|---|---|---|
| ±1% | 9,603.65 | 9,604 |
| ±2% | 2,400.91 | 2,401 |
| ±3% | 1,067.07 | 1,068 |
| ±5% | 384.15 | 385 |
| ±10% | 96.04 | 97 |
The ±3% row is why national opinion polls settle around a thousand respondents, and the ±1% row is why almost nobody pays for a single point.
Sample size, standard error and the confidence interval
The three are one calculation seen from different angles. The standard error of a mean is σ ÷ √n; of a proportion it is √(p(1 − p) ÷ n). Multiply by z and you have the margin of error; centre it on the estimate and you have the confidence interval. This page runs that chain backwards from the margin you want to the n that delivers it.
That also tells you what to check once the data are in. Collect the 97 measurements from the mean example, compute their actual standard deviation, and build the interval. If the sample SD came out at 18 rather than the assumed 15, the margin will be about ±3.6 instead of ±3 — a shortfall the calculator's "E as a fraction of σ" cell lets you anticipate before committing to a study.
What this calculator does not do
It sizes a sample for estimation: how many observations to describe a proportion or a mean to a given precision. It does not size a sample for a hypothesis test, where the question is how many observations per group are needed to detect an effect of a given size with a given probability. That is a power analysis, and it depends on the effect size, the significance level and the target power, typically 80%. A two-group t-test looking for a difference of half a standard deviation needs about 64 per group at 80% power — a different number, from a different question. Use this page for surveys and descriptive studies; use a power calculation when the aim is to reject a null hypothesis.
Related calculators
-
Confidence interval
The interval a sample of this size will produce.
-
Standard error
How the sample size controls the precision of a mean.
-
Standard deviation calculator
Get the σ this calculator needs from pilot data.
-
Z-score calculator
Where the 1.96 comes from.
Common questions
How do I calculate sample size for a survey?
Decide how precise the headline percentage needs to be (the margin of error, E), pick a
confidence level (95% is the convention, giving z = 1.96), and use
n = z² × p(1 − p) ÷ E² with p = 0.5. For ±5% at 95% that is
1.96² × 0.25 ÷ 0.05² = 384.15, which rounds up to 385 responses.
That is completed responses, not invitations. If you expect a 20% response rate, invite about five times as many people.
Why does the calculator use p = 0.5?
Because p(1 − p) is largest when p = 0.5, so the sample size it produces is the largest the formula can give. Whatever the true proportion turns out to be, a sample sized for p = 0.5 will hit the target margin of error. If you have good evidence that the proportion is far from 50% — say 10% — you can enter that instead and the required n falls, but a wrong guess in the other direction leaves you short.
Does population size matter?
Rarely. For a population of a million, a national poll and a survey of a large city need the same 385 respondents for ±5%. The finite population correction only bites when the population is small relative to the sample — roughly when N is less than about 20 times n. Surveying a company of 1,000 staff to ±5% needs 278 responses rather than 385; a department of 100 needs 80.
What is the minimum sample size?
There is no universal minimum — it depends entirely on the precision you need. The number people half-remember, 30, is the point at which the sampling distribution of a mean is usually close enough to normal for z and t methods to behave, not a sample size that guarantees a useful margin of error. Thirty respondents to a yes/no question at 95% confidence gives a margin of error of about ±18 percentage points.
Why is the result always rounded up?
The unrounded value is the smallest n that achieves the margin of error exactly. Any n below it — including the value rounded down — gives a margin slightly wider than you asked for. Since a fraction of a respondent cannot be surveyed, the next whole number up is the smallest sample that keeps the promise. 384.15 becomes 385, not 384.
Is this the same as a power calculation?
No. This calculator sizes a sample to estimate a proportion or a mean to a given precision. A power analysis sizes a sample to detect a difference in a hypothesis test — it needs an effect size, a significance level and a target power (usually 80%), and the answer is per group. The two can differ considerably for the same study, so use the one that matches your question.