Sample Size Calculator
Find how many completed responses a survey or study needs. Choose the confidence level and the margin of error for a proportion (Cochran's formula, with optional finite population correction and response rate) or for a mean (known σ with z, or the exact t-based size), or turn the question around and get the margin of error a given sample size delivers.
Sample size explained · Margin of error calculator · Margin of error vs confidence interval · A/B test sample size
Related Calculators
Margin of Error Calculator
Measure sampling error for proportions and means at common confidence levels.
Confidence Interval Calculator
Build a z confidence interval for a population mean at 90%, 95%, or 99% confidence.
Systematic Sampling Calculator
Find the sampling interval k, draw a random start, and list every selected position or item from your list.
Learn More
Sample Size Explained: How Many Responses Do You Need?
Sample size formulas for a proportion and a mean, the finite population correction, an adjustment for dropout and a lookup table for margins of error, with worked examples.
Confidence Intervals
Understand what a confidence interval really claims, how the margin of error is built, when to use z versus t, and how sample size controls precision.
What decides the sample size
Four choices set the number of respondents a survey needs: how precise the answer must be (the margin of error), how sure you want to be (the confidence level), how variable the answers are (the expected proportion, or the standard deviation of a measurement) and, only for a small population, how many units the population holds. Precision is expensive: because the margin shrinks with the square root of n, halving it takes four times the respondents.
The result is a minimum number of completed responses from a simple random sample. Non-response, clusters and unequal weights all raise the number you have to collect, as the sections below show.
Sample size formulas
Proportion (Cochran): n₀ = z² × p(1 − p) / e²
Finite population of N units: n = n₀ / (1 + (n₀ − 1) / N)
Mean, σ known: n = (z × σ / E)²
Mean, σ estimated: the smallest n with n ≥ (t × s / E)², t having n − 1 degrees of freedom
Invitations needed: completed responses n / response rate
Here e is the margin of error as a proportion (0.05 for ±5%), E the margin in the units of the measurement, p the expected proportion, and z the critical value for the confidence level: 1.6449 for 90%, 1.9600 for 95% and 2.5758 for 99%. Always round the result up, because the size is a minimum. Without a prior estimate of p use 50%, which maximises p(1 − p) and so guarantees at least the chosen precision whatever the true value.
This calculator uses the exact z value (1.959964 at 95%) rather than the rounded 1.96, so its unrounded n₀ for the default survey is 384.1459 where a textbook that rounds z gets 384.16. Both round up to 385.
How to use this calculator
- Pick the calculation mode: a proportion (yes/no or percentage answers), a mean with a known σ, a mean whose σ is estimated (uses t), or the margin of error you get from a fixed sample size.
- Choose the confidence level and the margin of error. For a proportion type the margin in percentage points (5 for ±5%); for a mean use the units of the measurement.
- Enter the expected proportion (leave 50 if unsure) or the standard deviation of a mean from a pilot study or earlier research.
- Optionally add the population size, if the population is small and known, and the expected response rate to see how many people to invite.
- Press Calculate Sample Size. Use Copy link to this calculation to share the inputs.
Worked example: a survey of a large population
A 95% confidence level, a margin of ±5 percentage points and no prior estimate of the proportion (p = 50%).
n₀ = 1.959964² × 0.5 × 0.5 / 0.05²
n₀ = 3.841459 × 0.25 / 0.0025 = 384.1459
Round up: n = 385 completed responses
Those 385 respondents deliver a margin of ±4.99 points, just under the 5 that was asked for. For ±3 points the same formula gives n₀ = 1,067.07, so 1,068 responses.
Worked example: a small population
The same survey in a company of 2,000 people. The population is small enough that the sample would be a noticeable share of it, so the finite population correction applies:
n = 384.1459 / (1 + (384.1459 − 1) / 2000)
n = 384.1459 / 1.191573 = 322.3855
Round up: n = 323 completed responses
The correction saves 62 interviews. In a group of only 100 people, 80 responses are enough for the same precision. The smaller the population, the more the correction matters; for a large population it changes nothing.
Worked example: allowing for non-response
You need 385 completed responses but expect only 30% of the people you contact to answer. Invite 385 ÷ 0.30 = 1,283.33, that is 1,284 people. Enter the response rate in the optional field to see this in the results. More invitations do not cure non-response bias: if the people who answer differ from those who do not, the estimate is off by more than the margin of error suggests.
Worked example: estimating a mean
Suppose the standard deviation of a measurement is about σ = 10 and you want a 95% margin of ±2 units.
With z (σ known): n = (1.959964 × 10 / 2)² = 96.0365, so 97
With t (σ estimated): the smallest n with n ≥ (t × 10 / 2)²
n = 98: t = 1.984723, (1.984723 × 5)² = 98.478 > 98, not enough
n = 99: t = 1.984467, (1.984467 × 5)² = 98.453 ≤ 99, enough
The t-based size is 99, two more than the z-based 97, because t is larger than z for a finite sample. The multiplier itself depends on n, so the calculator searches upward from the z-based size for the smallest n that satisfies the inequality, rather than iterating on rounded values. The search is exact up to sample sizes of 100,000; beyond that the t multiplier and z differ by so little that the known-σ mode should be used.
Sample size by margin of error and confidence level
Simple random sample, large population, expected proportion 50%:
| Margin of error | 90% confidence | 95% confidence | 99% confidence |
|---|---|---|---|
| ±1% | 6,764 | 9,604 | 16,588 |
| ±2% | 1,691 | 2,401 | 4,147 |
| ±3% | 752 | 1,068 | 1,844 |
| ±4% | 423 | 601 | 1,037 |
| ±5% | 271 | 385 | 664 |
| ±10% | 68 | 97 | 166 |
The numbers grow with 1/e²: going from ±5% to ±1% multiplies the sample size by 25. About 1,070 respondents give ±3% at 95% confidence, the precision of a typical national poll, and ±2% needs 2,401.
Sample size by population size
95% confidence, ±5% margin, expected proportion 50%:
| Population size N | Required sample size |
|---|---|
| 100 | 80 |
| 500 | 218 |
| 1,000 | 278 |
| 2,000 | 323 |
| 5,000 | 357 |
| 10,000 | 370 |
| 100,000 | 383 |
| 1,000,000 | 384 |
Once the population is above a few tens of thousands its size no longer matters: 383 respondents for 100,000 people and 384 for a million. The sample size depends on precision, not on how large the population is.
Sample size by expected proportion
95% confidence, ±5% margin. The size depends on p(1 − p), so p and 100% − p need the same sample:
| Expected proportion | Required sample size |
|---|---|
| 50% | 385 |
| 40% or 60% | 369 |
| 30% or 70% | 323 |
| 20% or 80% | 246 |
| 10% or 90% | 139 |
| 5% or 95% | 73 |
| 1% or 99% | 16 |
If earlier research tells you the answer is near 10% or 90%, you can survey 139 people instead of 385. If you assume 10% and the true value is 40%, the sample is too small for the margin you wanted, whereas assuming 50% can only make the survey larger than necessary, so use it when in doubt. For rare outcomes a margin of ±5 points is very wide compared with p itself, so choose the margin relative to p and check that both n × p and n × (1 − p) are at least 10, or use the Wilson interval of the proportion confidence interval calculator afterwards.
When the simple formula is not enough
- Clusters and weights. Cluster sampling, stratification with unequal weights and other complex designs need a larger sample. Multiply n₀ by the design effect and round up: with a design effect of 1.5, the default 384.1459 becomes 576.2, so 577 responses.
- Subgroups. The margin applies to the group you measure. If you will report on four regions separately and want ±5% in each, you need 385 in each region, not 385 overall.
- Non-response. Divide by the response rate, as in the example above, and try to learn how responders differ from non-responders.
- Hypothesis tests. This page sizes a study for the precision of an estimate. When the goal is to detect a difference with a chosen power, use the A/B test sample size calculator or the statistical power calculator.
- Check the outcome. The margin of error calculator turns the responses you actually obtained into the interval you can report, and the confidence interval calculator builds it around a mean.
Sample size in Excel, R and Python
| Tool | Proportion: 95%, ±5%, p = 50% (385) | Mean: 95%, σ = 10, E = 2 (97) |
|---|---|---|
| Excel | =ROUNDUP(NORM.S.INV(0.975)^2*0.5*0.5/0.05^2,0) | =ROUNDUP((NORM.S.INV(0.975)*10/2)^2,0) |
| R | ceiling(qnorm(0.975)^2 * 0.5 * 0.5 / 0.05^2) | ceiling((qnorm(0.975) * 10 / 2)^2) |
| Python (SciPy) | math.ceil(norm.ppf(0.975) ** 2 * 0.5 * 0.5 / 0.05 ** 2) | math.ceil((norm.ppf(0.975) * 10 / 2) ** 2) |
These use the same exact z values as the calculator. The t-based mean size has no one-line spreadsheet formula because t depends on n; the calculator finds it by search. The article sample size explained walks through the reasoning behind each formula.
Frequently Asked Questions
How many people should I survey?
For a large population at 95% confidence and an expected proportion of 50%: 385 for a margin of ±5%, 1,068 for ±3%, 2,401 for ±2% and 9,604 for ±1%. The tables above list other confidence levels and margins.
Why does the calculator return 385 when the formula gives 384.16?
A sample size must be a whole number, and the formula gives a minimum, so it is always rounded up. With the exact z of 1.959964 the unrounded n₀ is 384.1459; textbooks that round z to 1.96 print 384.16. Both round up to 385.
Why is 50% the default expected proportion?
Because p(1 − p) is largest at 50%, so it gives the largest required sample. Using it guarantees at least the chosen margin of error whatever the true proportion turns out to be.
Does the population size matter?
Barely, until the sample would exceed about 5% of the population. A population of 100,000 needs 383 responses and a million needs 384, but a population of 500 needs only 218 and one of 100 needs 80.
How do I adjust for non-response?
Divide the completed responses you need by the expected response rate: 385 ÷ 0.30 = 1,284 invitations at a 30% response rate. Enter the rate in the optional field and the calculator shows the number to invite.
Can I size a mean instead of a proportion?
Yes. Use one of the mean modes with the standard deviation, taken from a pilot study or earlier research, and a margin of error in the units of the measurement.
Should I use z or t when sizing a mean?
z assumes the standard deviation is known. When it is an estimate, t with n − 1 degrees of freedom is more accurate and asks for slightly more respondents: 99 instead of 97 for σ = 10 and E = 2 at 95% confidence. For very large samples the two agree.
What is the difference between the margin of error and the confidence level?
The margin of error is the half-width of the interval, for example ±5 points. The confidence level is how often intervals built this way contain the true value, for example 95%. Asking for a smaller margin or a higher confidence level both raise the sample size.
What margin of error does my sample give?
Use the mode that computes the margin from your sample size. With 385 completed responses at 95% confidence and an answer of 50% the margin is ±4.99 percentage points.
Do I need a bigger sample to report on subgroups?
Yes. The margin applies to the group that was measured. To report ±5% for each of four regions you need about 385 respondents in each region, so about 1,540 in total.
How is a sample size for precision different from a power analysis?
This page sizes a study so that an interval is narrow enough. A power analysis sizes it so that a hypothesis test detects a difference of a stated size with a stated probability, which needs the effect size and the significance level as well.
What if my sample design is not a simple random sample?
Multiply the result by the design effect of your design and round up. A design effect of 1.5, typical for clustered or heavily weighted samples, turns 385 into 577.
Embed This Calculator
Add this free calculator to your course page or LMS.
Adjust the height value to fit your page.