Sample size and power calculator
Answer three questions in plain lab terms and the required n appears instantly. The calculations use the exact noncentral t and F distributions and reproduce the published examples of G*Power and the R pwr package.
Your numbers are processed only in this browser. Nothing is sent to a server (it is gone when you close the page).
Use values from a pilot experiment or a paper. Enter the SD, not the SEM, and it should be the spread of biological replicates (animals, independent experiments). If the SDs differ, enter both (the root mean square of the two SDs is used).
d = difference in means / SD. Conventions: 0.2 small, 0.5 medium, 0.8 large (Cohen 1988), but real means and SDs from your system are more reliable.
Mean and SD of the within-subject differences — not the SD of each condition.
Don’t know the SD of the differences? Compute it from each SD and the correlation
SD of differences = √(SD₁² + SD₂² − 2·r·SD₁·SD₂). If the correlation is unknown, a cautious 0.5 is common (with equal SDs and r = 0.5, the SD of the differences equals each SD).
The effect size for the paired t test. Unlike d, it grows as the before/after correlation gets stronger.
3 to 20 groups. Enter the expected mean of each group and the within-group SD (assumed similar in all groups).
f = SD of the group means / SD. Conventions: 0.10 small, 0.25 medium, 0.40 large (Cohen 1988).
e.g. if 30% of control mice develop a tumor and you expect 60% with treatment, enter 30 and 60.
Adds a margin for animals lost or failed cultures. Enter a planned n to see its power and the smallest effect it can detect.
How to use it
- Choose what you compare. Separate animals or samples: “Two separate groups”; the same subjects before/after or experiments run side by side: “Before/after or pairs”; three or more: “Three or more groups”; yes/no outcomes: “Proportions”.
- Enter the difference you expect. Type the means and SD from a pilot experiment or a paper; the effect size is computed for you.
- Choose α and power. Usually α = 0.05 (two-sided) and 80% or 90% power. Add the expected dropout in %.
You get the required n, a power curve (power as n changes), power at common sizes (3, 4, 5, 6…), a ready-to-paste Methods sentence and the calculation details (df, critical value, noncentrality).
Choosing the expected difference
| Approach | When | Watch out for |
|---|---|---|
| Pilot data | You ran a small version in the same system | Small pilots tend to overestimate the effect (you go ahead because the difference looked big), and their SD is uncertain |
| A previous study | A paper used the same or a similar system | If error bars are SEM, convert: SD = SEM × √n. Check what n counted (cells or animals) |
| Smallest meaningful difference | You can say “a smaller difference would not matter” | The most honest choice, e.g. “at least a 10% change in body weight” |
Cohen’s conventions (d: 0.2 small, 0.5 medium, 0.8 large) came from behavioral science; differences in cell and animal experiments are often larger. Real means and SDs are more reliable than conventions.
- Use the SD, not the SEM. An SEM makes the effect look √n times larger and gives too small an n
- The SD must describe biological replicates. The SD of repeated measurements of the same sample (technical replicates) is far too small
- Try a few scenarios and check that n is still adequate on the dashed curve (effect only 3/4 as large)
What n counts
The n here is the number of experimental units — the smallest units that independently receive the treatment: animals (or cages, if diet is given per cage), independent experiments for cultured cells, biological samples for qPCR — not cells or the three wells of one sample. Counting cells as n makes P values misleadingly small (pseudoreplication); see what n counts: biological vs technical replicates and pseudoreplication and SuperPlots.
What α and power mean
| Meaning | Usual value | |
|---|---|---|
| Significance level α | The rate of calling a difference significant when there is none | 0.05 (two-sided) |
| Power 1 − β | The chance of a significant result when the expected difference really exists | 80% or 90% |
80% power means that even if the expected difference is real, one experiment in five will miss it. When you want to use fewer animals, an underpowered study is the most wasteful option, because it often has to be repeated. Use a one-sided test only if you decided before the experiment that a difference in the other direction is of no interest.
Common mistakes
- “n = 3 by convention.” Even in the two-group example (a fairly large d = 1.2), power with n = 3 per group is about 21%, so the difference is missed nearly four times out of five. Check “Power at common sample sizes” in the result.
- Computing power after the experiment. “Observed power” computed from the observed effect is determined by the P value and adds nothing (Hoenig & Heisey 2001). If the result is not significant, report the confidence interval of the difference.
- Sizing only for the overall ANOVA. Pairwise comparisons afterwards (Tukey, Dunnett) have less power than the overall F test. Run a two-group calculation for the comparison that matters most.
- Planning with a t test but analyzing nonparametrically. For Mann–Whitney or Wilcoxon, add about 15% (the asymptotic relative efficiency is 0.955 for normal data and at least 0.864 for any distribution; Hodges & Lehmann 1956).
Reporting it
ARRIVE 2.0 (the reporting guideline for animal research) asks in item 2b how the sample size was decided and for details of any a priori calculation. The generated sentence states the test, α, power, the expected difference and its source, the required n and the dropout margin. For the whole statistics paragraph see how to write the statistical analysis section, and check your manuscript with the statistics checklist.
Methods and validation
For the two-sample t test with n per group, power uses the noncentral t distribution with 2n − 2 degrees of freedom and noncentrality δ = d·√(n/2), including rejections in the opposite direction for two-sided tests (as G*Power and R’s pwr). The paired t test uses n − 1 df and δ = dz·√n. One-way ANOVA with k groups of n uses F(k − 1, kn − k) and the noncentral F distribution with λ = f²·kn (f = SD of the group means / SD). Two proportions use the same normal approximation as R’s power.prop.test (no continuity correction). The required n is the smallest whole number reaching the target power (as in G*Power); the unrounded n returned by pwr and R is shown under “Calculation details”.
The table compares the calculator with published examples (the values are recomputed by this calculator every time the page is built). In addition, about 360 t-test and ANOVA power values were compared with SciPy 1.18 nct and ncf (an independent implementation; proportions were recomputed with the same formula in Python); the largest difference was about 1 × 10⁻¹⁰.
| Source | Example | Quantity | Published | This calculator |
|---|---|---|---|---|
| G*Power 3.1 manual §1.2.3 | t (unpaired), one-sided, d = 0.5, α = .05, power .95 | n per group | 88 | 88 |
| pwr (R) vignette | pwr.t.test(n = 30, d = 0.5) | power | 0.4778965 | 0.4778965 |
| pwr (R) vignette | pwr.t.test(d = 0.5, power = 0.80) | n | 63.76561 | 63.76561 |
| pwr (R) vignette | pwr.t2n.test(n1 = 28, n2 = 35, d = 0.5) | power | 0.4924588 | 0.4924588 |
| G*Power 3.1 manual §19.3 | paired, dz = 0.421637, N = 50, two-sided | power | 0.832114 | 0.832114 |
| G*Power 3.1 manual §19.3 | paired, dz = 0.2828427, N = 50, two-sided | power | 0.500352 | 0.500352 |
| pwr (R) vignette | pwr.t.test(n = 24, d = 0.32, paired, greater) | power | 0.4508691 | 0.4508691 |
| pwr (R) vignette | pwr.t.test(d = 0.32, power = 0.8, paired, greater) | n | 61.75209 | 61.75209 |
| G*Power 3.1 manual §10.3 | ANOVA, k = 10, f = 0.25, α = .05, power .95 | total N | 390 | 390 |
| G*Power 3.1 manual §10.3 | (same) actual power | power | 0.952363 | 0.952363 |
| pwr (R) vignette | pwr.anova.test(k = 3, f = 0.25, α = .01, power = 0.9) | n | 94.48714 | 94.48713 |
| R stats | power.anova.test(groups = 4, n = 5, between.var = 1, within.var = 3) | power | 0.3535594 | 0.3535594 |
| R stats | power.anova.test(means 120, 130, 140, 150, within.var = 500, power = .90) | n | 15.18834 | 15.18833 |
| R stats | power.prop.test(n = 50, p1 = .50, p2 = .75) | power | 0.740 | 0.740 |
| R stats | power.prop.test(p1 = .50, p2 = .75, power = .90) | n | 76.7 | 76.7 |
| R stats | power.prop.test(p1 = .90, p2 = 1.0, power = 0.8) | n | 73.37 | 73.37 |
Sources: G*Power 3.1 Manual (Heinrich-Heine-Universität Düsseldorf), the pwr package vignette (Champely et al.), and the examples of power.anova.test and power.prop.test in R’s stats package. The n values from pwr and R are numerical root-finding results; differences around the fourth decimal are within their tolerance.
FAQ
Does it give the same results as G*Power?
Yes. The two-sample and paired t tests and one-way ANOVA use the same definitions as G*Power (effect sizes d, dz and f; noncentral t and F distributions) and reproduce the examples in the G*Power 3.1 manual. For two proportions, the method is the normal approximation of R’s power.prop.test (G*Power lets you choose a z test or Fisher’s exact test; analysis by Fisher’s exact test needs a somewhat larger n than shown here).
Isn’t n = 3 enough?
Only for very large effects (d above about 3). For typical effects, power at n = 3 is low. Check power at n = 3, 4, 5… in the result.
What if I want unequal group sizes?
This calculator assumes equal n per group. For a fixed total, equal groups give the highest power.
What about experiments that were not planned this way?
Do not compute power afterwards. Describe honestly how n was chosen and report confidence intervals; use this calculator to plan the next experiment.
Is my data sent anywhere?
No. Everything runs in your browser and nothing is sent to a server.
Other calculators
Related guides
Product names are trademarks or registered trademarks of their respective owners.