Skip to content
Statculator

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 now

Updated · 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.

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.

Full Cochran’s Formula Calculator page with formulas and FAQ
Try
%

Usually 90, 95 or 99.

%

Enter 5 for ±5 percentage points.

%

Use 50% when you have no prior estimate; it gives the largest sample.

Leave blank for a very large or unknown population.

Results

Required sample size, n₀
385
Rounded up from 384.1459
Critical value, z
1.96
95% confidence
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%)

Margin of errorn₀ (unrounded)n₀ (rounded up)
±1%9603.64719604
±2%2400.91182401
±3%1067.07191068
±4%600.2279601
±5%384.1459385
±10%96.036597

Halving the margin of error roughly quadruples the sample size, because e is squared in the denominator.

Step-by-step solution

  1. 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.05
    z = z(α/2) = 1.96
  2. 2

    Write the percentages as proportions

    p = 50% = 0.5, 1 − p = 0.5
    e = 5% = 0.05
  3. 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. 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

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?

  1. 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.
  2. Choose the confidence level. 95% is the usual default, which uses z = 1.960; 90% uses 1.645 and 99% uses 2.576.
  3. 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.
  4. 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.
  5. 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.
  6. 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?

  1. 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
  2. 02Apply the finite population correction for N = 1,000.
    n = n₀ / [1 + (n₀ − 1) / N] = 384.15 / 1.3831 = 277.73
  3. 03Round up, then allow for a 60% response rate.
    n = 278 responses
    invite 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?

  1. 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?

  1. 01Look up z for α/2 = 0.025 and for β = 0.20.
    z_α/2 = 1.960, z_β = 0.842
  2. 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%
10050809299
50081218341476
1,00088278517906
5,000953578803,289
10,000963709654,900
100,000963831,0568,763
Very large or unknown973851,0689,604

Sample size and margin of error formulas

FormulaExpressionExample
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 correctionn = 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 meann = (z σ / e)²σ = 15, e = 3, 95%: n ≈ 96.04, round up to 97
Two means, chosen powern = 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-responseinvitations = n / response raten = 278 at a 60% response rate: 464
Margin of error, proportione = z √(p̂(1 − p̂) / n)p̂ = 0.5, n = 1,000, 95%: e ≈ 0.031 (±3.1 points)
Margin of error, meane = z σ / √n, or t∗ s / √n when σ is estimatedHalf the width of the confidence interval
z for common confidence levels1.645, 1.960, 2.57690%, 95%, 99%

Frequently asked questions

What sample size do I need for a survey?

For a large population, 95% confidence and a ±5% margin of error with p = 0.5, you need 385 responses. Smaller populations need fewer once the finite population correction is applied: for N = 2,000 the answer drops to 323. Plan for non-response by inviting more people than the target.

How do you calculate the sample size for a population of 1,000?

At 95% confidence, a ±5% margin of error and p = 0.5, Cochran’s formula gives n₀ = 384.15 for a large population. The finite population correction for N = 1,000 reduces it to 384.15 / (1 + 383.15 / 1,000) = 277.7, so you need 278 responses. Slovin’s formula, n = 1,000 / (1 + 1,000 × 0.05²), gives 286 because it uses z = 2 instead of 1.960.

Why use p = 0.5 when the proportion is unknown?

The product p(1 − p) is largest at p = 0.5, so that choice gives the biggest, most conservative sample size. If a pilot study or earlier survey suggests a proportion such as 0.2, using it gives a smaller n that is still adequate. When in doubt, 0.5 guarantees the margin of error you planned for.

What is the difference between Slovin’s and Yamane’s formulas?

Slovin’s formula and Yamane’s simplified formula are the same equation, n = N / (1 + Ne²), and give identical answers. Yamane’s version is usually stated for 95% confidence and p = 0.5, and his name is also attached to a general version that accepts other confidence levels and proportions, which the Yamane’s Formula Calculator includes. Cochran’s formula is more flexible and is the usual choice in survey methodology.

How does the margin of error change with sample size?

The margin of error is proportional to 1/√n, so quadrupling the sample halves it. At 95% confidence with p̂ = 0.5, n = 1,000 gives about ±3.1 percentage points and n = 4,000 gives about ±1.5. Beyond a point, extra responses buy very little extra precision.

Does population size matter for sample size?

Only when the sample is a sizeable fraction of the population, often taken as more than about 5%. For large populations the required sample barely changes with N: a national survey and a city survey need similar sample sizes for the same margin of error. The finite population correction handles the small-population case.

Is there a minimum sample size?

There is no single minimum that fits every study. The minimum sample size is whatever the formula returns for your confidence level, margin of error and variability, rounded up. Rules of thumb such as “at least 30” only describe when the sampling distribution of a mean is roughly normal; they do not guarantee a useful margin of error or enough power.

How many participants do I need to compare two groups?

It depends on the smallest difference you want to detect, the variability of the outcome, the significance level α and the power you want. For a two-sided test at α = 0.05 with 80% power, detecting a difference of half a standard deviation (Cohen’s d = 0.5) takes about 63 participants per group by the normal-approximation formula, or 64 by an exact t-based calculation. Smaller effects need far more: d = 0.2 takes about 393 per group. The Sample Size Calculator does this for means and proportions.

Looking for something else? See all calculators or search the site.