On this page
How to use the sample size calculator
- Pick the tab that matches your analysis: Survey to estimate a percentage, Means for a t-test, Proportions to compare two rates, and ANOVA, r, χ² for three or more groups, a correlation or a contingency table.
- Enter the effect you expect, the significance level α (usually 0.05) and the power you want (usually 0.80). The answer updates as you type.
- Read n, open Show the working to see each formula with your numbers, and copy the sentence for your methods section.
- The Power tab works the other way round: it gives the power of a fixed sample and draws a power curve. The Effect size tab converts between d, r, f, η², odds ratios and w.
The address bar updates as you type, so a link opens the exact calculation for your supervisor. The main parameters:
| Parameter | Meaning | Example |
|---|---|---|
tab | survey, means, props, tests, power or convert | tab=means |
design | two, paired, one, prop2, prop1, anova, corr or chi | design=paired |
d, f, r, w | effect size | d=0.5 |
alpha, power, tails | significance level, power, 1 or 2 tails | power=0.9 |
conf, moe, p, pop, resp | survey: confidence, margin of error, expected proportion and response rate (all in %), population size | moe=5&pop=2000 |
n, n1, n2 | sample sizes on the Power tab | n1=30&n2=30 |
For example, /sample-size-calculator/?tab=means&d=0.5&alpha=0.05&power=0.8 opens a two-group t-test.
What drives the sample size
Four things set n: the significance level α (the false positive rate you accept), the power 1 − β (the chance of detecting a real effect), the size of the effect and the spread of the data. Because n grows with the inverse square of the effect, halving the effect roughly quadruples n.
For a survey, Cochran's formula gives the sample needed to estimate a proportion p within a margin of error e: n₀ = z² p(1 − p) / e². With 95% confidence (z = 1.959964), p = 50% and e = 5%, n₀ = 384.15, so 385 people.
For two group means, the normal approximation is n per group = 2(z₁₋α/₂ + z₁₋β)² / d², where d is the difference in means divided by the standard deviation. For d = 0.5 it gives 62.79. The tool then iterates with the noncentral t distribution, which allows for the SD being estimated from the sample, and lands on 64 per group, as G*Power does. ANOVA, chi-square and correlation work the same way with the noncentral F (λ = f²N), the noncentral chi-square (λ = w²N) and the exact distribution of r. Proportions use the Fleiss normal approximation.
Choosing an effect size honestly
The effect size moves n more than any other input, and it is often chosen backwards: picking d = 0.8 because it gives an affordable sample is not a power analysis. Better sources, in order:
- The smallest effect that would matter in practice, such as a 5 mmHg fall in blood pressure. Enter it as means and SDs and the tool computes d.
- Published studies of the same outcome, ideally a meta-analysis. A small pilot tends to overstate the effect.
- Cohen's benchmarks (d = 0.2, 0.5 and 0.8 for small, medium and large) as a last resort, saying that is what you used.
The choice matters: at 80% power and α = 0.05, d = 0.8 needs 26 per group, d = 0.5 needs 64 and d = 0.2 needs 394.
One tail or two
A one-tailed test puts all of α on one side, so it needs fewer people: 51 per group instead of 64 for d = 0.5. Use it only if an effect in the opposite direction would count exactly like no effect, and decide before collecting data. Reviewers expect two-tailed tests unless you justify the choice.
Surveys: population size and Slovin's formula
When the population is small, the finite population correction lowers n: n = n₀ / (1 + (n₀ − 1) / N). For N = 2,000 the 385 above falls to 323, while for N = 100,000 it barely moves (383). That is why 385 is the familiar answer for any large population.
Slovin's formula, n = N / (1 + Ne²), appears in many theses in the Philippines and South Asia, but it is weak. It is Cochran's formula with z = 2 and p = 50% fixed, so it cannot respond to anything else you know. For N = 2,000 and e = 5% it always gives 334, whether you want 95% or 99% confidence (Cochran: 323 and 499) and whether you expect a proportion of 50% or 10% (Cochran: 323 and 130). Tick the Slovin box to see both, then report Cochran.
Two more adjustments: divide by the expected response rate (323 completed surveys at 80% response means inviting 404), and for cluster or multistage sampling multiply by the design effect.
Worked examples
A survey of 1,200 nursing students
Confidence 95%, margin 5%, p = 50% because there is no earlier estimate, population 1,200 and an expected response rate of 80%. Cochran gives n₀ = 1.959964² × 0.5 × 0.5 / 0.05² = 384.15. The correction gives 384.15 / (1 + 383.15 / 1,200) = 291.18, so 292 completed questionnaires. At 80% response, invite 292 / 0.8 = 365 students. Slovin's formula would say 300.
Blood pressure on two diets
You expect a mean systolic pressure of 130 mmHg on the usual diet and 125 mmHg on the new one, with an SD of 10 mmHg in each group. The pooled SD is 10, so d = 5 / 10 = 0.5. With α = 0.05, two tails and 80% power, the normal formula gives 62.79, and the exact t-test needs 64 per group, 128 in total, for an actual power of 80.1%. With only 30 per group the power would be 47.8%, worse than a coin toss.
Three teaching methods (one-way ANOVA)
A medium effect, f = 0.25, across k = 3 groups at α = 0.05 and 80% power needs 53 per group, 159 in total. At that size λ = 0.25² × 159 = 9.9375 and the critical F(2, 156) is 3.054, which gives a power of 0.805. Like G*Power, the tool keeps the groups equal; if one group may have one person fewer, 158 already reaches 0.802.
Writing the justification
A sample size statement needs five things: the test, α and the number of tails, the power, the effect size with its source, and the final n with any allowance for dropout or non-response. Every result offers a sentence to copy: "A sample of 128 participants (64 per group) gives 80% power to detect an effect of d = 0.5 with a two-tailed independent-samples t-test at α = 0.05 (actual power 80.1%)." Follow it with one sentence on where the effect size came from. That second sentence is the one examiners check.
Common mistakes
- Per group or total. The t-test answer of 64 is per group, so you recruit 128.
- Forgetting dropouts. If 10% may leave the study, divide by 0.9: 64 per group becomes 72.
- Mixing up paired and independent designs. The paired effect size dz uses the SD of the differences, not the SD of the scores, so the two are not interchangeable.
- Power after the fact. Power computed from the effect you observed after a non-significant result only restates the p-value. Use the Power tab to judge a design before the data arrive.
- Rounding down. 291.18 people means 292.
Embed the Sample Size Calculator on your website
Teachers, bloggers and course sites can add this tool to any web page for free. Paste the code below into an HTML or embed block (WordPress, Google Sites, Canvas, Moodle, Blogger, Wix). It loads the same tool you see above, without our menus or ads. Please keep the credit line under the frame. Sizes, a live preview and step-by-step guides for each platform are on the calculator widget page.
Frequently asked questions
Why is 385 the sample size for a large population?
With 95% confidence, a 5% margin of error and p = 50%, Cochran's formula gives 384.15, rounded up to 385. Population size matters only when it is small: the answer is 383 for 100,000 people and 323 for 2,000.
Does this calculator give the same answer as G*Power?
For t-tests, one-way ANOVA, correlation and chi-square tests it uses the same exact distributions: 64 per group for d = 0.5, 159 in total for f = 0.25 with three groups, 84 for r = 0.3 and 88 for w = 0.3 with one degree of freedom. Proportions use the Fleiss normal approximation, which can differ by a few people from an exact test.
Which effect size should I use if there is no earlier study?
Use the smallest difference that would change practice, with a realistic SD from published norms or a pilot. Fall back on Cohen's medium values (d = 0.5, f = 0.25, r = 0.3, w = 0.3) only when nothing else exists, and say so in your thesis.
Can I use Slovin's formula for my thesis?
You can show it, but report Cochran's formula, which uses your confidence level and expected proportion. Slovin fixes them at about 95.4% and 50%, so for 2,000 people and a 5% margin it gives 334 whatever else you know.
Should I aim for 80% or 90% power?
80% is the usual minimum, and many clinical trials plan for 90%. For d = 0.5 with a two-tailed test at α = 0.05, 90% power needs 86 per group instead of 64.
How do I allow for dropouts or non-response?
On the Survey tab, enter the expected response rate to see how many people to invite. For a trial, divide n by one minus the dropout rate and round up: 64 per group with 10% dropout becomes 72.