Home/Statistics/Sample Size Calculator

Sample Size Calculator

Determine the required sample size for a survey, study or A/B test — for proportions or for means — using confidence level, margin of error and population size, with the formula shown.

Quick Answer: How Do You Determine Sample Size?

For a survey estimating a proportion, use n = z² × p(1−p) / E², where z is the critical value for your confidence level, p is the expected proportion (use 0.5 if unknown, since it gives the largest, most conservative sample size), and E is your target margin of error. For a general population survey at 95% confidence with a ±5% margin of error, this works out to about 385 respondents — and that number barely changes whether the underlying population is 10,000 or 10 million.

Sample Size for Proportions
Confidence Level ?
Margin of Error ?
%
Population Size ?
Expected Proportion ?
%
Sample Size for Mean (Continuous Data)
Confidence Level
Margin of Error (absolute)
Std Deviation (σ) ?
Required Sample Size
Minimum Sample Size
385
For 95% CI, ±5% margin of error
ParameterValue
Sample Size Comparison Table

Required sample sizes at 95% confidence, p=50%:

Population±3%±5%±10%

What Is Sample Size and Why Does It Matter?

Sample size is the number of people, items or observations you need to collect data from so that your results reliably reflect the larger population you're studying. Get it wrong in one direction and you waste money and time collecting more data than necessary; get it wrong in the other direction and your results are too imprecise or underpowered to be trusted — a survey with too few respondents can produce a margin of error so wide the result is practically meaningless.

Determining sample size before you collect data — rather than guessing, or simply gathering "as many as we can get" — is standard practice in survey research, clinical trials, market research and A/B testing, and it is exactly what this calculator works out for you.

💡 Did You Know? For a large population, required sample size barely changes with population size at all. A sample of 385 gives the same ±5% margin of error whether you're surveying a city of 50,000 or a country of 25 million — it's the absolute number of respondents that drives precision, not the fraction of the population sampled.

Sample Size Formulas

Proportion (infinite population):   n = z² × p(1 − p) / E²
Finite population correction:   n_adj = n / (1 + (n − 1)/N)
Mean (continuous data):   n = (z × σ / E)²
z = critical value | p = expected proportion | E = margin of error | N = population size | σ = standard deviation

Step-by-Step Calculation Examples

Example 1 — standard survey sample size (proportion)

Target: 95% confidence, ±5% margin of error, proportion unknown so p = 0.5.
n = 1.96² × 0.5 × 0.5 / 0.05² = 3.8416 × 0.25 / 0.0025
n = 0.9604 / 0.0025 = 384.16 → round up to 385
This is the well-known "385 respondents" benchmark used across market research.

Example 2 — finite population correction

A club has only 500 members. Using n = 385 from Example 1, apply the finite population correction.
n_adj = 385 / (1 + (385 − 1)/500) = 385 / (1 + 0.768) = 385 / 1.768 ≈ 218
Because you're sampling a large share of a small population, fewer respondents are needed than the infinite-population formula suggests.

Example 3 — sample size for a mean

A researcher wants to estimate an average with a margin of error of ±5 units, knowing σ ≈ 25, at 95% confidence.
n = (1.96 × 25 / 5)² = (9.8)² = 96.04 → round up to 97

Example 4 — effect of a known prior estimate

A previous survey found the true proportion is closer to 30% (p = 0.3), not the conservative 50%. Target: 95% confidence, ±5% margin of error.
n = 1.96² × 0.3 × 0.7 / 0.05² = 3.8416 × 0.21 / 0.0025 ≈ 322.7 → round up to 323
Using a realistic prior estimate instead of the conservative p = 0.5 reduces the required sample size — but only use this if the prior estimate is genuinely trustworthy.

Confidence Level, Margin of Error and Sample Size

ConfidenceMargin of errorRequired n (p = 0.5)
95%±10%97
95%±5%385
95%±3%1,068
95%±1%9,604
99%±5%664
90%±5%271
Pro Tip: Sample size and margin of error have a squared relationship, not a linear one. Halving the margin of error (say from ±5% to ±2.5%) roughly quadruples the required sample size — which is exactly why extremely precise polling and census-quality data are so much more expensive than a rough directional survey.

Common Mistakes

MistakeWhy it goes wrongHow to avoid it
Believing a bigger population always needs a bigger sampleFor large populations, required sample size is almost independent of population sizeOnly apply the finite population correction when sampling a meaningful fraction of a small population
Assuming more respondents always fixes a biased sampleSample size only addresses random sampling error, not a flawed sampling method or non-response biasFix the sampling design first; a bigger biased sample is still biased
Using p = 0.5 when a good prior estimate existsProduces an unnecessarily large, expensive sample sizeUse a genuine prior estimate of p from earlier research when you have one
Forgetting response rate when planning data collectionThe sample size formula gives completed responses needed, not invitations sentDivide the required sample size by your expected response rate to size your outreach
Using the proportion formula for a continuous measurementMeans and proportions require different formulas — mixing them gives the wrong nUse n = (z×σ/E)² for means, not the proportion formula
⚠️ Common Mistake: Treating "n = 385" as a universal answer for every survey. It is specifically the answer for 95% confidence, ±5% margin of error, and p = 0.5 — change any of those three inputs and the required sample size changes too.

Practical Applications

Survey and market research

Market researchers and pollsters use sample size calculations before fieldwork begins, to make sure a survey budget produces a result precise enough to be useful, without overspending on unnecessary extra respondents.

