Skip to main content

Sample Size Calculator

A sample size calculator finds how many observations you need to estimate a population proportion or mean within a chosen margin of error at a stated confidence level. Optional finite population correction shrinks n when the population is not huge. Educational formulas only, not a full survey design or two-sample power analysis.

Results

How to use the sample size calculator

  1. Choose proportion or mean.
  2. Pick a confidence level (95% is common).
  3. Enter the margin of error. For proportions, 0.05 or 5 both mean ±5 percentage points.
  4. For a proportion, enter expected p (0.5 if unknown). For a mean, enter estimated σ.
  5. Optional: enter finite population N. Press Calculate and read n rounded up.

Sample Size Calculator

Educational sample-size formulas

Proportionn = z² p (1 - p) / E²
Meann = (z σ / E)²
Finite correctionn_adj = n0 / (1 + (n0 - 1) / N)
Conservative p0.5 maximizes required n
Default sketch95%, E = 0.05, p = 0.5 gives n = 385
ScopeSimple random sample planning only

What a sample size calculator estimates

A sample size calculator tells you how many observations a simple random sample needs so that a confidence interval for a proportion or a mean is no wider than the margin of error you set. Smaller margins and higher confidence levels need larger samples.

This page is for planning sketches and class checks. It is not a clustered survey design, not IRB text, and not a two-sample power analysis.

Sample size for a proportion

n0 = z² p (1 - p) / E². When you do not know p, use 0.5. That choice maximizes p(1 - p) and gives the largest n for fixed z and E.

Example: 95% confidence (z = 1.96), E = 0.05, p = 0.5 gives n0 about 384.16, rounded up to 385. With a finite population N = 2000, corrected n rounds to 323.

Sample size for a mean

n0 = (z σ / E)². σ is an estimated population standard deviation from a pilot or prior study. E is in the same units as σ. Halving the margin of error multiplies the required sample by about four.

Example: 95% confidence, σ = 12, E = 2 gives n0 = (1.96 × 12 / 2)² about 138.3, rounded up to 139.

Finite population correction

When the sample is a noticeable share of a known population of size N, use n_adj = n0 / (1 + (n0 - 1) / N). Leave N blank when the population is huge or unknown.

Limits and privacy

No design effect, nonresponse inflation, stratified allocation, or clinical two-arm power. Math runs in this browser; CZNull does not receive the numbers. Educational only.

Sample size calculator questions

What sample size do I need for 95% confidence and ±5%?
With p = 0.5 and an unlimited population, n rounded up is 385.
Why use p = 0.5?
It is the conservative default. p(1 - p) peaks at 0.5, so the required n is largest.
Can I enter margin of error as 5 instead of 0.05?
Yes for proportions. Values greater than 1 are treated as percents and divided by 100.
How do I size a sample for a mean?
Choose Mean, enter σ and the margin of error in the same units, then read n rounded up.
When should I enter population size N?
When sampling from a known finite population and the planned n is not tiny relative to N.
Is this a survey product or medical power calculator?
No. It is an educational simple-random-sample formula. Vendors and statisticians add design effects and other adjustments.
Does the page upload my inputs?
No. Calculation stays in this browser tab.