Change language

Statistics

Sample size calculator for surveys

How many responses you need to estimate a percentage or a mean, with finite population, design effect and response rate.

Published by SolucionesAhora.com How we verify

Calculator inputs

  1. Enter your figures, or press “See example” to watch it work.
  2. If your case is unusual, open “Advanced options”.
  3. Read the result and, below it, what it means and how it was worked out.

“A percentage” is for yes/no questions or choosing among options (voting intention, satisfaction, what share uses a product). “A mean” is for when you measure a quantity (age, spending, a test score). To compare two groups (A/B, treatment and control) use the power and sample size calculator.

The total number of people or cases you will draw the sample from. If it is very large (over about 20,000) or unknown, leave 0: the result barely changes. When the population is small, the finite population correction lowers the sample you need.

Leave 0 if the population is very large or unknown

The probability that the interval around your result contains the true value. 95% is the standard: if you repeated the survey many times, in 95 out of 100 the true value would fall within the margin.

How much error you accept, in percentage points: with 5%, if the survey shows 40%, the true value is between 35% and 45%. The smaller the margin, the much larger the sample: going from 5% to 3% multiplies it by 2.8.

In percentage points

The percentage you expect to find. If you have no idea, use 50%: it is the cautious choice, because it gives the largest sample size. If you know it will be low or high (say 10% or 90%), the sample you need drops a lot.

Use 50% if you have no prior estimate

How much the data vary. Get it from a pilot study, earlier research or a reasonable range (SD ≈ range ÷ 4). A larger standard deviation needs a larger sample.

In the variable’s units

How much error you accept when estimating the mean, in the variable’s units: with ±2, if the sample mean is 100, the true one is between 98 and 102.

In the variable’s units

Advanced options

If you sample by clusters (schools, neighbourhoods, households) rather than at random from everyone, the data resemble each other more and you need a larger sample. The design effect is the factor you multiply by; it is usually between 1.2 and 2. With simple random sampling, leave it at 1.

1 = simple random sampling

Not everyone answers. If you expect 30% of those invited to respond, enter 30 and the calculator will tell you how many people to invite to get the valid responses you need. Leave 100 if you will get them all.

Percentage of invitees who will answer

See the result

Results

Valid responses needed385
People to invite (given the response rate)385
If the population were infinite385
z value applied1.9600
At your margin, by confidence level
ConfidenceSample needed
90 %271
95 %385
99 %664
See the working step by step
  1. z = 1.9600; infinite population: 385
Free, no sign-up! What if you could do this without a calculator? A five-minute game with challenges, lives and points. It clicks even when you cannot be bothered.

In short

What it calculates
How many responses you need to estimate a percentage or a mean, with finite population, design effect and response rate.
Formula used
Percentage: n₀ = z² · p · (1 − p) / e²
Example
Example 1. An opinion poll.

Sample size calculator

It is the first figure any thesis committee, ethics board or research client asks for: how many responses do you need for the results to be worth anything? The answer depends on three choices of yours: how much confidence you want, how much error you accept and, if you are estimating a mean, how much the data vary.

Choose whether you want to estimate a percentage or a mean, enter the margin of error and you get the valid responses you need, how many people to invite given the response rate, and how the sample changes if you change the margin or the confidence. Everything runs in your browser.

How it works

First it works out the size for an infinite population; then it corrects for a finite population (which lowers it when the universe is small) and multiplies by the design effect if sampling is not simple random. The result is rounded up.

The response rate does not change the responses you need, but it does change how many people you must invite: responses ÷ rate. With an expected percentage of 50% the sample is the largest possible, which is why it is the cautious choice when you have no prior estimate.

Formula

Percentage: n₀ = z² · p · (1 − p) / e²
Mean: n₀ = ( z · σ / E )²
Finite population: n = n₀ / (1 + (n₀ − 1) / N)
Design effect: final n = n · deff (rounded up)
Invitations = final n / response rate
z = 1.960 at 95%; 1.645 at 90%; 2.576 at 99%

Worked example

Example 1. An opinion poll.
Very large population, 95% confidence, ±5-point margin and a 50% proportion (the cautious choice): n = 1.96² × 0.25 / 0.05² = 384.1, so you need 385 responses. With ±3 points it is 1,068; with ±1 point, 9,604.

Example 2. A school of 2,000 pupils.
Same criteria but a population of 2,000: n₀ = 384.1 and n = 384.1 / (1 + 383.1/2,000) = 322.3, that is, 323 pupils (16.2% of the school) instead of 385.