Clinical trials and health research

Clinical trials require a pre-specified sample size — often called a "power calculation" — to ensure the study has a reasonable chance of detecting a real treatment effect if one exists, and Australian researchers follow NHMRC guidelines when planning trial sample sizes.

A/B testing and product experiments

Digital product teams use sample size calculations to decide how long an A/B test needs to run before its result can be trusted, balancing the cost of a longer test against the risk of acting on a result that's just random noise.

Official statistics

The Australian Bureau of Statistics designs its ongoing surveys — such as the Labour Force Survey — around carefully calculated sample sizes that balance precision against the cost and burden of data collection, while the five-yearly Census deliberately surveys the entire population rather than a sample.

Auditing

Auditors use sample size calculations to decide how many transactions, invoices or records to test out of a much larger population, balancing audit assurance against the cost of checking every item. Audit sampling often works from a target confidence level and tolerable error rate rather than a margin of error percentage, but the underlying logic is the same trade-off between precision and sample size shown in this calculator — larger samples give more assurance that a material error would have been detected.

How to Calculate Sample Size in Excel

Excel has no built-in "sample size" function, but the proportion formula is short enough to write directly into a cell using NORM.S.INV for the critical value.

=ROUNDUP((NORM.S.INV(1-(1-C)/2)^2 * p * (1-p)) / E^2, 0)
C = confidence level as a decimal (e.g. 0.95) | p = expected proportion (0.5 if unknown) | E = margin of error as a decimal (e.g. 0.05)

Worked example in Excel

95% confidence, ±5% margin of error, p = 0.5: =ROUNDUP((NORM.S.INV(1-(1-0.95)/2)^2*0.5*(1-0.5))/0.05^2,0)
This returns 385 — matching the benchmark figure and the calculator above.
To skip the NORM.S.INV step, you can hard-code the z-value instead: for 95% confidence, replace NORM.S.INV(1-(1-0.95)/2) with 1.96.

Sample Size for Precision vs Sample Size for Statistical Power

This calculator answers "how many respondents do I need for a given margin of error?" — the standard question for surveys and polls. A related but different question, common in clinical trials and A/B testing, is "how many participants do I need to reliably detect a real effect of a certain size?" — this is a power analysis, and it needs extra inputs this calculator doesn't ask for: the expected effect size, the desired statistical power (commonly 80% or 90%), and — for a t-test specifically — the variability of the outcome being measured. If you're planning a study that needs to detect a difference between two groups (rather than just estimate a single proportion or mean precisely), you need a power calculation, not just a margin-of-error sample size.

Sample Size Cheat Sheet

Quick Reference

Proportion (infinite population): n = z² × p(1−p) / E²
Finite population correction: n_adj = n / (1 + (n−1)/N)
Mean (continuous data): n = (z × σ / E)²
Conservative default: p = 0.5 (maximises required n when p is unknown)
90% z = 1.645  |  95% z = 1.96  |  99% z = 2.576
Rule of thumb: quadruple n to halve the margin of error
Benchmark: 95% confidence, ±5% margin of error, p=0.5 → n ≈ 385

Practice Questions

Beginner (with answers)

  1. What sample size is needed for 95% confidence, ±5% margin of error, p unknown?
  2. What z-value corresponds to 90% confidence?
  3. Why is p = 0.5 used when the true proportion is unknown?
  4. Does increasing the population size from 10,000 to 1,000,000 significantly change the required sample size for a fixed margin of error?
  5. What happens to required sample size if you increase the confidence level from 90% to 99%?
Show answers

1) n ≈ 385   2) z = 1.645   3) It maximises p(1−p), giving the largest and most conservative sample size estimate   4) No — for large populations, required sample size is nearly independent of population size   5) It increases, since a higher confidence level requires a larger critical value

Advanced (with answers)

  1. Find the required sample size for 99% confidence, ±3% margin of error, p = 0.5.
  2. A population has only 800 members. Using n = 385 (infinite population formula), apply the finite population correction.
  3. Find the required sample size for estimating a mean with σ = 40, E = 4, 95% confidence.
  4. A survey needs 385 completed responses and historically gets a 20% response rate. How many invitations should be sent?
  5. If a prior study found p = 0.2, how does the required sample size compare with using the conservative p = 0.5, at 95% confidence and ±5% margin of error?
Show answers

1) n = 2.576² × 0.25 / 0.03² = 6.636×0.25/0.0009 ≈ 1,843   2) n_adj = 385/(1+(384/800)) = 385/1.48 ≈ 260   3) n = (1.96×40/4)² = 19.6² ≈ 384.16 → 385   4) 385/0.20 = 1,925 invitations   5) p=0.2: n = 1.96²×0.2×0.8/0.05² ≈ 246, compared with 385 for p=0.5 — using the realistic lower proportion needs far fewer respondents

🔑 Key Takeaways

  • Larger samples give more precise estimates but cost more to collect.
  • n = (z² × p × (1−p)) / E² for proportions; n = (z × σ / E)² for means.
  • Margin of error and sample size have a squared relationship — halving E roughly quadruples n.
  • p = 0.5 is the conservative default that maximises required sample size when the true proportion is unknown.
  • For large populations, required sample size barely depends on population size at all.
  • The finite population correction only matters meaningfully when sampling a large share of a small population.

Frequently Asked Questions

References

Last updated: August 2026
Reviewed by Mohsin Iqbal using standard statistical definitions, with every worked example independently verified. This page is for educational purposes.