Sample Size Calculators
Free sample size calculators: survey size from confidence level, margin of error and population, power analysis for two groups, Slovin and Yamane.
Calculate a survey sample size nowUpdated · Formulas and conventions follow our methodology
In short
A sample size calculator tells you how many responses or participants a study needs. For a survey, enter the confidence level, the margin of error and, if it is small, the population size: at 95% confidence and ±5% with p = 0.5 you need 385 responses, or 278 from a population of 1,000. To compare two groups, size the study for a chosen power instead.
Survey sample size calculator
Enter the confidence level, the margin of error you can accept, the expected proportion (leave 50% if unsure) and the population size if you know it. The calculator applies Cochran’s formula and the finite population correction, rounds up, and shows the sample needed at ±1% to ±10%. To size a study for a mean or for a comparison of two groups with a target power, use the Sample Size Calculator.
Results
- Confidence level
- 95%
- Critical value, z
- 1.96
- Estimated proportion, p
- 0.5
- Margin of error, e
- 0.05
- p(1 − p)
- 0.25
- n₀ (unrounded)
- 384.1459
Interpretation: Collect at least 385 randomly selected responses to estimate the proportion within ±5% with 95% confidence.
Sample size for common margins of error (95% confidence, p = 50%)
Halving the margin of error roughly quadruples the sample size, because e is squared in the denominator.
Step-by-step solution
- 1
Find the critical value for the confidence level
z is the value that leaves 2.5% in each tail of the standard normal distribution.
α = 1 − 0.95 = 0.05z = z(α/2) = 1.96 - 2
Write the percentages as proportions
p = 50% = 0.5, 1 − p = 0.5e = 5% = 0.05 - 3
Apply Cochran’s formula
n₀ = z² · p(1 − p) / e²n₀ = 1.96² × 0.5 × 0.5 / 0.05²n₀ = 3.8415 × 0.25 / 0.0025 = 384.1459 - 4
Round up to a whole number
Always round up: rounding down would give a margin of error slightly larger than the one you asked for.
n = ⌈384.1459⌉ = 385
All 5 sample size calculators
Survey sample size
Size a survey to estimate a percentage within a margin of error.
- Cochran’s Formula CalculatorSurvey sample size from confidence level, margin of error and expected proportion.
- Slovin’s Formula CalculatorQuick sample size from population size and margin of error, n = N / (1 + Ne²).
- Yamane’s Formula CalculatorTaro Yamane’s simplified and general sample size formulas for finite populations.
Means, proportions and power analysis
Estimate a mean, or compare two groups with a chosen α and power.
Margin of error
Work backwards from a sample you already have to the precision it gives.
How sample size is calculated
For an estimate, the required sample size depends on four inputs: the confidence level (through its z value), the margin of error e you can accept, the variability of what you measure (p(1 − p) for a proportion, σ for a mean), and, for small populations, the population size N. The margin of error shrinks with the square root of n, so halving e roughly quadruples the sample you need. When the proportion is unknown, p = 0.5 gives the largest and therefore safest n. The answer is the minimum sample size for that precision, so always round up.
Cochran’s formula is the general method: it lets you set the confidence level and expected proportion, then applies a finite population correction when N is known. Slovin’s formula and Yamane’s simplified formula are the same expression, n = N / (1 + Ne²); they need only N and e, and correspond to assuming p = 0.5 and z = 2 (about 95% confidence). These three formulas size a study to estimate a quantity precisely. To size a study that compares two groups, use the Sample Size Calculator, which finds the sample size needed to detect a chosen difference between two means or two proportions at a given α and power; the guide Type I vs Type II Errors (Type 1 vs Type 2): Definitions and Examples explains what power means.
Whether you call it a sample size calculator, a sampling calculator or a survey size calculator, every tool here returns the number of completed responses or measurements. If only some of the people you invite will respond, divide by the expected response rate to get the number to contact.
How do you calculate sample size?
- Decide what you are estimating or comparing. A percentage from a survey (a proportion), an average (a mean), or a difference between two groups. Estimates are sized by margin of error; comparisons are sized by power.
- Choose the confidence level. 95% is the usual default, which uses z = 1.960; 90% uses 1.645 and 99% uses 2.576.
- Set the margin of error. This is the ± you can live with, such as ±5 percentage points for a survey or ±3 units for a mean. A smaller margin needs a much larger sample.
- Estimate the variability. For a proportion, use a value from a pilot or earlier survey, or p = 0.5 if you have none. For a mean, use a standard deviation σ from earlier data.
- Answer “What is your total population size?” If the population is small, say a school of 1,000 students, enter N so the finite population correction can reduce n. For a large or unknown population, leave it blank.
- Calculate and round up, then allow for non-response. Apply the formula, round the result up to a whole number, and divide by the expected response rate: 278 completed surveys at a 60% response rate means inviting 464 people.
Sample size worked examples
To check the first example, enter a population size of 1,000 in the survey calculator above and keep the other defaults; the other two run in the Sample Size Calculator.
Survey of a population of 1,000 at 95% confidence and ±5%
Problem. A school with 1,000 students wants to estimate the share who support a new timetable within ±5 percentage points at 95% confidence. There is no earlier estimate. How many students must respond?
- 01Use p = 0.5 because there is no prior estimate, and z = 1.960 for 95% confidence.n₀ = z² p(1 − p) / e² = 1.960² × 0.25 / 0.05² = 384.15
- 02Apply the finite population correction for N = 1,000.n = n₀ / [1 + (n₀ − 1) / N] = 384.15 / 1.3831 = 277.73
- 03Round up, then allow for a 60% response rate.n = 278 responsesinvite 278 / 0.60 = 463.3, so 464 students
Answer. 278 completed responses, or 464 invitations if you expect 60% to reply. Without the correction the answer would be 385.
Sample size to estimate a mean within ±3 units
Problem. Past data put the standard deviation of a test score at σ = 15. How many students are needed to estimate the mean score within ±3 points at 95% confidence?
- 01Use the sample size formula for a mean.n = (z σ / e)² = (1.960 × 15 / 3)² = 9.80² = 96.04
Answer. Round up to 97 students.
Two groups, 80% power, a medium effect
Problem. A trial will compare two group means with a two-sided test at α = 0.05. The smallest difference worth detecting is half a standard deviation (Cohen’s d = 0.5). How many participants per group give 80% power?
- 01Look up z for α/2 = 0.025 and for β = 0.20.z_α/2 = 1.960, z_β = 0.842
- 02Apply the two-means formula with Δ = 0.5σ.n = 2(z_α/2 + z_β)² σ² / Δ² = 2 × 2.8016² / 0.25 = 62.79
Answer. 63 per group (126 in total) by the normal approximation; an exact t-based calculation gives 64.
Which sample size calculator should I use?
| If you want to… | Use |
|---|---|
| If you want one tool that sizes a study for a proportion, a mean or a comparison of two groups | |
| If you are comparing two groups and need enough data to detect a difference with a chosen power, such as 80% | |
| If you want the standard survey sample size for a chosen confidence level and margin of error | |
| If you know the population size and want a quick answer from the margin of error alone | |
| If you want Yamane’s general formula with your own confidence level and proportion | |
| If you have an expected proportion from a pilot study or earlier survey | |
| If you already collected data and want the margin of error it gives | |
| If you want the full confidence interval, not just its half-width |
The formula for calculating the sample size
For a proportion, the formula for calculating the sample size is Cochran’s n₀ = z² p(1 − p) / e², where z is the critical value for your confidence level, p the expected proportion and e the margin of error as a decimal. For a mean it is n = (z σ / e)². Both come from setting the margin of error of a confidence interval, e = z × SE, equal to the target and solving for n, which is why the same three ingredients appear in the Margin of Error Calculator in reverse.
For a comparison of two groups, sample size determination uses power instead of a margin of error: n = 2(z_α/2 + z_β)² σ² / Δ² per group for two means, where Δ is the smallest difference worth detecting and z_β is 0.842 for 80% power or 1.282 for 90% power. Sizing the study this way is called a power analysis. The formulas follow William G. Cochran’s Sampling Techniques (3rd edition, 1977) and the NIST/SEMATECH e-Handbook’s section on sample sizes required; the formula table further down lists each one with a worked number.
When population size matters: the finite population correction
Cochran’s n₀ assumes an effectively infinite population. When your sample would be more than about 5% of the population, the finite population correction n = n₀ / [1 + (n₀ − 1) / N] lowers it. At 95% confidence and ±5%, the 385 needed for a large population becomes 370 for N = 10,000, 323 for N = 2,000, 278 for N = 1,000 and 218 for N = 500.
Above roughly 20,000 the population size barely changes the answer, which is why a national poll and a city poll need similar samples for the same margin of error. Slovin’s and Yamane’s formulas build N in from the start, so they always need it; Cochran’s formula treats it as optional.
Sample size table by population and margin of error
Completed responses needed at 95% confidence with p = 0.5, from Cochran’s formula with the finite population correction, rounded up. For another confidence level or an expected proportion other than 50%, use the survey calculator at the top of the page.
| Population size N | ±10% | ±5% | ±3% | ±1% |
|---|---|---|---|---|
| 100 | 50 | 80 | 92 | 99 |
| 500 | 81 | 218 | 341 | 476 |
| 1,000 | 88 | 278 | 517 | 906 |
| 5,000 | 95 | 357 | 880 | 3,289 |
| 10,000 | 96 | 370 | 965 | 4,900 |
| 100,000 | 96 | 383 | 1,056 | 8,763 |
| Very large or unknown | 97 | 385 | 1,068 | 9,604 |
Sample size and margin of error formulas
| Formula | Expression | Example |
|---|---|---|
| Cochran (large population) | n₀ = z² p(1 − p) / e² | 95%, p = 0.5, e = 0.05: n₀ ≈ 384.1, round up to 385 |
| Finite population correction | n = n₀ / [1 + (n₀ − 1) / N] | N = 2,000: n ≈ 322.4, round up to 323 |
| Slovin / Yamane (simplified) | n = N / (1 + N e²) | N = 2,000, e = 0.05: n ≈ 333.3, round up to 334 |
| Sample size for a mean | n = (z σ / e)² | σ = 15, e = 3, 95%: n ≈ 96.04, round up to 97 |
| Two means, chosen power | n = 2(z_α/2 + z_β)² σ² / Δ² per group | α = 0.05 and 80% power (z = 1.960 and 0.842), Δ = 0.5σ: n ≈ 62.8, round up to 63 |
| Allowing for non-response | invitations = n / response rate | n = 278 at a 60% response rate: 464 |
| Margin of error, proportion | e = z √(p̂(1 − p̂) / n) | p̂ = 0.5, n = 1,000, 95%: e ≈ 0.031 (±3.1 points) |
| Margin of error, mean | e = z σ / √n, or t∗ s / √n when σ is estimated | Half the width of the confidence interval |
| z for common confidence levels | 1.645, 1.960, 2.576 | 90%, 95%, 99% |
Frequently asked questions
What sample size do I need for a survey?
How do you calculate the sample size for a population of 1,000?
Why use p = 0.5 when the proportion is unknown?
What is the difference between Slovin’s and Yamane’s formulas?
How does the margin of error change with sample size?
Does population size matter for sample size?
Is there a minimum sample size?
How many participants do I need to compare two groups?
Looking for something else? See all calculators or search the site.