Example 3. Estimating a mean.
You want the average score on a test whose standard deviation is about 15 points, with ±2 points of error and 95% confidence: n = (1.96 × 15 / 2)² = 216.1, so 217 people. If the group is 500, it drops to 152.

Example 4. Cluster sampling and low response.
The same survey as example 1, but by clusters (design effect of 1.5) and a 30% response rate: 385 × 1.5 = 577 valid responses, and to get them you have to invite 577 / 0.30 = 1,924 people.

Explanation

What sample size you need and why

A sample does not have to be a fixed percentage of the population: what matters is the absolute sample size, the margin of error you accept and the confidence you demand. That is why 385 responses work equally well for a city of 100,000 and a country of 40 million.

The three decisions

  • **Margin of error**: how much you accept being wrong. It weighs the most: the sample grows with the square of the precision.
  • **Confidence level**: 95% is usual. 99% needs a good deal more sample.
  • **Variability**: for a percentage, the most demanding case is 50%; for a mean, the standard deviation.

Finite population

When the population is small, each response carries more information and the sample you need drops. The correction only matters if the sample exceeds 5% of the population; with large populations it changes nothing.

Design effect and response rate

  • If you sample by **clusters** (schools, neighbourhoods, households), multiply by the design effect (between 1.2 and 2 in most surveys).
  • If not everyone answers, the effective sample is the **valid responses**: invite more people, according to the response rate you expect.

Common mistakes

  • Thinking you need a fixed percentage of the population (say 10%).
  • Forgetting the response rate and falling short.
  • Computing the sample for the total and then analysing subgroups: each subgroup needs its own size.
  • Using a convenience sample (people who answer of their own accord) and quoting the margin of error as if it were random: the margin only holds for probability samples.
  • Using this calculator to compare two groups: for that you need statistical power.

Limits of this calculator

  • It assumes simple random sampling, apart from the design effect you enter.
  • For a mean it uses the normal distribution (z) and a known or estimated standard deviation; with very small samples (under 30) Student’s t and a pilot study would be better.
  • It does not compute group comparisons, correlations or regressions: for those, use the power calculator.
  • It accepts populations from 2 and margins up to ±50 points.

Notice

This is an estimate. For research, justify the calculation in your protocol and consult a statistician if the design is complex.

Frequently asked questions

Which margin of error should I choose?

5% is the standard in social and market research. Critical decisions drop to 3% or 1%, at the cost of a much larger sample.

Why use a 50% proportion?

Because p(1−p) peaks at 0.5: it gives the largest and therefore safest sample when you do not know what to expect.

Does it work for very large populations?

Yes. Enter 0 for the population (or leave it empty) and the infinite population formula is applied. Beyond about 20,000 people, population size barely changes the result.

What is the response rate?

The percentage of invited people who answer. If you expect 30%, you must invite more than three times the responses you need.

What is the design effect?

The factor that increases the sample when you do not sample at random from everyone but by groups (schools, neighbourhoods). With simple random sampling it is 1.

What if I do not know the standard deviation?

Estimate it with a pilot study, similar research or the range divided by 4. If in doubt, use a somewhat larger value, which is the cautious choice.

Does it work to compare two groups?

No. To compare groups (A/B, treatment and control) you must compute statistical power; use the power and sample size calculator.

Is my data sent to a server?

No. The calculation runs in your browser.

Sources and references

The formula behind this calculator is not ours. These are the sources it comes from, in APA 7 format, in case you want to go to the original or cite them in your own work.

  1. Cochran, W. G. (1977). Sampling techniques (3.ª ed.). John Wiley & Sons. The sample size formula and the finite population correction.
  2. Kish, L. (1965). Survey sampling. John Wiley & Sons. The design effect in cluster sampling.
  3. Lohr, S. L. (2019). Sampling: Design and analysis (2.ª ed.). Chapman and Hall/CRC. A modern reference on survey design and analysis.

Need to calculate something else?

These tools are often used alongside this calculator.

Power & sample size

How many participants do you need? Work out sample size for a t test, correlation, ANOVA, proportions or…

Margin of error

How precise your survey is, given the sample you actually collected.

Confidence interval

The range the true mean is likely to fall in at your chosen confidence level.

Z score

How many standard deviations a value sits from the mean and which percentile it occupies.

Chi-square

Chi-square test for contingency tables and goodness of fit, with Cramér’s V, residuals, Yates’ correction…