Skip to content
Statculator
Sample Size

Sample Size Calculator

Free sample size calculator for surveys and studies: n for any margin of error and confidence level, finite population correction, or power for two groups.

Free, no sign-up Runs in your browserBy Hira Noor, BS MathematicsUpdated

Try

Estimating asks “how precise?” and needs a margin of error. Comparing asks “can I detect a difference?” and needs a power.

%

Usually 90, 95 or 99.

%

Enter 5 for ±5 percentage points.

%

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

Applies the finite population correction. Leave blank for a large or unknown population.

All four goals use normal-approximation formulas and assume simple random sampling. Results are rounded up.

Results

Required sample size, n
385
Rounded up from 384.1459
Critical value, z
1.96
95% confidence
Goal
Estimate a proportion
Confidence level
95%
Critical value, z
1.96
Expected 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 percentage points with 95% confidence. This is the number of completed responses; divide by your expected response rate to find how many people to invite.

Sample size at margins of ±1% to ±10% (95% confidence, p = 50%)

Margin of errorn₀ (unrounded)n (rounded up)
±1%9603.64719,604
±2%2400.91182,401
±3%1067.07191,068
±4%600.2279601
±5%384.1459385
±6%266.768267
±7%195.9928196
±8%150.057151
±9%118.5635119
±10%96.036597

The margin is squared in the denominator: halving it roughly quadruples the sample.

Step-by-step solution

  1. 1

    Find the critical value for the confidence level

    z leaves 2.5% in each tail of the standard normal distribution.

    α = 1 − 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 the proportion 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 leave the margin of error slightly larger than requested.

    n = ⌈384.1459⌉ = 385

What is a Sample Size Calculator?

A sample size calculator tells you how many responses or participants a study needs before you collect any data. To estimate a proportion or a mean, it finds the n that gives a chosen margin of error at a chosen confidence level: a survey at 95% confidence and ±5% needs 385 responses, or 323 from a population of 2,000. To compare two means or two proportions, it finds the n per group that gives a chosen power to detect a stated difference at significance level α. Results are always rounded up.

What the Sample Size Calculator does

Start with the Goal. If you want to describe a population, such as the share of customers who are satisfied or the average waiting time, choose one of the two estimation goals and enter a confidence level and margin of error. If you want to detect a difference between two groups, such as treatment versus control or version A versus version B, choose one of the two comparison goals and enter α, the power you want and the difference you expect. The calculator returns the required sample size, the per-group and total numbers for comparisons, every intermediate value, and a table showing how the answer changes with the margin of error or the power.

Use it as a survey sample size calculator, a minimum sample size calculator for a thesis, or a power analysis calculator for a statistically significant comparison. If you already have a sample and want to know how precise it is, work the other way with the Margin of Error Calculator.

The four goals cover most first-pass planning for surveys, experiments and A/B tests. The estimation formulas are the same normal-approximation formulas used by the Cochran’s formula calculator, which goes deeper on survey sampling. The comparison formulas are the standard normal-approximation power formulas; they give a quick, transparent answer, and exact t-based or exact binomial planning will ask for slightly more.

How to use the Sample Size Calculator

  1. Choose the Goal: estimate a proportion, estimate a mean, compare two means or compare two proportions.
  2. For estimation, enter the Confidence level and the Margin of error, plus the Expected proportion, p or the Standard deviation estimate, σ. Add the Population size, N if the population is small and known.
  3. For a comparison, enter the Significance level (α), the Power, 1 − β, and whether the Test is two-sided or one-sided.
  4. Then enter the effect: the Difference to detect, Δ and Common standard deviation, σ for means, or Group 1 proportion, p₁ and Group 2 proportion, p₂ for proportions. Leave the Allocation ratio at 1 for equal groups.
  5. Read the required sample size and check the table to see what a different margin or power would cost.

How to calculate sample size for a survey

A school district wants to survey its 2,000 staff about a new timetable. It wants 95% confidence and a margin of error of ±5 percentage points, and has no earlier estimate of the answer, so it uses p = 50%.

  1. Find the critical value: z = 1.96 for 95% confidence.
  2. Apply the proportion formula for a very large population: n₀ = 1.96² × 0.5 × 0.5 / 0.05² = 384.15.
  3. Apply the finite population correction, because the 2,000 staff are a small, known population: n = 384.15 / [1 + (384.15 − 1) / 2,000] = 322.39.
  4. Round up: 323 completed responses. Without the correction the answer would be 385.
  5. Allow for non-response: at an expected 30% response rate, invite 323 / 0.30 ≈ 1,077 staff.

Sample size formulas

All four formulas come from the normal approximation. z is the critical value for the confidence level; z_α is z(α/2) for a two-sided test or z(α) for a one-sided test; z_β is the z value for the chosen power.

