Home › Tools › Sample Size Calculator for Surveys, Means and Two-Group Studies

Sample Size Calculator for Surveys, Means and Two-Group Studies

Free sample size calculator: survey sample size with Cochran's formula and finite population correction, estimating a mean, and power-based comparison of two proportions or two means.

How many people do you need to ask, measure or enrol? This calculator answers that for the four most common study designs: a survey that estimates a percentage, a study that estimates an average, and a trial or comparison that tests whether two groups differ in a percentage or in an average. Pick the type of study, enter your assumptions and the calculator returns the sample size together with the formula and every intermediate step, so the number can go straight into a protocol, grant application or survey plan.

Surveys, polls, questionnaires and audits where the answer is a percentage (yes/no, satisfied/not satisfied).

5% is standard; use 3% for tighter estimates.

Unsure? Keep 50% – it gives the safest (largest) sample.

Total number of people you could survey (e.g. 800 employees). Applies the finite population correction.

Inflates the sample so you still reach the target after refusals or loss to follow-up.

Quick reference: survey sample size (95% confidence, 50% proportion)
Population size±10%±5%±3%±1%
10050809299
50081218341476
1,00088278517906
10,000963709654,900
100,000963831,0568,763
Unlimited973851,0689,604

Running an epidemiological prevalence survey with cluster sampling? Use the prevalence sample size calculator, which adds the design effect used in SMART, MICS and DHS surveys. Already have results from two groups? Calculate the relative risk with a 95% confidence interval.

How to use the sample size calculator

  1. Choose the type of study. A survey estimates a percentage (for example, the share of customers who would recommend you, or patients who are satisfied). Estimate a mean is for averages such as weight, blood pressure or monthly spend. The two compare options are for trials, A/B tests and cohort or case-control studies that test whether two groups differ.
  2. Enter your assumptions. For estimates, set the confidence level and the margin of error you can accept. For comparisons, set the expected values in each group, the significance level and the power.
  3. Add population size and non-response if they apply. If you are sampling from a small, known group (a school, a company, a registry) enter its size. If you expect people to refuse or drop out, enter the expected percentage.
  4. Read the result and the working. The calculator shows the formula, each step and the final number rounded up. Use Share result to copy a link that reopens the calculator with the same inputs.

Formulas used

Survey sample size: Cochran’s formula

For a proportion, the sample size for a very large population is

n₀ = Z² × p × (1 − p) / e²

where Z is the critical value for the confidence level (1.645 for 90%, 1.960 for 95%, 2.576 for 99%), p is the expected proportion and e is the margin of error, both written as decimals. With 95% confidence, p = 0.5 and e = 0.05 this gives 384.2, rounded up to 385 – the figure most online survey calculators return.

Finite population correction

When the population is small, sampling a large share of it adds information, so fewer responses are needed:

n = n₀ / (1 + (n₀ − 1) / N)

For a company of 1,000 employees the 385 above falls to 278. The correction matters once the sample would exceed roughly 5% of the population; at ±5% and populations above about 100,000 it changes the answer by only a few people, but at tight margins such as ±1% it still matters (see the table above).

Estimating a mean

n₀ = (Z × σ / e)², where σ is the standard deviation and e the margin of error in the same units. The finite population correction is applied in the same way.

Comparing two proportions

The number needed in each group to detect a difference between proportions p₁ and p₂ is

n = [Z₁₋α/₂ × √(2 p̄ q̄) + Z₁₋β × √(p₁q₁ + p₂q₂)]² / (p₁ − p₂)²

where p̄ is the average of the two proportions, q = 1 − p, Z₁₋α/₂ is 1.960 for a two-sided α of 0.05 and Z₁₋β is 0.842 for 80% power. This is the Fleiss formula without continuity correction, the same method used by OpenEpi and many statistics textbooks. Detecting a fall from 30% to 20% with α = 0.05 and 80% power needs 294 per group.

Comparing two means

