Sample size calculator
How many people to ask for the precision you want — and why the answer barely depends on how many people there are, which is the genuinely surprising part of sampling. Nothing you type here leaves your browser — it is worked out on your own device, so there is nothing to send and nothing to log.
Assume 50% unless you have a real reason not to
The sample size depends on p(1 − p), and that quantity is largest at p = 0.5. So a survey planned assuming half will be big enough whatever the answer turns out to be, and one planned assuming 10% will be too small if the real figure is nearer half.
The cost of assuming 50% is a slightly larger sample. The cost of assuming wrong in the other direction is a survey that cannot answer its own question.
Population size barely matters, until it does
The surprising part of sampling: to get ±5% at 95% confidence you need 385 people, and that is true whether you are sampling a town of fifty thousand or a country of fifty million.
The finite population correction only bites when your sample is a meaningful fraction of the whole. For a population of 10,000 it brings 385 down to 370. For a population of 500 it brings it down to 218.
Margin of error is not the only error
This arithmetic tells you about sampling error — the variation you get from asking 385 people rather than everybody. It knows nothing about who you asked.
A biased sample of 10,000 is worse than a fair sample of 385, and the margin of error will look wonderful. Non-response, question wording and how people were selected are all outside this calculation and all capable of dwarfing it.
What this is not for
This is the survey question: how many people to ask so your estimate is precise enough. It is not a clinical power calculation — how many patients are needed to detect a treatment effect — which is a different question, with different consequences if it is wrong, and one this site deliberately does not answer.