Sample Size Calculator
Find out how many people a survey or study needs for the confidence level and margin of error you want, for a proportion or for a mean, with an optional population size. You can also work backwards and get the margin of error of a sample you already have.
Confidence level (used by every calculation below)
Sample size for a proportion (survey)
Sample size for a mean
Margin of error of a sample: proportion
Margin of error of a sample: mean
Sample size for common margins of error
For a proportion, using the confidence level, expected proportion and population size entered above.
Calculations run in your browser. Nothing you enter is sent anywhere; your inputs are remembered only on this device.
How to use the sample size calculator
- Choose the confidence level at the top. All the calculations below use it.
- To plan a survey, fill in Sample size for a proportion: the margin of error you accept, the proportion you expect (leave 50 % if unsure) and, for a small known group, its population size.
- To plan a study that measures a quantity such as height, use Sample size for a mean with the expected standard deviation and a margin of error in the same units.
- If you already have data, use the two Margin of error cards instead. Enter your sample size and the observed proportion or standard deviation.
- Read the result. Sample sizes are always rounded up; the unrounded value and the z value are shown too. The table at the end covers margins from 1 % to 10 %.
How it works
The tool uses the normal approximation. It first turns the confidence level into a z value, the number of standard errors that leaves the chosen share of a normal curve in the middle. An inverse normal function in your browser, accurate to more than six decimals, computes it; nothing comes from a table. For a proportion:
n₀ = z² × p × (1 − p) ÷ E²
For a mean:
n₀ = (z × σ ÷ E)²
Here z is the z value, p is the expected proportion as a fraction (50 % is 0.5), σ is the standard deviation, and E is the margin of error as a fraction for a proportion or in the data's units for a mean. If you give a population size N, the finite population correction reduces the answer:
n = n₀ ÷ (1 + (n₀ − 1) ÷ N)
The margin of error of an existing sample is the same relationship turned around:
E = z × √(p(1 − p) ÷ n) × √((N − n) ÷ (N − 1))
For a mean, replace √(p(1 − p) ÷ n) with σ ÷ √n. The last factor applies only when you enter a population size, and it equals 1 for a very large population. The tool keeps the full-precision z and rounds only at the end: sample sizes up, margins of error to two decimals. If you work by hand with z rounded to 1.96, you can end up one or two people away from the tool. For 99 % confidence, 2.58 gives 666 where the exact z gives 664.
Examples
Example 1: a simple survey. 95 % confidence, margin of error 5 %, expected proportion 50 %, no population size. Then n₀ = 1.959964² × 0.25 ÷ 0.05² = 384.15, so you need 385 respondents.
Example 2: a smaller margin and a known population. 95 % confidence, margin 3 %, proportion 50 %. Without a population size, n₀ = 1,067.07, which is 1,068. With a population of 2,000 the correction gives 696.05, so you need 697.
Example 3: a mean. 95 % confidence, σ = 15 points, margin of error 2 points. n₀ = (1.959964 × 15 ÷ 2)² = 216.08, so 217. With a population of 500 the answer drops to 151.09, which is 152.
Example 4: margin of error of a poll. 1,000 respondents, observed proportion 50 %, 95 % confidence: E = 1.959964 × √(0.25 ÷ 1000) = 3.10 %. With 400 respondents it is 4.90 %, or 4.38 % if they were drawn from a population of 2,000. For a mean with n = 100 and σ = 15, E = 1.959964 × 15 ÷ √100 = 2.94.
What confidence level and margin of error mean
The margin of error is the half-width of the interval around your estimate. A poll that finds 52 % with a margin of 3 points reports an interval from 49 % to 55 %.
The confidence level describes the method, not one interval. If you repeated the whole survey many times and built an interval each time in the same way, about 95 % of those intervals would contain the true value. It is not correct to say that there is a 95 % probability that the true value lies inside the one interval you computed: that interval either contains it or it does not. Halving the margin of error needs about four times as many people, because the sample size depends on 1 ÷ E².
Why 50 % is the cautious default, and why population size hardly matters
The product p(1 − p) is largest at p = 0.5, where it equals 0.25. If you do not know the proportion in advance, 50 % gives the largest sample size, so the margin you get is at most the one you asked for, whatever the true proportion is. If earlier research puts it near 20 %, you can use 20 % and need fewer people: 246 instead of 385 at 95 % confidence and a 5 % margin.
The population size matters little unless the sample is a noticeable share of it. With a population of 100,000, the 385 above becomes about 383, and with ten million it stays 385. The correction matters for small groups: for a company of 1,000 people the same survey needs only 278. A rule of thumb is to use the correction when the sample is more than about 5 % of the population. An empty population field means a very large population.
Assumptions, non-response and common mistakes
- The formulas assume a simple random sample, where every member of the population has the same chance of being chosen. They do not cover selection bias, leading questions or wrong answers, and a large sample does not repair a biased one.
- The normal approximation is weak for very small samples and for proportions close to 0 % or 100 %. Exact methods are better there.
- For a mean, the tool uses z and a standard deviation you must estimate from a pilot study or earlier work. When σ itself is uncertain and n is small, the true requirement is a little larger.
- Non-response: n is the number of completed answers you need, not the number of people to invite. If 40 % respond, divide by 0.4: for 385 answers, invite about 963 people.
- If you analyse subgroups, such as age bands, each subgroup needs its own sample size.
Frequently asked questions
How many people do I need for a 95 % confidence level and a 5 % margin of error?
For a large population and an unknown proportion (50 %), you need 385 completed responses.
Why does the result sometimes differ from a table or textbook?
Many tables use z rounded to 1.96, 1.645 or 2.58. The tool keeps the full-precision value, which can change the rounded-up result by one or two, mostly at 99 %.
Does a larger population need a larger sample?
Hardly. Past a few tens of thousands the sample size barely changes; only small populations reduce it.
What if only some of the people I invite respond?
Divide the required sample size by the expected response rate and invite that many people.
Is my data sent anywhere?
No. Everything runs in your browser. Your inputs are saved only in this browser's local storage so they are still there when you come back, and nothing is uploaded.
Related tools
- Percentage Calculator - convert between percentages, fractions and changes.
- Galton Board - watch random choices build a normal curve, the idea behind the z value.
- Random Name Picker - draw a random sample from a list of names.
- Random Group Generator - split a list of people into random groups.
- Significant Figures Calculator - round results to a sensible number of digits.