Research Sample Size Calculator

Estimate sample size for a proportion or mean at a chosen confidence level.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Work out how many responses you need. In proportion mode, give a confidence level, a margin of error and an expected proportion; at 95% confidence, a 5% margin and p = 0.5 you need 385. In mean mode, give the margin of error and the standard deviation.

How to use

1
Step 1
Choose Proportion or Mean.
2
Step 2
Enter the confidence level as a percent between 0 and 100 (90, 95, 99 or any other) and the margin of error (0.05 means 5% for a proportion).
3
Step 3
Enter the expected p, or the SD for a mean, and press Calculate.

How it works

For a proportion, n = z²·p·(1 − p) / e². The most cautious choice, p = 0.5, gives the largest n. For a mean, n = (z·σ / e)². z is the inverse normal value for your confidence level (1.6449 for 90%, 1.9600 for 95%, 2.5758 for 99%), and any level between 0 and 100 works. The result is the exact formula value rounded up once at the end.

proportion: n = z²·p(1 − p) / e²      mean: n = (z·σ / e)²

Worked example

A survey at 99% confidence

Input
Proportion, 99% confidence, margin 0.03, p 0.5
Output
n = 1844
Walkthrough
2.57583² × 0.5 × 0.5 / 0.03² = 1,843.03, rounded up to 1,844. At 95% with a 0.05 margin the same formula gives 385.

Limitations

  • The confidence level must be strictly between 0 and 100; 0 or 100 returns an error.
  • Mean mode needs the standard deviation in advance. With σ = 10 and e = 2 at 95% it gives 97 (1.95996 × 10 ÷ 2 = 9.7998, squared 96.04, rounded up).
  • No finite population correction for small populations.
  • Assumes simple random sampling.

Questions

How many responses do I need for a survey?
At 95% confidence with a 5% margin of error and p = 0.5, you need 385.
Why use p = 0.5?
It gives the largest required sample, so it is the safe choice when you do not know the true proportion.
How does the margin of error change the sample size?
Halving the margin roughly quadruples the sample size.
Can I use a confidence level such as 80% or 97%?
Yes. For a proportion with a 5% margin and p = 0.5, 80% needs 165 and 97% needs 471.
Does it correct for a small population?
No. For small populations the true requirement is lower.

Features

  • Proportion and mean
  • Any confidence level
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Learn JSON - Full Crash Course

    freeCodeCamp.org

    JSON is a primary interchange format for data utilities.

    Watch on YouTube
  • Mean, Variance and Standard Deviation

    StatQuest with Josh Starmer

    Spread metrics when analyzing pasted datasets.

    Watch on YouTube
  • Fetch API

    MDN

    How browsers pull remote data into local tools.

  • Data Index

    Math is Fun

    Stats explainers when summarizing columns.