Sample Size Calculator

Pick a proportion (survey percentage) or a mean, set the margin of error and confidence level, and optionally the population size for a finite-population correction. The result is always rounded up.

Updated

Embed this calculator

Paste this code into your page. The calculator runs inside the frame and links back to the full version.

Keep the credit link in place. Do not resell the calculator.

Formula

  • Proportion: n0 = z² × p × (1 - p) / E², with p and E as fractions (a 5-point margin is 0.05)
  • Mean: n0 = z² × σ² / E²
  • Finite population N (optional): n = n0 / (1 + (n0 - 1) / N)
  • The answer is rounded up to a whole number, and is never less than 1.

z is the normal quantile for the confidence level: 1.282 (80%), 1.645 (90%), 1.960 (95%), 2.576 (99%), 3.291 (99.9%).

Assumptions

  • Simple random sampling and independent responses.
  • For a mean, σ is an estimate from a pilot study or earlier data.
  • The calculation gives the number of completed responses. Divide by your expected response rate to know how many people to contact.

Worked example

Proportion, 95% confidence, p = 50%, margin 5 points:

  • n0 = 1.96² × 0.25 / 0.05² = 384.15, so 385
  • With a population of 1,000: 384.15 / (1 + 383.15 / 1000) = 277.73, so 278

Mean, σ = 15, margin 3, 99% confidence: n0 = 2.576² × 15² / 3² = 165.87, so 166.

Frequently asked questions

How do you calculate sample size for a proportion?

Use n = z² × p(1-p) / E². For 95% confidence (z = 1.96), p = 50% and a 5-point margin, n = 1.96² × 0.25 / 0.05² = 384.15, which rounds up to 385.

Why use 50% as the expected proportion?

p(1-p) is largest at 50%, so it gives the biggest, safest sample. If you know the true value is near 10%, you need only 865 respondents for a 2-point margin at 95%, instead of 2,401 at 50%.

When does the population size matter?

Only when your sample is a sizeable share of a small population. The correction is n = n0 / (1 + (n0 - 1) / N). With n0 = 384.15 and N = 1,000 you need 278 people instead of 385. For a population of 100,000 or more it makes almost no difference.

How do I find the sample size for a mean?

Use n = z² × σ² / E², where σ is an estimated standard deviation. For σ = 15, a margin of 3 units and 99% confidence (z = 2.576), n = 165.87, so you need 166 measurements.