Sample Size Calculator for Two Independent Means

Use this calculator for two independent groups with a continuous outcome, analyzed with a pooled-variance t-test.

Not a survey margin-of-error calculator: population size, confidence level, and survey precision are different planning inputs.

Study inputs

What do you want to solve for?
Test design
Use one-tailed only when direction was justified in advance.
Commonly 0.05; applies to the selected test direction.
1 means equal groups; 2 means twice as many in group 2.
Percent expected to be unavailable for analysis.
Target power
Probability of detecting the specified effect.
Changing format converts the entered value.
Effect to detect

Use the smallest scientifically or practically meaningful effect, not an optimistic prediction.

Absolute difference divided by the pooled standard deviation.
Load an example
Cohen’s d presets

Planning result

Required sample size

Calculating…

Calculation steps
Method for a protocol or report

Planning estimate: the result depends on the stated assumptions and is not a guarantee of study validity or observed significance.

Advertisement

Sensitivity analysis

Required analyzable sample sizes across plausible standardized effects and power targets, using the current α, test direction, and allocation.

Cells show group 1 + group 2 (total analyzable sample).
Cohen’s d80% power90% power95% power

When to use this calculator

Use it when two separate groups will be compared on a continuous outcome with an independent-samples t-test. Examples include a treatment group versus control, two teaching methods, or output from two production lines. The calculation assumes independent observations, approximately normal group outcomes (or samples large enough for the mean to behave approximately normally), and a common within-group variance.

Required inputs

Choose a two- or one-tailed test, α, target power, group allocation, and an effect. Cohen’s d is the mean difference divided by the pooled SD. In raw mode, enter both values and the calculator derives d. Attrition affects recruitment, not the analyzable sample used in the power equation.

Worked example

Suppose a clinical outcome has a pooled SD of 10 points and a 5-point improvement is the smallest worthwhile effect. Then d = 5 ÷ 10 = 0.50. With two-sided α = 0.05, 80% power, and equal groups, the exact noncentral-t calculation requires 64 analyzable participants per group, 128 total. With 10% attrition, recruit ceil(64 ÷ 0.90) = 72 per group, 144 total.

Formula and method

For analyzable group sizes n1 and n2, degrees of freedom are df = n1 + n2 − 2 and the noncentrality parameter is λ = d ÷ √(1/n1 + 1/n2). Power is the probability that a noncentral-t variate crosses the critical central-t boundary. Sample size and MDE modes iteratively search integer group sizes or d; they do not substitute normal Z critical values.

Choosing a meaningful effect and SD

Define the minimum difference that would change a scientific, clinical, operational, or policy decision. Estimate SD from comparable prior studies, a meta-analysis, an established domain threshold, or well-designed pilot data. Small pilots produce imprecise variance estimates; they do not inevitably bias SD downward, but planning around a single uncertain estimate can be risky. Explore larger SDs or smaller effects in the sensitivity table.

Interpreting the result

The analyzable target is the number of independent usable outcomes needed under the entered model. Recruitment targets divide each group by 1 − attrition and round upward. Required sample size is approximately inversely related to squared standardized effect, but power itself is nonlinear; changing d does not change power by a simple proportional rule.

Assumptions and limitations

This pooled t-test calculation is not suitable for paired data, repeated measures, clusters (such as patients within clinics), survival outcomes, binary outcomes, or unequal-variance planning. Clustering usually requires an intraclass-correlation design effect; repeated measures and paired data require their correlation structure. Multiple primary outcomes may require multiplicity-adjusted α. Population size, survey confidence level, and margin of error are absent because those belong to estimation or survey-sampling calculations, not this hypothesis-test design.

Do not use observed post-hoc power as evidence that a completed nonsignificant study was adequate: it largely restates the p-value. For a fixed completed study, report effect estimates and confidence intervals; use achieved-power mode prospectively for a fixed future budget.

Attrition example

Recruitment target = ceil(analyzable sample ÷ (1 − attrition proportion)). If 64 usable outcomes are needed in a group and 15% may be lost, recruit ceil(64 ÷ 0.85) = 76.

Methodology and validation

  • Calculation version: 2.0, exact noncentral-t engine.
  • Last reviewed: 18 July 2026.
  • Maintained by: Starlight Tools. No independent statistical review is claimed.
  • Validation: checked against SciPy 1.15.3 scipy.stats.nct and the documented R power.t.test benchmark. For equal groups, d = 0.50, power = 0.80, and two-sided α = 0.05 gives 63.7656 and therefore 64 per group; power at 64 is 0.80146. An unequal 50:100 case was also matched to SciPy (power 0.81806336).

References: R power.t.test documentation; SciPy noncentral-t documentation; Faul et al. (2007), G*Power 3; Cohen (1988), Statistical Power Analysis for the Behavioral Sciences.

Frequently asked questions

Why is population size not required?

This calculation controls power for a hypothesis test of two independent means. Population size is normally irrelevant when each group is a small fraction of its source population; it is an input for some survey and finite-population calculations, which this is not.

Should I use Cohen’s d or a raw mean difference?

Use Cohen’s d when a defensible standardized effect is available. Otherwise enter the smallest meaningful difference in the outcome’s units and a pooled standard deviation; the calculator converts their ratio to d.

How do I account for dropout?

Enter the expected attrition percentage. Each analyzable group size is divided by one minus the attrition proportion and rounded up to produce the recruitment target.

What if my groups are unequal?

Set the group 2 to group 1 allocation ratio. The calculator returns separate integer group sizes and uses their actual ratio, degrees of freedom, and noncentrality.

Can I use this for paired data?

No. Paired and repeated-measures data require the standard deviation of within-pair differences and a paired-test power calculation.

When is a one-tailed test appropriate?

Only when the direction was justified and specified before seeing data and an effect in the opposite direction would not lead to a claim. Otherwise use two-tailed.

Why does this result differ from G*Power or R?

Small differences can arise from integer rounding and unequal-allocation conventions. This calculator uses noncentral-t power and rounds each required group upward; compare the same tails, alpha, allocation, and effect definition.

Is the result per group or total?

The result labels group 1, group 2, and their total separately. Recruitment targets include attrition; analyzable sizes do not.

Explore more tools