Use this sample size calculator to find how many people, items or responses you need before you start collecting data. Choose a proportion or a mean, pick a confidence level and a margin of error, and the calculator returns the required sample size, rounded up to the next whole person, with every calculation shown step by step.
Planning a survey or an experiment starts with one question: how large must my sample be? Too small a sample leaves a wide margin of error, and too large a sample wastes time and money. This calculator answers that question for the two cases that cover almost every study — estimating a proportion, such as the share of voters who support a policy, and estimating a mean, such as average test score or average income.
How this page differs from the margin of error calculator: our margin of error calculator has a sample-size mode, but that mode only reverse-solves a sample size from a margin of error. This page is a dedicated sample size calculator: it covers both a proportion and a mean, adds a finite population correction for small populations, and includes a margin-of-error versus sample-size table so you can see the trade-off before you choose.
Enter your details
Required sample size
people — for a proportion at 95% confidence
Calculation
Margin of error ↔ sample size
The same settings, with a different margin of error. The highlighted row is your current choice.
| Margin of error | n (unrounded) | Required n | Relative size |
|---|
How to calculate sample size
Three ingredients decide the answer: the confidence level, the margin of error you will accept, and how much the thing you are measuring varies. The calculator above combines them; the formulas below show exactly what it does. For the full step-by-step method, see our guide on how to calculate sample size.
Sample size for a proportion
When you are estimating a percentage — the share of customers who would buy, voters who support a policy, or patients who respond to treatment — use:
n = z² · p(1 − p) / E²
Here z is the critical value for your confidence level (1.96 at 95%), p is the proportion you expect, and E is the margin of error as a decimal. The result is always rounded up: a calculation of 384.16 people means you need 385 people, because 384 people would leave the margin slightly wider than you asked for.
Sample size for a mean
When you are estimating an average — mean test score, mean income, mean weight — the variation is measured by the population standard deviation σ, and the formula is:
n = (z · σ / E)²
Here E is in the same units as σ. A mean with σ = 10 and a margin of error of 2 points needs n = (1.96 × 10 / 2)² = 96.04, so 97 people. The standard error of your estimate then falls as the square root of n grows — which is why doubling the sample does not halve the error.
Common critical values
| Confidence level | z* |
|---|---|
| 90% | 1.645 |
| 95% | 1.96 |
| 99% | 2.576 |
| 99.9% | 3.291 |
Raising the confidence level from 95% to 99% increases the sample by about 73%, because 2.576² / 1.96² is about 1.73. Confidence is not free.
Why is the sample size for a 95% survey often 385?
It is not a magic number — it is what the proportion formula gives for the most common survey settings: 95% confidence (z = 1.96), a margin of error of 5 percentage points (E = 0.05), and p = 0.5, the conservative default. That gives n = 1.96² × 0.25 / 0.05² = 384.16, rounded up to 385. Change any ingredient and 385 changes: with the same settings but a 3% margin and p = 0.30, the answer is n = 896.37, rounded up to 897. Whenever you see 385 quoted, those three settings are hiding behind it.
Why does halving the margin of error need four times the sample?
Because the margin of error sits squared in the denominator of the sample-size formula. The sample size is proportional to 1 / E², so if you halve E, you divide by (1/2)² = 1/4 — in other words, you multiply the sample by 4. With p = 0.5 at 95% confidence, halving the margin from 5% to 2.5% takes n from 384.16 to 1,536.64, exactly four times as large before rounding. The same rule applies to a mean. That is why researchers agree the margin of error first and cost it: going from ±5% to ±2.5% costs four times as many responses, and going to ±1.25% costs sixteen times as many.
When should you use the finite population correction?
Use it when the population you are sampling from is small and known — a company with 1,000 employees, a school with 800 pupils, a town of 2,000 voters. Once the sample is a noticeable share of the population, there is less uncertainty left to remove, so the required sample falls. The correction is:
n = n₀ / (1 + (n₀ − 1) / N)
For example, an uncorrected n₀ of 385 in a population of N = 1,000 becomes n = 385 / (1 + 384 / 1,000) = 278.18, rounded up to 279 — 106 fewer people to survey. As a rule of thumb, if the uncorrected sample is less than 5% of the population, the correction changes the answer by under 5% and you can safely ignore it. For a national survey of millions, it is irrelevant.
Sample size for a proportion vs a mean
The choice depends on what you are estimating. A proportion answers “what share?” — a percentage. A mean answers “how much on average?” — a quantity with a standard deviation. The two formulas behave differently: for a proportion the worst case is always p = 0.5, because p(1 − p) reaches its maximum of 0.25 there and falls towards zero as p approaches 0 or 1. That is why 0.5 is the conservative default — it guarantees a large enough sample whatever the true share turns out to be. Only use a smaller p if you have solid evidence for it, for example from a pilot study: with p = 0.30 and a 3% margin at 95%, the answer is 897, against 1,068 if you had stayed at p = 0.5. For a mean there is no universal worst case, so a realistic σ from earlier data matters much more. Once you have collected your sample, you can build the interval around it with our confidence interval calculator based on the empirical rule, or work directly from a mean and standard deviation with the confidence interval from a mean and standard deviation. If your outcome is a proportion, the sampling distribution of a sample proportion shows how sample proportions vary, and the one-proportion z-test tests a claim about that proportion.
Frequently asked questions
What is a sample size calculator?
A sample size calculator works out how many observations you need before you collect any data. You tell it how confident you want to be, how large a margin of error you will accept, and how much variation to expect, and it returns the smallest sample that meets those requirements, rounded up to the next whole person.
Why is the sample size for a 95% confidence level often 385?
Because 385 is the answer for the most common survey settings: 95% confidence, a margin of error of 5 percentage points, and p = 0.5. The formula gives n = 1.96² × 0.25 / 0.05² = 384.16, rounded up to 385.
Why does halving the margin of error need four times the sample?
Sample size is proportional to 1 / E², so halving E multiplies the sample by 1 / (1/2)² = 4. At 95% with p = 0.5, going from a 5% margin to a 2.5% margin takes n from 384.16 to 1,536.64 — exactly four times as large before rounding.
Why is p = 0.5 the default proportion?
Because p(1 − p) is largest when p = 0.5, at 0.25, so that value gives the largest — safest — sample size. If the true proportion turns out to be 0.2 or 0.8, a sample planned at p = 0.5 is still big enough. Use a different p only when you have good evidence for it, such as a pilot study.
When does the finite population correction matter?
When the population is small and known, and the sample would be a noticeable share of it — roughly 5% or more. An uncorrected sample of 385 from a population of 1,000 falls to 279 after the correction. If the population is large, unknown, or the sample is under 5% of it, the correction is negligible and you can ignore it.
How is sample size for a mean different from sample size for a proportion?
A proportion needs an expected p; a mean needs a population standard deviation σ. The proportion formula uses p(1 − p), which has a built-in worst case at p = 0.5. The mean formula uses σ, which has no universal worst case, so a realistic estimate of σ from a pilot study or earlier research matters much more.
How is this calculator different from the margin of error calculator’s sample-size mode?
That mode only reverse-solves a sample size from a margin of error you enter. This page is a dedicated sample size calculator: it covers both a proportion and a mean, adds the finite population correction, and shows a margin-of-error versus sample-size table. If you already have a sample and want its margin of error, use the margin of error tool instead.
How many people do I need for a margin of error of 3% at 95% confidence?
With the conservative p = 0.5, you need 1,068 people: n = 1.96² × 0.25 / 0.03² = 1,067.11, rounded up. If you have good evidence that p is about 0.30, you need 897 people instead — the calculator above gives both answers.
References
For the statistical background to choosing a sample size, see the NIST/SEMATECH e-Handbook of Statistical Methods, section 7.2.4.2, Sample sizes required, which explains the criteria for choosing a sample size and how large a sample is needed to detect a difference of a given size at a given risk. It is the same reasoning this calculator applies: a larger difference is easier to detect, a smaller acceptable error needs a larger sample, and more variation needs a larger sample.
More Tools to Explore
Keep going with the rest of the toolkit. If you already have a sample and want its margin of error, try the Margin of Error Calculator. For the precision of an estimate, use the Standard Error Calculator. To build an interval from a mean and a standard deviation, use the Confidence Interval from a Mean and Standard Deviation Calculator. To see how sample proportions vary, try the Sampling Distribution of a Sample Proportion Calculator. To test a claim about a proportion, use the One-Proportion Z-Test Calculator. You can browse them all on the tools hub.