Sample size calculator
Work out how many participants you need to estimate a proportion or a mean, or to compare exposure in cases and controls.
Your data does not go to our server. This tool runs in your browser; what you type or open never leaves your device.
This calculator needs JavaScript, because it calculates in your browser and sends nothing. Turn JavaScript on to use it. How it is calculated is explained below.
- Required sample size
- Cases (and the same number of controls)
- Total participants
- Expected exposure among cases
How it is calculated
For a proportion or a mean the sample is chosen so that the confidence interval is no wider than the precision you enter; z is 1.96 for 95 % confidence. With a known population the result is reduced by the finite population correction.
For a case-control study the calculator gives the number of cases; the same number of controls is needed (1:1). The result is always rounded up.
n = z² × p × (1 − p) / d²n = z² × SD² / d²n = n₀ / (1 + (n₀ − 1) / N)n per group = (z₁₋α/₂ + z₁₋β)² × [p₁(1 − p₁) + p₀(1 − p₀)] / (p₁ − p₀)², p₁ = OR × p₀ / (1 − p₀ + OR × p₀)
Worked example: Expected proportion 50 %, precision 5 points, 95 % confidence: 385 participants.
Sources
These calculators support research; they do not replace the advice of a statistician or a clinician.
Questions
What is the "precision" I have to enter?
It is the half-width of the confidence interval you are willing to accept, for example 5 percentage points around the expected proportion. A smaller precision needs a larger sample.