Plan an experiment · Calculate
Sample size calculator for t-tests (two groups or paired)
Work out how many animals or subjects you need, the power of a planned design, or the smallest effect it can detect. Runs in your browser and is checked against R, SciPy and statsmodels.
Calculator
Enter your assumptions to calculate.
Show methods paragraph
Calculated in your browser. The numbers you enter are not sent anywhere.
On this page
What the number means
The calculator answers one of three questions for a planned t-test:
- Sample size: how many animals (or subjects) per group give the target power to detect the difference you care about.
- Power for a given n: the chance that an experiment of that size gives p < α if the true difference is the one you entered.
- Smallest detectable effect: with the n you can afford, the smallest true difference you would detect with the target power (a sensitivity analysis).
Power is a property of the design and the assumed effect, worked out before the data exist; for a result you already have, report its confidence interval instead.
A worked example
You expect a treatment to raise a serum marker by 10 pg/mL, and pilot data suggest a standard deviation of about 12 pg/mL within each group. That is a standardised difference d = 10 ÷ 12 = 0.83.
- For a two-sided test at α = 0.05 with 80% power you need 24 mice per group (48 in total); the achieved power at 24 is 80.7%.
- If 10% of animals may be lost, plan for 24 ÷ 0.9 → 27 per group.
- If the SD is really 15 rather than 12, the same difference needs 37 per group. The SD you assume matters as much as the difference.
- If you can only use 6 per group, the power for this effect is just 26%, and the smallest effect you could detect with 80% power is d = 1.80 — about 22 pg/mL at SD 12.
- Allocating twice as many animals to one group (ratio 2) needs 18 and 36 — 54 in total instead of 48.
Get the inputs right
Where does the effect come from? The answer is only as good as the difference and SD you enter. Base them on pilot data, published studies of the same measure, or the smallest difference that would matter scientifically — and write that source down. Choosing a generic “small”, “medium” or “large” effect because it is conventional, rather than because it fits your system, simply reproduces the sample sizes used in past studies and gives the number no real justification — a habit the statistician Russell Lenth singled out in his advice on sample size determination (Lenth, archived advice page). Record the source next to the number in your protocol.
Is it a t-test design? This calculator covers two independent groups and paired measurements with a continuous outcome. For three or more groups, repeated measures over time, counts or survival, use a calculation built for that design.
Is n the right unit? Enter the number of independent units — animals, cultures, patients — not wells or cells. See what n means at small sizes.
Several comparisons? If the study will test several outcomes or pairs of groups with a multiplicity correction, enter the corrected α — for example 0.05 ÷ 3 = 0.0167 for three Bonferroni-corrected comparisons — so the plan matches the analysis.
Equal SDs in the plan, Welch in the analysis. The standard planning formula assumes the two groups have equal SDs. If you will analyse with Welch’s t-test and expect one group to be more variable, plan with the larger SD.
Paired designs need the SD of the differences. For before/after or matched designs, enter the SD of the within-pair changes, not of the raw values. It is usually much smaller, which is why paired designs need fewer subjects. If you only know the raw SDs, estimate it as √(SD₁² + SD₂² − 2r·SD₁·SD₂) using the correlation r between paired values from pilot data.
How it is calculated
For two independent groups of sizes n₁ and n₂ with standardised difference d, the test statistic follows a noncentral t distribution with
- degrees of freedom df = n₁ + n₂ − 2, and
- noncentrality δ = d · √(n₁ n₂ / (n₁ + n₂)).
For a paired design with n pairs and d_z = mean change ÷ SD of changes: df = n − 1 and δ = d_z · √n.
Power is the probability that |T| exceeds the critical value t₁₋α/₂, df (two-sided) or that T exceeds t₁₋α, df (one-sided), where T follows the noncentral t distribution. This is the same model used by G*Power (Faul et al. 2007), R’s pwr.t.test and statsmodels’ TTestIndPower. The required n is the smallest whole number reaching the target power; the calculator reports the power actually achieved at that n.
The noncentral t distribution is computed with Lenth’s Algorithm AS 243 and the regularised incomplete beta function; critical values come from inverting the central t distribution. Everything runs in your browser.
Checked against reference software
Each release is compared automatically with independent implementations; a failing check blocks publication. The results of the current version:
| What is checked | Reference | Cases | Largest difference |
|---|---|---|---|
| Noncentral t CDF | SciPy 1.18.1 stats.nct |
496 (df 1–1000, δ 0–10) | 3 × 10⁻¹³ |
| Central t quantiles | SciPy 1.18.1 stats.t.ppf |
60 | 1.4 × 10⁻¹² (relative) |
| Required n and achieved power | Exact search with SciPy | 168 (two-group, paired, α, power, sides, allocation) | n identical in every case; power within 8 × 10⁻¹³ |
| Required n | statsmodels 0.15.0 solve_power |
6 | identical (rounded up) |
| Required n | R 4.3.3, pwr 1.3-0 pwr.t.test |
20 | identical (rounded up) |
| Smallest detectable effect | SciPy | 4 | within 10⁻⁶ |
While building these checks we found that SciPy’s stats.nct.cdf returns NaN for a few extreme lower-tail values (large noncentrality, very negative t), where the true value is below 10⁻¹³. In SciPy itself this can make a whole power calculation return NaN for small, large-effect designs. We reported six such cases with high-precision references to SciPy issue #25470 on November 10, 2026 (details and reproduction). This calculator uses its own implementation, which returns a value at rounding level instead of NaN, so its results are unaffected; those cases are excluded from the SciPy comparison.
Questions a reviewer may ask
“Please justify your sample size.” ARRIVE 2.0 asks authors to explain how the sample size was decided and give the details of any a priori calculation (item 2b). State the difference and SD you assumed, where they came from, α, power, sidedness and the resulting n — the methods paragraph the calculator produces contains all of them. Incomplete reporting is common: in a sample of 95 published G*Power calculations, only 2% could be reproduced without making assumptions and 14% reported all the parameters needed (Thibault et al. 2024, preprint, not peer reviewed).
“What was the power of your study?” after a non-significant result. Do not calculate power from the effect you observed — “observed power” is just a transformation of the p-value and adds no information (Hoenig & Heisey 2001). Report the confidence interval instead, and, if useful, a sensitivity analysis: the smallest effect your n could have detected.
Report it
Use Copy methods paragraph in the calculator, then fill in the source of your assumptions. For the worked example:
Sample size was calculated a priori for a two-sided two-sample t-test at α = 0.05 with 80% target power to detect a difference of 10 pg/mL with a standard deviation of 12 pg/mL (d = 0.83), based on [pilot data / reference]. This required 24 animals per group (achieved power 80.7%), increased to 27 per group to allow for 10% attrition.
How SciGround helps
SciGround’s experiment planning calculates power or the required sample size from the effect, variability, significance level and allocation you state, rechecks the rounded-up sample size, and keeps every assumption printed next to the number, so the plan can be locked before results exist.
Cite this tool
Licklider. Sample size calculator for t-tests. https://www.licklider.ai/tools/sample-size-calculator/ (version 1.0, accessed [date]).
Changelog: version 1.0 (10 November 2026) — two independent groups and paired designs; sample size, power and smallest detectable effect.
References
- Faul F, Erdfelder E, Lang A-G, Buchner A (2007). G*Power 3: a flexible statistical power analysis program for the social, behavioral, and biomedical sciences. Behavior Research Methods 39(2):175–191. doi:10.3758/BF03193146
- Hoenig JM, Heisey DM (2001). The abuse of power: the pervasive fallacy of power calculations for data analysis. The American Statistician 55(1):19–24. doi:10.1198/000313001300339897
- Lenth RV (1989). Algorithm AS 243: cumulative distribution function of the non-central t distribution. Journal of the Royal Statistical Society, Series C (Applied Statistics) 38(1):185–189. doi:10.2307/2347693
- Lenth RV. Java applets for power and sample size — advice on sample size determination (archived 14 January 2021). Archived page
- Thibault RT, et al. (2024). An evaluation of reproducibility and errors in published sample size calculations performed using G*Power. medRxiv (preprint, not peer reviewed). doi:10.1101/2024.07.15.24310458
- Percie du Sert N, Hurst V, Ahluwalia A, et al. (2020). The ARRIVE guidelines 2.0: updated guidelines for reporting animal research. PLOS Biology 18(7):e3000410. doi:10.1371/journal.pbio.3000410
How this page was made
- Built and published by Licklider. The calculation runs in your browser using the noncentral t distribution (Lenth's Algorithm AS 243).
- Every release is checked automatically against SciPy 1.18.1, statsmodels 0.15.0 and R 4.3.3 with pwr 1.3-0 (see 'Checked against reference software'); a failing check blocks publication.
- Separate review passes checked the statistics, the citations and readability before publication.