Statistics & probability

Sample size and power for a t test

Find the sample size, power or smallest detectable effect for a one-sample, paired or two-sample t test, from the exact non-central t distribution.

Sample size and power for a t test
Esc to restore

Your inputs

Difference in means divided by the SD; Cohen’s benchmarks are 0.2 small, 0.5 medium and 0.8 large. Ignored when calculating the smallest effect.

The SD within each group, or of the differences for a paired design.

For example 0.8 or 0.9. Ignored when calculating power.

Used when calculating power or the smallest detectable effect.

Results update as you type. Larger files run when you press Update result.

Your result

Your result will appear here.

More actions

Your inputs stay in this browser. Nothing is uploaded, and nothing is saved unless you choose “Save result”.

A clear answer. Here’s how.

Power is the chance that a t test at level α rejects when the true standardised effect is d. Under that effect the t statistic follows a non-central t distribution with non-centrality δ = d√(n₁n₂ ÷ (n₁ + n₂)) and n₁ + n₂ − 2 degrees of freedom for two groups, or δ = d√n and n − 1 df for one sample or paired differences. Power = P(T > t₁₋α/₂) + P(T < −t₁₋α/₂) for a two-sided test, so both rejection regions count, or P(T > t₁₋α) one-sided. The non-central t CDF is Lenth’s (1989) series (algorithm AS 243, as in R’s pt with ncp), switching to the Abramowitz and Stegun 26.7.10 normal approximation only where that series would underflow. The sample size is the smallest whole n whose exact power reaches the target, found by doubling and bisection; with an allocation ratio, group 2 has n × ratio rounded up. The smallest detectable effect is found by bisection on d. The normal-approximation answer n = (z₁₋α/₂ + z₁₋β)² × (1 + 1/ratio) ÷ d² is shown for comparison and runs a little low for small samples. Student’s equal-variance t test is assumed; it does not cover Welch’s test, non-normal data, clustering or dropout, so inflate n for expected losses. It is a calculator, not a substitute for a statistician when decisions depend on the answer.

How this is checked

5 reference checks passed These 5 cases were run when this page was built, on 20 October 2026, and all reproduce within the stated tolerance. The same cases are part of the automated tests that run on every change to Toolmoz. Engine version 1.

See the checks and where each expected answer comes from
  1. Case 1

    Inputs
    The tool’s default inputs
    Expected, and what Toolmoz gave
    Sample size per group expected 64, Toolmoz 64Achieved power expected 0.8014595579223115, Toolmoz 0.801459557922259
    Where the expected answer comes from
    Cohen (1988) and G*Power: d = 0.5, two-sided α = 0.05, power 0.8 needs 64 per group; power at 64 from an independent Python script that integrates the normal tail over the chi-square variable (no series), which also gives 0.7952 at 63
    Allowed difference
    ±1e-7
  2. Case 2

    Inputs
    Effect size d 0.2
    Expected, and what Toolmoz gave
    Sample size per group expected 394, Toolmoz 394Achieved power expected 0.8005931284020774, Toolmoz 0.800593128402593
    Where the expected answer comes from
    Cohen (1988) and G*Power: d = 0.2 needs 394 per group; power 0.80059 at 394 and 0.79959 at 393 by independent numerical integration in Python
    Allowed difference
    ±1e-7
  3. Case 3

    Inputs
    Design one
    Expected, and what Toolmoz gave
    Sample size expected 34, Toolmoz 34Achieved power expected 0.8077775012792557, Toolmoz 0.8077775012792755
    Where the expected answer comes from
    One-sample t test with d = 0.5: 34 subjects (G*Power), power 0.80778 at 34 and 0.79537 at 33 by independent numerical integration in Python
    Allowed difference
    ±1e-7
  4. Case 4

    Inputs
    Calculate powerSample size (group 1, or the number of pairs or subjects) 20
    Expected, and what Toolmoz gave
    Power expected 0.33793902892505584, Toolmoz 0.3379390289250416
    Where the expected answer comes from
    Two groups of 20 with d = 0.5: δ = 0.5 × √10, t(38) critical 2.0244; power 0.33794 counting both tails, by independent numerical integration in Python (R’s power.t.test(strict = TRUE) agrees)
    Allowed difference
    ±1e-7
  5. Case 5

    Inputs
    Allocation ratio, group 2 ÷ group 1 2
    Expected, and what Toolmoz gave
    Group 1 size expected 48, Toolmoz 48Group 2 size expected 96, Toolmoz 96Achieved power expected 0.8021395496678326, Toolmoz 0.8021395496677204
    Where the expected answer comes from
    Unequal allocation 1:2 with d = 0.5: 48 and 96 reach power 0.80214 while 47 and 94 give 0.79374, by independent numerical integration in Python
    Allowed difference
    ±1e-7

What this shows: the engine reproduces independently worked values for these cases. It does not prove every possible input is right. To test an answer you were given, see how to check a number; to see what is and is not checked across Toolmoz, see the accuracy ledger.

See a worked example

Worked example

A fixed demonstration, separate from the values you enter above.

Design
Two independent groups
Calculate
Sample size
Effect given as
Standardised effect size d
Effect size d
0.5
Significance level α
0.05
Target power
0.8
Test
Two-sided
Allocation ratio, group 2 ÷ group 1
1
Sample size (group 1, or the number of pairs or subjects)
64

Example result

Sample size per group
64
Group 1 size
64
Group 2 size
64
Total sample size
128
Achieved power
0.8015
Power by the normal approximation
0.8074
Sample size by the normal approximation (group 1)
63
Effect size d
0.5000
Non-centrality parameter
2.8284
Degrees of freedom
126
Critical t
1.9790

Exact power from the non-central t distribution with 126 df and non-centrality 2.828, counting both rejection regions. The normal approximation would give 63 and gives power 0.807; it underestimates the sample size when n is small. d is the difference in means divided by the common SD; group 2 has the same size. Equal variances are assumed (Student’s t). Plan for dropout separately.