01
How to calculate sample size
- Choose the outcome: a measurement (compare two means) or a yes/no result (compare two proportions).
- Enter the smallest difference that would matter in practice, and for a measurement the standard deviation you expect, taken from a pilot or a published study.
- Keep α = 0.05 and 80% power unless your field or funder asks for something else.
- Add the share of participants you expect to lose, and copy the sentence into your protocol.
02
The four numbers behind every sample size
| Input | Meaning | Effect on n |
|---|---|---|
| Effect size | The difference you want to detect, in SD units for means | Halving it roughly quadruples n |
| Significance level (α) | Chance of a false positive, usually 0.05 | Smaller α needs more participants |
| Power (1 − β) | Chance of detecting the effect if it exists, usually 80% | Higher power needs more participants |
| One- or two-sided | Whether an effect in either direction counts | Two-sided needs more participants |
03
Formula for two means
d = difference ÷ SD
n per group = 2 × (z₁₋α/₂ + z₁₋β)² ÷ d²
That normal-distribution formula slightly underestimates small samples, because the test will use the t distribution. The calculator therefore repeats the formula with t quantiles on 2n − 2 degrees of freedom until n stops changing. For two-sided α = 0.05 and 80% power:
| Cohen’s d | This calculator | Cohen (1988) power table |
|---|---|---|
| 0.2 (small) | 394 per group | 393 |
| 0.5 (medium) | 64 per group | 64 |
| 0.8 (large) | 26 per group | 26 |
The one-participant difference at d = 0.2 comes from the approximation; exact power software uses the noncentral t distribution.
04
Formula for two proportions
n per group = [ z₁₋α/₂ √(2 p̄ (1 − p̄)) + z₁₋β √(p₁(1 − p₁) + p₂(1 − p₂)) ]² ÷ (p₁ − p₂)²
Here p̄ is the average of the two proportions. Example: to tell 50% from 30% with two-sided α = 0.05 and 80% power you need 93 per group. No continuity correction is applied; with one, the number is somewhat larger.
05
Sample size for a survey
A survey does not compare groups; it estimates a percentage. Choose “Survey (margin of error)” and the calculator uses Cochran’s formula, with z the normal value for your confidence level (1.96 for 95%), p the expected proportion and e the margin of error:
n₀ = z² × p(1 − p) ÷ e²
with a known population N: n = n₀ ÷ (1 + (n₀ − 1) ÷ N)
| Margin of error | 90% confidence | 95% confidence | 99% confidence |
|---|---|---|---|
| ± 5% | 271 | 385 | 664 |
| ± 3% | 752 | 1,068 | 1,844 |
| ± 1% | 6,764 | 9,604 | 16,588 |
For p = 50% and a large population. With a population of 1,000, ± 5% at 95% confidence needs 278 responses instead of 385. These are completed responses: divide by your expected response rate to get the number of invitations.
06
Allowing for dropout
The calculated n is the number you need to analyse. If you expect to lose some participants, recruit more:
n to recruit = n ÷ (1 − dropout rate)
For 64 per group and 15% dropout that is 64 ÷ 0.85 = 75.3, so 76 per group.
07
What this calculator covers
- Two independent groups of equal size, analysed with a t-test or a test of two proportions.
- It does not cover paired or crossover designs, more than two groups, cluster randomisation, survival outcomes or non-inferiority margins. Those need dedicated power software or a statistician.
- The answer is only as good as the effect size and SD you enter. Take them from the smallest difference that matters and from real data, not from the result you hope for.
- After the study, analyse the data with the t-test calculator.
08
Common mistakes in sample size calculations
- Adding dropout instead of dividing for it. For 64 per group and 10% dropout, 64 × 1.1 gives 71, but 64 ÷ 0.9 gives 72, the number that leaves 64 after losses. The calculator divides.
- An optimistic effect size. 64 per group gives 80.7% power for d = 0.5, but only 61.9% if the true effect is d = 0.4.
- Reading n as the total. 64 is per group; the study needs 128 people before dropout.
Trust
How this page is checked
- The calculation runs on code with automated tests against worked reference values. Every number in the examples on this page was produced by that same code, not typed by hand.
- The formulas and conventions used are stated on the page, so you can reproduce the result yourself or compare it with your own software.
- Last reviewed by the Sciloom team, Zebra Nine Studio Inc. It is a tool for research and teaching, not a substitute for a statistician, a validated lab method or medical advice.
Cite this page
Sciloom. (2026). Sample size calculator. Zebra Nine Studio Inc. https://sciloom.si/sample-size-calculator
Frequently asked questions
How do I calculate the sample size for a study?
Decide the smallest difference worth detecting, estimate the standard deviation, and choose a significance level and power. The calculator combines them into the number of participants per group.
What sample size do I need for 80% power?
It depends on the effect size. With a two-sided test at 0.05, a medium effect (d = 0.5) needs 64 per group and a large effect (d = 0.8) needs 26 per group.
What is a good effect size to use?
Use the smallest difference that would change practice, divided by a realistic standard deviation. Cohen’s 0.2, 0.5 and 0.8 are a fallback when you have no better information.
How many survey responses do I need?
For a margin of error of ±5% at 95% confidence, 385 completed responses when the population is large. Smaller populations need fewer: 278 for a population of 1,000.
Is this the sample size per group or in total?
The large number is per group. The total for both groups and the number to recruit after dropout are listed below it.