Skip to content

Sample Size Calculator — Step-by-Step Solutions

The Sample Size Calculator determines how many observations you need for a statistically valid study. Calculate the required sample size for proportion-based surveys, mean-based studies, or find the margin of error for a given sample size.

Select your confidence level, enter your parameters, and get the required sample size instantly with step-by-step formula breakdowns.

Your calculations will appear here

How to Use the Sample Size Calculator

  1. Pick what you need: Sample Size (Proportion) for yes/no survey questions, Sample Size (Mean) for measured quantities, or Margin of Error if you already have a sample size and want to know how precise it is.
  2. Choose the confidence level from the list (80%, 85%, 90%, 95% or 99%). 95% is the usual choice for surveys and research.
  3. For a proportion, enter the margin of error as a decimal (0.05 means plus or minus 5 percentage points) and your estimated proportion. If you have no idea what the proportion will be, use 0.5, which gives the largest and safest sample.
  4. For a mean, enter the margin of error in the same units as your measurement and the population standard deviation, taken from a pilot study or earlier research. The result is always rounded up to the next whole person.

Formula and Theory

A sample size calculation answers one question: how many responses do you need so that your estimate is within a chosen margin of error, with a chosen level of confidence. A narrower margin or a higher confidence level both demand a larger sample, and the cost grows quickly: halving the margin of error needs about four times as many responses.

For a proportion, n = z^2 x p x (1 - p) / E^2, where z is the critical value for the confidence level (1.96 for 95%), p is the expected proportion and E is the margin of error. The product p(1 - p) is largest at p = 0.5, so 0.5 is the conservative choice when nothing is known.

For a mean, n = (z x sigma / E)^2, where sigma is the population standard deviation. A noisier measurement (larger sigma) needs a bigger sample for the same precision.

These formulas assume simple random sampling from a large population. Sample size does not depend much on population size unless the sample is a large share of it. Expect real surveys to need extra invitations to allow for people who do not respond.

Worked Examples

Example 1: Survey sample size for a proportion

Problem: How many people must you survey to estimate a proportion within plus or minus 5% at 95% confidence, with no prior estimate?

Solution: Use z = 1.96, E = 0.05 and p = 0.5. n = 1.96^2 x 0.5 x 0.5 / 0.05^2 = 3.8416 x 0.25 / 0.0025 = 384.16. Round up to the next whole person.

Answer: n = 385

Example 2: Sample size for a mean

Problem: You want to estimate average task time within 2.5 minutes at 95% confidence. Earlier studies suggest a standard deviation of 15 minutes.

Solution: n = (z x sigma / E)^2 = (1.96 x 15 / 2.5)^2 = (11.76)^2 = 138.30. Round up.

Answer: n = 139

Example 3: Margin of error for a given sample

Problem: You already have 400 responses. What margin of error does that give at 95% confidence for a proportion near 50%?

Solution: E = z x sqrt(p(1 - p) / n) = 1.96 x sqrt(0.25 / 400) = 1.96 x 0.025 = 0.049.

Answer: Margin of error = plus or minus 4.9 percentage points

Example 4: A known proportion needs fewer responses

Problem: You expect about 20% of people to say yes and want a margin of 3% at 99% confidence.

Solution: z for 99% is 2.5758. n = 2.5758^2 x 0.2 x 0.8 / 0.03^2 = 6.6347 x 0.16 / 0.0009 = 1179.5, which rounds up to the next whole person.

Answer: n = 1,180

Frequently Asked Questions

How many survey responses do I need?
For a plus or minus 5% margin at 95% confidence you need 385 responses; for plus or minus 3% about 1,068; for plus or minus 1% about 9,604. Use the calculator to match your own margin and confidence level.
Why use 0.5 when I do not know the proportion?
Because p(1 - p) peaks at 0.5, which gives the largest possible sample size. A sample sized for 0.5 is large enough for any true proportion.
Does the population size matter?
Only when the sample is a large share of the population. For populations over a few thousand the required sample barely changes. If your population is small, for instance 500 employees, the sample can be reduced with a finite population correction.
What is a margin of error?
It is the half-width of the confidence interval around your estimate. If a poll finds 52% with a margin of error of plus or minus 3 points, the plausible range is 49% to 55%.
How do I get the standard deviation before I run the study?
Take it from a pilot sample, from published studies of a similar group, or estimate it as the range divided by 4. A rough value is acceptable, but a low guess will leave you with too few responses.
Is this sample size for a hypothesis test?
No. This calculator sizes a sample for estimating a value to a given precision. Planning a test to detect a difference needs a power analysis, which also depends on the effect size you want to detect.

Related Statistics Calculators

Related Articles