Sample size calculator
Unlimited free sample size calculations for means and proportions. Get per-group analyzable and recruitment totals using a normal approximation.
Sample size
Formula and supported method
Independent shift=d/sqrt(1/n1+1/n2); paired/one-sample shift=d sqrt(n). Power=Φ(shift−zcrit)+Φ(−shift−zcrit) for two-sided; solve numerically, ceil each group, then ceil(n/(1−attrition)). Binary effect is Cohen h=2 asin sqrt(p1)−2 asin sqrt(p2).
Normal approximation, NOT noncentral t or exact binomial. Independent groups use common planning SD; paired use SD of differences. No cluster, survival, regression or noninferiority designs.
Worked example: d=.5, alpha=.05, power=.8, equal allocation, two-sided: 63+63 analyzable; 10% attrition: 70+70 recruited.
Method reference · Implementation 2026-09-14
Unlimited local calculations, no login. Inputs and results are not saved or transferred to AnswerThis. Copy or download before leaving.
Continue your research in AnswerThis
Explore the AnswerThis app. This calculation is not saved or transferred; copy or download it first.
How to use sample size calculator
- Choose the study design and a scientifically meaningful planning effect.
- Set alpha, target power, sidedness and allocation; enter attrition as a percentage.
- Calculate and distinguish analyzable counts from per-group recruitment targets.
- Copy or download the text or CSV result with its assumptions before leaving; the page does not retain it.
Specify the design and a meaningful planning effect
Choose between two independent means, paired means, a one-sample mean, two independent proportions and a one-sample proportion. The independent designs allow an allocation ratio n2/n1. A ratio of two plans twice as many observations in group 2 as in group 1 before integer rounding. Paired designs count complete pairs, usually one participant measured under two conditions; the displayed total counts participants or pairs once. One-sample designs compare observations with a prespecified reference. These distinctions determine the effective sample size in the power equation and cannot be repaired by changing the final total after calculation.
For means, enter a positive standardized effect magnitude. Independent means use the absolute expected difference divided by a common planning SD. Paired means use the absolute expected within-pair difference divided by the SD of those differences, which depends on within-person correlation. The one-sample mean uses the difference from the reference divided by the planning SD. Choose a difference that matters scientifically, supported by relevant prior evidence where possible. A noisy pilot estimate can exaggerate the effect and produce an optimistic sample size. Repeat the calculation for plausible smaller effects and larger standard deviations to understand the sensitivity of the recruitment target.
Normal-approximation formula and its boundary
This implementation uses a noncentral normal shift, not a noncentral t distribution. For independent means, the shift is d divided by sqrt(1/n1 + 1/n2). For paired or one-sample means it is d times sqrt(n). The two-sided critical value is the standard normal quantile at 1−alpha/2. Power is Φ(shift−critical) + Φ(−shift−critical); for a one-sided alternative in the expected direction it is Φ(shift−critical). The calculator numerically solves this equation for the requested power. Small samples with estimated variance need a t-based design implementation for stronger planning accuracy.
For binary outcomes, enter the two probabilities as fractions strictly between zero and one. The calculator uses Cohen h = 2 asin(sqrt(p1)) − 2 asin(sqrt(p2)), takes its magnitude and applies the same normal planning equation. In the one-sample case, the second probability is the null reference. This is an arcsine normal approximation, not an exact binomial or untransformed risk-difference design. It can differ from software using pooled-null and alternative variances. Select alpha and power as fractions, such as 0.05 and 0.80. Choose sidedness before seeing results; a one-sided test is not a convenient way to reduce recruitment after deciding on a two-sided scientific question.
Round analyzable groups before allowing for attrition
The calculator rounds group 1 upward, calculates group 2 from that rounded count and the allocation ratio, then rounds group 2 upward. It reports each group and the total. It next inflates each group separately using ceil(analyzable n / (1−attrition fraction)). For independent means with d=0.5, alpha=0.05, power=0.80, equal allocation and two-sided testing, the example needs 63 analyzable participants per group. Ten percent attrition gives 70 recruited per group and 140 in total. The achieved-power row uses the rounded analyzable counts, so it may slightly exceed the requested target.
Attrition inflation does not correct bias from missing outcomes and does not specify how missing data will be analysed. It only adds recruitment capacity under the stated loss assumption. For paired data, think about the chance of obtaining a complete pair, not merely attending the first measurement. This tool does not cover cluster randomisation, survival endpoints, regression power, equivalence, noninferiority, sequential monitoring or complex longitudinal designs. A zero effect cannot deliver target power above alpha, and impossible probabilities are rejected. Export the inputs, formula assumptions, per-group totals and sensitivity scenarios for review. A study statistician should confirm the final design, feasibility and analysis plan before the numbers become a recruitment commitment.
Frequently asked questions
Does this use a t distribution for means?
No. Sample size and power use an explicitly labelled normal approximation. Use validated noncentral-t planning software for a small-sample t-test design.
How is attrition included?
Each analyzable group is rounded upward first, then divided by one minus the attrition fraction and rounded upward again. Both group totals and the overall total are shown.
What is the paired effect-size input?
It is the absolute expected mean within-pair difference divided by the SD of those differences. Do not substitute the independent pooled SD.
Are calculations free and unlimited?
Yes. Local calculations have no quota and require no login. External lookups are rate limited to protect provider access; waiting and retrying never requires signup.
Does AnswerThis save or receive my result?
No. Signup opens the AnswerThis app; it does not save or transfer this result. Copy or download your calculation before leaving the page.
How can I reproduce a result?
Keep the supplied inputs, selected method, units, assumptions and implementation date in the text or CSV export. Numerical fixtures are checked against SciPy 1.15.3, statsmodels 0.14.4 and pingouin 0.5.5.
What if a value is missing or invalid?
Required fields show a specific error. Zero-variance and invalid-degree-of-freedom cases are refused. Missing provider metadata is labelled unknown or not reported, and a failed lookup is never replaced by invented data.
Sources and related research tools
Method version: 14 September 2026. Numeric reference validation: SciPy 1.15.3, statsmodels 0.14.4, pingouin 0.5.5. Numeric inputs stay in your browser; these calculations use no AI model or external calculation service.
SciPy statistical distributions; statsmodels statistical methods; OpenAlex access and limits; OpenAlex metric definitions.