Sample Size Calculator

Pick your confidence level and how much margin of error you can live with, and this tells you how many responses you need. Add your population size if you have one, though you may be surprised how little it changes the answer.

Put this calculator on your website for free

Copy one snippet and give your visitors a working Sample Size Calculator.

How sample size works

You cannot ask everyone. So you ask some people, and then you have to decide how much to trust what they told you. Sample size is the arithmetic that connects those two things: how many responses you gather, and how tight a bracket you can honestly put around the answer.

Two dials control it. Margin of error is how wide that bracket is, and confidence level is how often the bracket is expected to contain the truth. Say 60 percent of your sample said yes, with a margin of error of 4 points at 95 percent confidence. The honest sentence is: the real figure is probably between 56 and 64 percent, and if you ran this same survey twenty times, you would expect about nineteen of those brackets to contain the true number and one to miss it entirely.

The formula

n = z2 × p(1 − p) ÷ e2

Where z comes from your confidence level (1.96 for 95 percent), p is the result you expect as a decimal, and e is your margin of error as a decimal. If you know your population size N, a second step trims the answer:

nadjusted = n ÷ (1 + (n − 1) ÷ N)

That is the finite population correction, and it is the piece that leads to the strangest result on this page.

Worked example

A standard survey. You want 95 percent confidence and a margin of error of plus or minus 5 points. You have no idea what people will say, so you leave the expected result at 50 percent.

n = 1.962 × 0.5 × 0.5 ÷ 0.052
n = 3.8415 × 0.25 ÷ 0.0025
n = 0.9604 ÷ 0.0025 = 384.1, so 385 responses

Now tighten the margin to plus or minus 2.5 points, which is merely twice as precise. The requirement jumps to 1,537 responses. Twice the precision cost four times the work.

The population almost does not matter

This is the result that stops people, and it is worth sitting with, because it is the reason a national poll of 1,000 people is not the absurdity it looks like.

Here is the same survey, 95 percent confidence and plus or minus 5 points, run against populations of wildly different sizes:

PopulationResponses needed
1,000278
10,000370
100,000383
1,000,000384
100,000,000385

Go from a city of 100,000 to a continent of 100,000,000, a population a thousand times larger, and you need two more people.

The reason is that precision comes from the absolute number of people you asked, not from what fraction of the whole they are. A spoonful tells you about the soup whether the pot holds a litre or fills a bathtub, provided somebody stirred it. That last clause is doing enormous work, and we come back to it below.

Population size only bites when your sample would be a serious slice of it, roughly 5 percent or more, which is why the 1,000-person row above is genuinely lower. Below that, you can ignore it.

Why halving the margin quadruples the sample

Look at where e sits in the formula: on the bottom, squared. Halve it and you divide by a quarter as much, so n goes up four times. Precision improves with the square root of your sample, which means the returns get punishing quickly:

Margin of errorResponsesCost vs the row above
±10 points97 
±5 points3854 times
±2.5 points1,5374 times
±1 point9,6046.2 times

This is the law of large numbers doing its work, and it is worth being precise about what that law promises. It says your sample average converges on the truth as the sample grows. It does not say that a run of odd responses will be corrected by opposite ones later: nothing is owed and nothing is due. The average settles down simply because early noise gets diluted by a growing pile of ordinary results, not because the universe balances the books.

What a bigger sample cannot fix

Every number on this page assumes one thing that real surveys struggle to deliver: that the people who answered are like the people who did not. That is the stirring in the soup analogy, and it is where survey accuracy usually goes wrong, not in the arithmetic.

If the people who respond to you differ systematically from those who ignore you, and they generally do, then more responses buy you a more precise measurement of a biased sample. The bracket gets narrower and stays in the wrong place. There is no sample size that fixes this, which is why professional pollsters spend far more effort on reaching the right people than on reaching more of them.

None of this makes the arithmetic pointless. It makes it the easy half, done first, so you can spend your attention on the hard half. Work out the number you need, then ask yourself who is likely to be missing from it. Once your responses are in, the confidence interval calculator turns them back into the bracket this page was planning for.

Frequently asked questions

How many people do I need to survey?

For the usual choice of 95 percent confidence and a margin of error of plus or minus 5 percent, the answer is 385 responses. That figure holds whether you are surveying a town of 50,000 or a country of 300 million, which is the part most people find hard to believe.

Why does the population size barely matter?

Because precision comes from how many people you asked, not from what fraction of the whole they represent. Tasting a spoonful tells you about the soup whether the pot holds a litre or a bathtub, as long as it is stirred. Population size only starts to matter when your sample is a large slice of it, roughly above 5 percent.

What does margin of error actually mean?

It is the width of the bracket around your result. If 60 percent of your sample said yes with a margin of error of 4 points, the honest statement is that the true figure is somewhere between 56 and 64 percent. It is not a promise, either: at 95 percent confidence, roughly one survey in twenty will land outside its own bracket.

Why does halving my margin of error quadruple the sample?

Because precision improves with the square root of the sample, not with the sample itself. To get twice as precise you need four times as many people, and to get ten times as precise you need a hundred times as many. This is the single most expensive fact in survey design.

What should I put for expected proportion if I have no idea?

Leave it at 50 percent. That is the value that needs the largest sample, because p times one minus p peaks there, so planning around it means you can never come up short. If you genuinely expect a lopsided answer, say 10 percent, the required sample drops sharply, from 385 to 139.

Is a bigger sample always better?

Statistically the answer keeps improving, but with diminishing returns that get brutal fast, and every extra response costs money and time. Past a certain point your error is dominated by who you failed to reach rather than how many you reached, and no amount of extra sample fixes a sample that is not representative.

What is the difference between confidence level and margin of error?

Margin of error is how wide your bracket is; confidence level is how often that bracket is expected to contain the truth. You can have a narrow bracket you trust less, or a wide one you trust more. Raising confidence from 95 to 99 percent while keeping the same width costs you roughly 73 percent more responses.

Does this work for measuring an average rather than a percentage?

Yes, switch to the average mode. Instead of an expected proportion you supply an estimated standard deviation, and the margin of error is expressed in your own units rather than percentage points. The shape of the answer is identical: halving the margin still quadruples the sample.

Related calculators