Estimate a proportion
n₀ = z² · p(1 − p) / e²
Estimate a mean
n₀ = (z · σ / E)²
Finite population correction (either estimate)
n = n₀ / [1 + (n₀ − 1) / N]
Compare two means
n₁ = (1 + 1/k) · σ² · (z_α + z_β)² / Δ², n₂ = k · n₁
Compare two proportions (unpooled)
n₁ = (z_α + z_β)² · [p₁(1 − p₁) + p₂(1 − p₂)/k] / (p₁ − p₂)², n₂ = k · n₁
Formula symbols
SymbolMeaning
e, Emargin of error (as a proportion for e; in data units for E)
p, p₁, p₂expected proportions
σstandard deviation of the measurement (within each group for a comparison)
Δdifference in means to detect
kallocation ratio n₂ / n₁
Npopulation size
z_βΦ⁻¹(power): 0.8416 for 80%, 1.2816 for 90%, 1.6449 for 95%

Every result is rounded up, and for a comparison each group is rounded up separately (n₂ is the rounded-up value of k × the unrounded n₁).

The two-sided comparison formulas ignore the negligible chance of rejecting H₀ in the wrong direction. Software that includes it, such as statsmodels’ NormalIndPower, returns a value a fraction of an observation smaller.

Worked example

Worked example: planning a two-group experiment

Problem. A team wants to compare a new tutoring method with the usual one on a test whose scores have a standard deviation of about 10 points. They want 80% power to detect a difference of 5 points with a two-sided test at α = 0.05, using equal groups. How many students are needed?

  1. 01z values: z(α/2) = z(0.025) = 1.96 and z(β) = Φ⁻¹(0.80) = 0.8416, so z_α + z_β = 2.8016.
  2. 02Effect size: d = Δ / σ = 5 / 10 = 0.5.
  3. 03Formula with k = 1: n₁ = 2 × 10² × 2.8016² / 5² = 2 × 100 × 7.8489 / 25 = 62.79.
  4. 04Round up: 63 per group, 126 in total. With 63 per group the power is 80.13%.
  5. 05Allowing for the t-test: 62.79 + 1.96² / 4 = 63.75, so 64 per group is the safer plan.

Answer. The normal-approximation answer is 63 students per group (126 in total). Because the data will be analysed with a t-test, 64 per group is the figure most power software reports. Halving the detectable difference to 2.5 points would quadruple the requirement to 252 per group.

Sample size table by margin of error and confidence level

This sample calculation table gives the survey sample size for a proportion from a very large population, using the worst case p = 50% (Cochran’s n₀ = z²p(1 − p) / e², rounded up). The 95% column is the one most surveys use.

Required sample size, large population, p = 50%
Margin of error90% confidence95% confidence99% confidence
±1%6,7649,60416,588
±2%1,6912,4014,147
±3%7521,0681,844
±4%4236011,037
±5%271385664
±10%6897166

Sample size by population size

Population size only matters when the sample would be a sizeable share of it. Above roughly 20,000 people the requirement is almost the same as for an unlimited population; below a few thousand the finite population correction n = n₀ / [1 + (n₀ − 1) / N] lowers it noticeably. If you do not know the total population size, leave the field blank: the uncorrected figure is the safe, slightly larger answer.

Required sample size at 95% confidence, p = 50%
Population size, N±3%±5%±10%
100928050
50034121881
1,00051727888
2,00069732392
5,00088035795
10,00096537096
100,0001,05638396
Very large1,06838597

Which goal matches my study?

The right formula depends on what the study has to deliver. An estimation study is finished when the confidence interval is narrow enough. A comparison study is finished when a real difference of the size you care about would probably reach statistical significance. Mixing these up is the most common planning mistake: a survey sized for a ±5% margin is usually far too small to compare two of its subgroups.

GoalTypical questionWhat you must supplyRelated calculator
Estimate a proportionWhat share of customers would recommend us?Confidence, margin of error, rough pCochran’s Formula Calculator
Estimate a meanWhat is the average delivery time?Confidence, margin of error, σMargin of Error Calculator
Compare two meansDoes the new method raise the average score?α, power, difference Δ, σEffect Size Calculator
Compare two proportionsDoes version B convert better than version A?α, power, p₁ and p₂Two Proportion Z-Test Calculator

Quick reference: sample size per group for two means

Per-group sample sizes for a two-sided test at α = 0.05 with equal groups, by standardized difference d = Δ / σ (normal approximation; add one per group for a t-test). Cohen’s conventional labels are small (0.2), medium (0.5) and large (0.8), but the difference that matters in your field should drive the choice.

Effect size, d80% power90% power95% power
0.2 (small)393526650
0.3175234289
0.5 (medium)6385104
0.8 (large)253341
1.0162226

Why two-proportion calculators disagree: unpooled, pooled and arcsine

There are three widely used normal-approximation formulas for comparing two proportions, and they differ in how they model the variance. This calculator uses the unpooled formula, which uses each group’s own variance p(1 − p) throughout. The pooled formula uses the combined proportion p̄ for the null-hypothesis part, matching the usual two-proportion z-test. The arcsine formula first transforms each proportion with 2·asin√p, which makes the variance the same for every p; the transformed difference is Cohen’s h, and this is what statsmodels’ NormalIndPower computes when it is given proportion_effectsize.

