Sample Size Calculator

Plan a comparative clinical study with the arithmetic in the open. Choose a design, enter the effect you need to detect, and get the per-group sample size, the total, and an attrition-adjusted recruitment target. The calculator uses standard normal approximations and shows its formula — no black box, no sign-up, and your inputs never leave your browser. 浏览器本地计算,免费使用。

Two independent means

For a continuous outcome compared between two independent groups, such as change in systolic blood pressure.

Use the standard deviation of the outcome you will analyse — for a change score, use the SD of the change, not the SD of baseline or follow-up alone.

Two independent proportions

For a binary outcome compared between two independent groups, such as response, remission or a safety event.

Enter proportions as percentages. This module uses the usual normal approximation for a two-proportion comparison, without a continuity correction.

Non-inferiority

For showing that a new treatment is not unacceptably worse than a reference treatment by more than a pre-specified margin.

The margin must be justified clinically and pre-specified before the trial starts. For the binary form, the calculator derives the expected difference from the two proportions you enter.

Required sample size

These are planning calculations, not a substitute for the statistical section of a protocol. Confirm the final number with your trial statistician, especially for small samples, clustered designs, survival outcomes, repeated measures or analyses adjusted for covariates.

How the calculations work

  1. Start with the analysis. The sample size follows the primary comparison you plan to run. A calculator cannot rescue an undefined primary outcome, an unrealistic effect size or a margin chosen after seeing the data.
  2. Two means. With allocation ratio r = n₂/n₁, the normal-approximation formula is n₁ = (zα + zpower)² (σ₁² + σ₂²/r) / Δ², and n₂ = r·n₁. Group sizes are rounded up.
  3. Two proportions. The calculation uses a pooled variance under the null hypothesis and the group-specific variances under the alternative — the standard normal approximation behind most protocol calculations. No continuity correction is applied.
  4. Non-inferiority. What matters is the distance between the expected treatment difference and the non-inferiority boundary. If the expected difference already sits on the wrong side of that boundary, no finite sample size can fix the design.
  5. Attrition. The recruitment target is nadjusted = n / (1 − attrition). This assumes participants lost to follow-up contribute no primary-outcome information.

Frequently asked questions

Why does another calculator give a slightly different answer?
Usually because it uses an exact test, a t-based iteration, a continuity correction or a different variance formula. Small differences of one or two participants per group are common. For a two-sample t-test, an exact noncentral-t calculation can require slightly more participants than the normal approximation when the sample is small.

Should I use 80% or 90% power?
Eighty percent is the common convention; ninety percent is safer when recruitment is feasible, the outcome is noisy, or a negative trial would be especially costly. Power is a design choice to justify in the protocol, not a number to copy by habit.

Can I use this for a paired design, survival outcome or cluster trial?
Not directly. Paired designs need the SD of within-person differences; survival outcomes are usually powered on the number of events; cluster trials need an intracluster correlation and a design effect. Those require different formulas.

Is my data uploaded anywhere?
No. All arithmetic happens locally in your browser.

Can I trust the numbers?
The formulas were cross-checked against independent calculations before release. Even so, treat this as a transparent planning and checking aid — the protocol's final sample size should be reproduced in your primary statistical software.

Does the calculator adjust for dropout or loss to follow-up?
Yes. Enter the expected attrition percentage and the recruitment target is inflated automatically as n / (1 − attrition), so the analysable sample still reaches the required size if losses match your estimate.

How do I calculate a sample size without G*Power, SPSS or PASS?
Choose your design above — two independent means, two independent proportions, or a non-inferiority comparison — enter alpha, power and the effect you need to detect, and the per-group sample size, the total and the attrition-adjusted recruitment target are shown together with the formula used. Everything runs in your browser; nothing is installed.

📚 Go deeper — the full workflow, step by step. The author also writes a paid Chinese column, 《Meta 分析实操手记》, covering the whole meta-analysis pipeline: choosing a question, building a reproducible search, dual screening & extraction, RoB 2 judgements, and reading forest plots — one practical instalment each week. Join on Zhishixingqiu (Knowledge Planet) — early-bird ¥99. 系统学全流程的中文专栏,每周一篇实操。
More free tools from Meta Workbench: Forest Plot Generator · PRISMA Flow Diagram Generator · RoB 2 Traffic Light Plot Generator · All tools