n = 2 × (Z₁₋α/₂ + Z₁₋β)² × σ² / Δ² per group, where Δ is the smallest difference worth detecting. With σ = 10, Δ = 5, α = 0.05 and 80% power the answer is 63 per group. This is the normal approximation; software that uses the t-distribution (such as G*Power) adds one or two participants per group for small samples.

Non-response

The final sample is divided by (1 − non-response rate): planning for 385 completed questionnaires with 20% non-response means inviting 482 people.

Choosing the inputs

  • Confidence level. 95% is the convention in research and most market research. 90% is acceptable for quick internal surveys; 99% is used when a wrong conclusion would be costly.
  • Margin of error. ±5% is the default for general surveys. National health surveys and political polls often aim for ±3% or less. Remember that the margin applies to the whole sample – if you plan to report results for subgroups (for example, by region or age group), each subgroup needs its own adequate sample.
  • Expected proportion. Use a value from a previous survey or pilot if you have one. If not, 50% is the safe choice because p × (1 − p) is largest at 0.5.
  • Standard deviation. Take it from a pilot study, a previous study in a similar population or the published literature. Overestimating it is safer than underestimating it.
  • Difference to detect. This should be the smallest difference that would change a decision – clinically, commercially or for policy – not the difference you hope to find. Halving the difference roughly quadruples the sample size.
  • Power. 80% is the conventional minimum expected by ethics committees and funders; 90% is preferred for confirmatory trials.

Frequently Asked Questions

What sample size do I need for a survey? For a large population, 95% confidence and a ±5% margin of error you need 385 completed responses. For a ±3% margin you need 1,068, and for ±10% only 97. If your population is small – for example 500 people – the finite population correction reduces the ±5% figure to 218.

What is Cochran’s formula? Cochran’s formula, n₀ = Z²p(1 − p)/e², is the standard equation for the sample size needed to estimate a proportion with a given confidence level and margin of error. It was published by William G. Cochran in Sampling Techniques and is the basis of almost every online survey sample size calculator. It is usually followed by the finite population correction when the population is known and small.

Does population size matter? At the usual ±5% margin, much less than most people expect: once the population is larger than about 20,000 the required sample barely changes – 377 for 20,000 people versus 385 for a population of millions, at 95% confidence. It matters for small groups and for tight margins: at ±1%, a population of 20,000 needs 6,489 responses rather than 9,604.

Why use 50% as the expected proportion? The term p × (1 − p) reaches its maximum at p = 0.5, so 50% produces the largest sample size. If you do not know the likely result in advance, 50% guarantees your margin of error will be met whatever the true value turns out to be.

What is the difference between confidence level and margin of error? The margin of error is how far the survey result may lie from the true population value (±5 percentage points, for example). The confidence level is how often that range would contain the true value if the survey were repeated many times. A 95% confidence level with ±5% means that in 95 out of 100 repeated surveys the true value would lie within 5 points of the result.

What is statistical power and why is 80% standard? Power is the probability that a study detects a difference that really exists. With 80% power there is a 20% chance of missing a true effect (a type II error). Jacob Cohen proposed 80% as a reasonable balance between the risk of a missed effect and the cost of recruiting participants, and most funders and ethics committees now expect at least that.

Is the comparison result per group or in total? Per group. For the two-proportion and two-mean options the calculator assumes equal group sizes and also shows the total for both groups combined.

Is this calculator suitable for cluster or multi-stage surveys? Not on its own. Cluster sampling – selecting villages, schools or clinics and then individuals within them – needs a design effect correction. For prevalence surveys of this kind use the prevalence sample size calculator , which includes design effects recommended by SMART and MICS methodology.

References. Cochran WG (1977). Sampling Techniques, 3rd ed. New York: Wiley. Fleiss JL, Levin B, Paik MC (2003). Statistical Methods for Rates and Proportions, 3rd ed. Hoboken: Wiley. Cohen J (1988). Statistical Power Analysis for the Behavioral Sciences, 2nd ed. Hillsdale: Lawrence Erlbaum. Dean AG, Sullivan KM, Soe MM. OpenEpi: Open Source Epidemiologic Statistics for Public Health. openepi.com .