Sample size calculator

This calculator estimates how many participants a study needs for four common designs: comparing two independent means, comparing two proportions, estimating a single proportion to a chosen margin of error, and testing a correlation. It is for researchers writing a protocol, grant application or ethics submission who need a defensible number and the formula behind it. You can set alpha, power, one- or two-sided testing, an allocation ratio and expected dropout. Results are given per group and in total, rounded up. Everything runs in your browser and nothing you enter is uploaded.

Loading tool…

How to use

  1. Choose the design: two independent means, two proportions, a single proportion or a correlation.
  2. Enter the effect you plan for: Cohen's d or two means with a standard deviation, two proportions, an expected proportion with a margin of error, or a correlation.
  3. Set alpha, power, one- or two-sided testing and the allocation ratio between groups.
  4. Add the dropout rate you expect so the sample is inflated to cover losses.
  5. Read the per-group and total sample size, and note the formula shown for your methods section or protocol.

Notes

Plan for the smallest effect that would matter in practice. The effect you hope to see is usually larger, and estimates from pilot studies or a single earlier trial are imprecise and often too optimistic, so a sample sized on them can be too small. Where you can, base the number on a minimal important difference for your outcome or on several published estimates, and say which in your protocol.

Dropout inflation divides the calculated sample size by one minus the expected dropout rate. With 20% dropout, 100 analysable participants means recruiting 125, because 20% of 125 is 25. Adding 20% to 100 gives only 120 and leaves the study short. Base the rate on similar studies in your setting and round up again after inflating.

The formulas use the normal approximation. For small samples, exact t-based calculations or specialised software can give a slightly larger number. For example, with d = 0.5, a two-sided alpha of 0.05 and 80% power, the normal approximation gives 63 per group and a t-based calculation gives 64.

Cluster-randomised trials, repeated measures, multilevel models, survival outcomes, and non-inferiority or equivalence designs need different methods. For these, and whenever a funder or ethics committee will scrutinise the number, ask a statistician to check the calculation.

Frequently asked questions

What effect size should I plan for if I have no prior data?

Start from the smallest difference that would change practice or theory in your field, and express it in the units of your outcome before converting it to a standardised effect. Cohen's conventions of 0.2, 0.5 and 0.8 for small, medium and large d are a last resort, because what counts as large differs between fields. Whatever you choose, state where it came from.

Why is the sample size rounded up?

A calculated sample size is a minimum. Rounding 62.3 down to 62 would leave power slightly below your target, so group sizes are rounded up to the next whole participant. The same logic applies after you allow for dropout: always round the inflated number up rather than to the nearest whole number.

Should I use a one-sided or a two-sided test?

Use a two-sided test unless a difference in the other direction would truly be of no interest and you decided this before collecting data. Reviewers and ethics committees generally expect two-sided tests. A one-sided test needs fewer participants for the same power, which is exactly why the choice has to be justified in your protocol.

How does an unequal allocation ratio change the result?

For a fixed total, equal groups give the most power. A ratio such as 2:1 can make sense when one arm is cheaper to run or when you want more experience with a new treatment, but the total sample size rises. When comparing two means, moving from 1:1 to 2:1 increases the total needed by 12.5%.

Can I use this for a cluster-randomised trial or repeated measures?

Only as a starting point. Participants in the same cluster tend to be alike, so a cluster trial needs its sample inflated by a design effect that depends on cluster size and the intracluster correlation. Repeated measures and multilevel designs need methods that model the correlation between measurements. Ask a statistician to run the calculation for these designs.

When your results are in, the statistics check in UltraResearcher's Prepare to submit tools recomputes p-values from the test statistics you report. →