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 two chi-square tests: 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?
The two tests
Goodness of fit
Compares the counts you observe across k categories with the counts a hypothesis predicts — for example, testing whether a die is fair, or whether customers are spread across regions the way you expected. The degrees of freedom are k − 1, and the effect is measured by Cohen's w: 0.1 counts as small, 0.3 as medium and 0.5 as large. This test is always right-tailed, because squaring the deviations folds a shortfall and an excess into the same upper tail.
One caveat the arithmetic will not warn you about. The chi-square approximation assumes every expected count is at least about 5. With k equally likely categories that needs roughly 5k observations. If the required sample size comes out below that, the calculator flags it: the number is correct for the formula, but the test's real error rate may not match the α you asked for.
Test for a variance
Asks whether a population variance differs from a hypothesised value — used in quality control, where consistency matters as much as the average. The effect is expressed as the ratio of the alternative variance to the null variance, so 1.1 means "detect a variance 10% larger than assumed". A ratio above 1 implies a right-tailed test and a ratio below 1 a left-tailed one; if the ratio and the tail disagree the calculator switches the tail and tells you it did.
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.
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 fewer categories (goodness of fit only). Fewer categories means fewer degrees of freedom and a smaller required sample — but merge categories for a statistical reason, not to make the number look better.
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.
Related calculators
- Chi-square test power calculator — the other direction: you have the sample size, and want the power.
- Chi-square goodness-of-fit test — run the test once you have the data.
- Chi-square test for a variance
- All sample size calculators
- All power calculators
- Guide: the chi-square tests