Sample size calculator

This sample size calculator tells you how many participants each group needs for a study that compares two groups, or how many responses a survey needs for a given margin of error. Enter the difference you want to be able to detect, the significance level and the power, and get the number per group, the total, the number to recruit after dropout, and a sentence for your protocol or grant.

Your numbers are calculated in your browser and are not sent or stored.

Sample size calculatorOr describe it in Studio →

A measured outcome (blood pressure, score, time) in two independent groups.

Sample size per group

64

Total to analyse
128
Effect size (d)
0.5

To report

A sample of 64 per group (128 in total) gives 80% power to detect a standardized difference of d = 0.5 with a two-sided t-test at α = 0.05.

Check your result: halving the effect size should roughly quadruple n: d = 0.5 needs 64 per group and d = 0.25 needs 253. The total is twice the per-group number, 128 for d = 0.5.
per group for d = 0.5 at 80% power
64
per group for d = 0.5 at 80% power
per group to tell 50% from 30%
93
per group to tell 50% from 30%
for a survey at ±5% and 95% confidence
385
for a survey at ±5% and 95% confidence
designs: two means, two proportions, survey
3
designs: two means, two proportions, survey
  • Two means, two proportions, or a survey
  • From a raw difference or Cohen’s d
  • 80%, 90% or 95% power
  • Dropout allowance
  • Runs in your browser, free

01

How to calculate sample size

  1. Choose the outcome: a measurement (compare two means) or a yes/no result (compare two proportions).
  2. 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.
  3. Keep α = 0.05 and 80% power unless your field or funder asks for something else.
  4. Add the share of participants you expect to lose, and copy the sentence into your protocol.

02

The four numbers behind every sample size

InputMeaningEffect on n
Effect sizeThe difference you want to detect, in SD units for meansHalving it roughly quadruples n
Significance level (α)Chance of a false positive, usually 0.05Smaller α needs more participants
Power (1 − β)Chance of detecting the effect if it exists, usually 80%Higher power needs more participants
One- or two-sidedWhether an effect in either direction countsTwo-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 dThis calculatorCohen (1988) power table
0.2 (small)394 per group393
0.5 (medium)64 per group64
0.8 (large)26 per group26

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 error90% confidence95% confidence99% confidence
± 5%271385664
± 3%7521,0681,844
± 1%6,7649,60416,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

Read the full methodology · Who makes Sciloom

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.

Planning a trial? Draw the participant flow with the CONSORT diagram generator once recruitment starts.
Free to start, no sign-up.
Back to the tool ↑

More research tools