For 40% versus 55% at α = 0.05 (two-sided) and 80% power the three give 171, 173 and 173 per group. The gap widens when a proportion is close to 0 or 1: for 2% versus 6% they give 373, 376 and 353, with the arcsine formula noticeably smaller. None is exact, so when the methods disagree by more than a few observations take the larger figure, or confirm with exact binomial power.

From required sample to number recruited

The result is the number of observations that must be analysed. Divide by the fraction you expect to keep: if 20% of participants are likely to drop out, recruit n / 0.8; if a survey has a 25% response rate, invite n / 0.25.

Cluster sampling, where whole classes, clinics or households are sampled together, needs the result multiplied by a design effect, often between 1.5 and 2, because people in the same cluster resemble each other. And if you plan several comparisons, each one needs its own power calculation with an α adjusted for multiple testing.

Common use cases

  • Surveys and polls: how many responses for a stated margin of error, with or without a small-population correction.
  • Clinical and lab studies: participants per arm to detect a clinically meaningful difference in a mean outcome.
  • A/B tests: visitors per variant to detect a lift in conversion rate from p₁ to p₂.
  • Quality and process studies: measurements needed to pin down a mean within a tolerance.
  • Grant, ethics and thesis proposals: a transparent justification of the sample size with every assumption stated.
  • Planning the whole study: before sizing a study, choose its design (experiment, cohort, case-control or cross-sectional); the guide to study design and sample size walks through the steps.

Assumptions and limitations

  • All four formulas assume simple random sampling (or random assignment) and independent observations. Clustered, stratified or matched designs need their own methods.
  • The comparison goals use the normal approximation. For means analysed with a t-test, exact planning needs slightly more, typically one or two per group at α = 0.05. For proportions, exact or continuity-corrected methods need more, especially with small samples or rates near 0% or 100%.
  • The answer is only as good as the planning values. σ, p and the difference to detect are guesses; run the calculation for a pessimistic scenario as well.
  • It sizes a study for one primary estimate or comparison. Subgroup analyses, several outcomes, paired designs, more than two groups (ANOVA) and regression need different calculations.
  • For survey shortcuts that need only N and a margin of error, see Slovin’s formula and Yamane’s formula, and note the fixed confidence level they assume.

Frequently asked questions

How do I calculate sample size?

Decide whether you are estimating a quantity or comparing groups. To estimate a proportion use n = z²p(1 − p) / e², and to estimate a mean use n = (zσ / E)². To compare two means use n per group = 2σ²(z_α + z_β)² / Δ². In every case round the result up to the next whole number.

What sample size do I need for 95% confidence and a 5% margin of error?

For a proportion from a large population the answer is 385, from 1.96² × 0.5 × 0.5 / 0.05² = 384.15 rounded up. It assumes the worst case p = 50%. For a small population the finite population correction lowers it: with N = 2,000 the requirement falls to 323.

What confidence level and margin of error should I use?

Most surveys use 95% confidence with a margin of error of ±5 percentage points, which needs 385 responses from a large population. Use ±3% (1,068 responses) when small differences between answers matter, such as in an opinion poll, and ±10% (97 responses) only for a rough pilot. Choose 99% confidence when a wrong conclusion would be costly; it raises the sample by about 73%.

Do I need to know the total population size?

No. If the population is large or unknown, leave the population size blank and the calculator assumes it is very large, which gives the slightly larger, safe answer. Enter N only for a small, known group such as the staff of one company, where the finite population correction can cut the required sample a lot: at 95% and ±5%, a population of 500 needs 218 responses instead of 385.

What is statistical power and why is 80% the usual target?

Power is the probability that a study detects a difference of the stated size when that difference really exists; it equals 1 − β, where β is the Type II error rate. Eighty percent is a convention that balances cost against the risk of a missed finding. Studies where a miss would be expensive often use 90%, which needs about a third more participants.

How does the difference I want to detect affect the sample size?

Strongly: the sample size is proportional to 1 / Δ², so halving the difference to detect quadruples the number of participants. Detecting a 5-point difference with σ = 10 needs 63 per group at 80% power, while a 2.5-point difference needs 252 per group.

Why do other calculators give a slightly different sample size?

Common reasons are a t-based calculation instead of the normal approximation (one or two more per group), a different two-proportion formula (pooled, unpooled or arcsine), a continuity correction, z rounded to 1.96, or rounding at a different step. Differences of a few observations are normal; large differences usually mean an input was entered differently.

Does a bigger population need a bigger sample?

Hardly at all once the population is large. Precision depends on the sample size itself, not on the fraction of the population sampled, which is why a national poll and a city poll both use about 1,000 people. Population size only matters when the sample would be more than roughly 5% of it.

Should the two groups be the same size?

Equal groups give the most power for a fixed total when the two groups have similar variability and cost. Unequal allocation, such as two controls per treated participant, is worth it when one group is cheaper or easier to recruit, but the total sample size must rise: a 2:1 ratio needs about 12.5% more participants overall.

Cite this page

Statculator. (2026, November 14). Sample Size Calculator. Retrieved November 14, 2026, from https://statculator.com/sample-size/sample-size-calculator/