What this calculator does
Before you run a study it is worth asking how much data you actually need. Too little and a real effect slips past unnoticed; too much and you have spent time and money you did not have to. This calculator answers the question for the one-sample and two-sample t-test and z-test: given the effect you want to be able to detect, the significance level you will use, and the power you want, what is the smallest sample size that gets you there?
How to use this calculator
- Choose the distribution. Use T when the standard deviation is estimated from your data — that is almost always the case. Use Normal only when the population σ is genuinely known.
- Choose one or two samples. For a paired design, size a one-sample test on the within-pair differences: the sample size question is the same calculation.
- Set the effect to detect. Either pick Small / Medium / Large, which fills in Cohen's d (0.2 / 0.5 / 0.8), or type the effect yourself. Choosing Unstandardized lets you enter a difference in the original units, and then also asks for the standard deviation so it can be converted to d.
- For a two-sample design, an allocation ratio lets the two groups differ in size — 1 means equal groups, and the calculator holds the second group at that multiple of the first while it searches.
- Enter the significance level and the target power you are aiming for — 0.05 and 0.8 are the usual conventions.
- Press Calculate. Open More options to change the rounding or hide the calculation steps.
How to read the power curve
The curve shows the power the test would have at every sample size, so you can see the shape of the trade-off rather than just one number. The dashed amber line is your target power, and the marked point is the smallest sample that reaches it. Hover anywhere on the curve (or drag a finger across it on a phone) to read the sample size and the power at that point.
The curve is usually steep at first and then flattens. That flattening is the important part: past a certain size, each extra observation buys very little power, and it is often cheaper to target a slightly larger effect than to keep recruiting.
Two-tailed power is the strict interpretation
For a two-tailed test this page counts a rejection in either tail, including the tail opposite the true effect, when it works out the power at the required sample size. That matches R's strict = TRUE. The difference is negligible for a well-powered test and becomes visible only when the power is low.
Assumptions
- The observations are independent, and normally distributed (or the sample is large enough for the central limit theorem).
- For the z-test, the population standard deviation is known.
- The effect size you enter is the effect you want to be able to detect, decided before collecting data — not an effect already observed in a pilot sample.
If the sample size is too large to be practical
You have four levers, and it is worth knowing what each one costs you:
- Accept a lower power. Honest, and cheap — but you are accepting a bigger chance of missing a real effect.
- Raise α. Also cheap, and also a real cost: more false positives.
- Target a larger effect. Much the strongest lever, because the required sample falls roughly with the square of the effect. Only defensible if the smaller effect genuinely would not matter to you.
- Use a one-tailed test, but only when the direction is justified before seeing the data.
What you should not do is run the study at the smaller size anyway and hope. An underpowered study that finds nothing has not shown there is nothing there.
Use this page for
- One-sample t-test
- Two-sample t-test (pooled variance)
- Two-sample t-test (Welch's)
- Paired t-test — as a one-sample test on the differences
- One-sample z-test
- Two-sample z-test
Related calculators
- T-test / Z-test power calculator — the other direction: you have the sample size, and want the power.
- All sample size calculators
- All power calculators
- Guide: statistical power