Home / Tools / Sample Size for t Tests

Sample Size Calculator for t Tests

Before you run a study, this answers the question you actually have: how many people do I need? Tell it how big an effect you want to be able to detect, either as Cohen's d or as the means and standard deviations you expect, and it returns the sample size that gives you a real chance of finding that effect. It covers one-sample, two-group and paired designs, and shows the power curve behind the number.

Part of the sample-size family: all sample size calculators.

I want to size a two-group comparison

Try:
Effect you want to detect
Design

Power 0.80 and alpha 0.05 are the usual defaults. Nothing you type leaves your browser.

Two-sample t test

Recruit 64 per group

128 participants in total.

64 per group · 128 total
What if you could only recruit… 64 per group → 80.1% power
Exact n
63.766
Power at that n
0.8015
Cohen's d
0.50
df
126
What this means
How this number is computed
The same thing in R

No data leaves your browser Verified against R's pwr.t.test(), pwr.t2n.test() and power.t.test() Free, no sign-up

What actually moves the number

Sample size is driven by the effect you want to catch far more than by anything else. This table is live: it recomputes for your current design, alpha and test direction.

Effect size80% power90% power95% power

The pattern to take away: required n scales with roughly 1/d². Halving the effect you want to detect does not double the sample, it roughly quadruples it. Chasing more power is comparatively cheap, and tightening alpha sits somewhere in between. If a study looks unaffordable, the honest lever is almost always a more precise measurement (which raises d by shrinking the SD), not a bigger budget.

Cohen's benchmarks, and why they are only a starting point

Cohen proposed 0.2, 0.5 and 0.8 as small, medium and large, and the whole field adopted them.

Cohen's dLabelOverlap of the two distributionsn per group at 80% power
0.2SmallAbout 85%394
0.5MediumAbout 67%64
0.8LargeAbout 53%26

Cohen himself intended these as a fallback for when nothing better was available, and warned against treating them as universal. They came from behavioural research, where a d of 0.8 is genuinely big. In other fields the same number means something completely different: a d of 0.1 in a large-scale medical trial can be worth millions of lives, while a d of 1.0 in a tightly controlled physics measurement may be unremarkable. Domain context beats the benchmark every time. The better question is not "is this small or medium" but "what is the smallest difference that would change what I do?" Answer that, and you have your d.

What each design assumes

DesignWhat n countsNoncentralitydfR function
One-sampleObservationsd√nn − 1pwr.t.test(type="one.sample")
Two-samplePer groupd√(n₁n₂/(n₁+n₂))n₁ + n₂ − 2pwr.t.test(type="two.sample")
PairedPairsdz√nn − 1pwr.t.test(type="paired")

A paired test is mathematically the one-sample test applied to the differences, which is why the two rows look identical. The catch is that its effect size dₒ is the mean change divided by the SD of the changes, not the SD of the raw scores. Those are very different numbers whenever the two measurements are correlated, and mixing them up is the most common way a paired calculation goes wrong.

This calculator follows the pwr convention: a two-tailed test counts the chance of rejecting in either tail. Base R's power.t.test ignores the wrong tail unless you pass strict = TRUE, which is why the R block above always includes it.

Questions people ask

How many participants do I need per group for a t test?

It depends almost entirely on the effect size you want to detect. To detect a medium effect (d = 0.5) between two independent groups with 80% power at alpha = 0.05 two-sided, you need 64 per group, so 128 in total. Halve the effect to d = 0.25 and the requirement jumps to about 253 per group. Sample size scales with 1/d², which is why small effects are so expensive to study.

Why does pwr.t.test give a different sample size than power.t.test?

They use different conventions for a two-sided test. pwr::pwr.t.test counts the probability of rejecting in either tail. stats::power.t.test defaults to strict = FALSE, which ignores the chance of a significant result in the wrong direction, so it reports a slightly smaller n. Pass strict = TRUE and the two agree. For d = 0.5 the gap is about 0.0002 participants, which rounds away; for d = 0.05 it is about 0.015. This calculator matches the pwr convention.

What is Cohen's d and how do I choose one?

Cohen's d is the difference between means divided by the standard deviation, so it is the effect measured in standard deviations. A d of 0.5 means the groups differ by half an SD. Rather than reaching for 0.2/0.5/0.8, use the smallest effect that would actually change your decision, or an estimate from a pilot or from published work in your own field. If you only have means and SDs, switch the input above to "Means and SDs" and this page will compute d for you and show the arithmetic.

Should I use a one-tailed or two-tailed test?

Use two-tailed unless you have a strong, pre-registered reason to look in only one direction and would genuinely treat an effect in the opposite direction as no effect at all. One-tailed needs a smaller sample for the same power, which makes it tempting, but switching to one-tailed after seeing your data inflates the false positive rate. If in doubt, stay two-tailed.

What if my two groups will not be the same size?

Set the allocation ratio: 2 means the second group is twice the first. Unequal allocation always costs more total participants for the same power, so a balanced design is the most efficient use of a fixed total. Ratios still help when one group is cheaper or more available, for example when controls are easy to recruit and cases are not. The R block switches to pwr.t2n.test when your ratio is not 1, because pwr.t.test assumes equal groups.

Is 80% power always the right target?

80% is a convention, not a rule. It means that if the effect really is the size you assumed, you still miss it one time in five. If a missed effect is expensive, 90% or 95% is common in confirmatory trials. Going from 80% to 90% costs about a third more participants; 95% costs about two thirds more. You can watch that trade-off directly in the live table above.

Is n per group or the total?

For a two-sample test this page reports n per group, matching pwr.t.test, and shows the total next to it. For a paired test n is the number of pairs: n = 34 means 34 people each measured twice, not 68 people. For a one-sample test n is simply the number of observations.

My calculated n is fractional. Do I round up or down?

Always up. pwr.t.test returns the exact point where power equals your target, for example 63.77. Rounding down to 63 leaves you below your target power; rounding up to 64 puts you just above it. This page shows both: the exact value, and the power your rounded-up integer actually delivers, which is always a little more than you asked for.