“How many people do I need to survey?” and “how many samples do I need to test?” are among the first questions in any project report, thesis or experiment, and the honest answer is a calculation, not a guess. Too small a sample and you cannot tell a real effect from noise. Too large and you waste time and money, and may expose more participants than necessary. This guide covers the main sample-size formulas for estimating a proportion or a mean, comparing two groups, and planning for dropout, with worked examples you can verify by hand or with the Free Technology Calculators app.
It follows on from Choosing the Right Statistical Test. Choose your analysis first, because sample-size calculations depend on the test you plan to run.
1. The ideas behind every sample-size calculation
- Confidence level. How sure you want to be that your interval contains the true value. 95% is common, with a z-value of 1.96. For 90%, z = 1.645, and for 99%, z = 2.576.
- Margin of error (E). How close you need your estimate to be, for example ±5 percentage points.
- Variability. For a proportion this is p(1 − p), largest at p = 0.5. For a mean it is the standard deviation σ.
- Significance level (α). The chance of a false positive (Type I error) you accept, usually 0.05.
- Power (1 − β). The chance of detecting a real effect of a given size. The Type II error rate β is the chance of missing it. Many studies aim for 80% power, and some for 90%.
- Effect size. The smallest difference you care about, relative to the variability. Smaller effects need larger samples.
2. Sample size to estimate a proportion
n = z² × p × (1 − p) / E²
When you do not know p, use 0.5, which gives the largest, safest sample.
Example 1. A survey of the proportion of students using a service. 95% confidence, margin of error ±5%, p = 0.5. n = 1.96² × 0.25 / 0.05² = 3.8416 × 0.25 / 0.0025 = 384.2, so round up to 385.
| Margin of error | Sample size at 95% confidence (p = 0.5) |
|---|---|
| ±10% | 97 |
| ±5% | 385 |
| ±3% | 1,068 |
| ±2% | 2,401 |
Halving the margin of error needs about four times the sample, because n depends on 1/E². Check the other direction: with n = 400, E = 1.96 × √(0.25 / 400) = 1.96 × 0.025 = 0.049, about ±4.9%.
3. Sample size to estimate a mean
n = (z × σ / E)²
Example 2. You want the average study time with an error of ±3 minutes at 95% confidence. From earlier data, σ = 15 minutes. n = (1.96 × 15 / 3)² = 9.8² = 96.04, so 97. If you do not know σ, use a pilot study, a published value for a similar population or a range-based estimate such as range / 4, and state the assumption.
4. Finite populations
When the population is small relative to the sample, you can reduce the required sample with the finite population correction:
n_adjusted = n / (1 + (n − 1) / N)
Example 3. A college has N = 2,000 students, and the unadjusted sample is 385. nadj = 385 / (1 + 384 / 2000) = 385 / 1.192 = 323. For a very large population, the correction barely matters.
5. Comparing two groups: power analysis
For comparing two means with equal group sizes and a two-sided test, the sample size per group is approximately:
n per group = 2 × (z_α/2 + z_β)² × σ² / Δ²
= 2 × (z_α/2 + z_β)² / d² where d = Δ / σ
With α = 0.05 (z = 1.96) and 80% power (zβ = 0.8416), (1.96 + 0.8416)² = 7.85. With 90% power (zβ = 1.2816), (1.96 + 1.2816)² = 10.51.
The standardised effect size d (Cohen’s d) is the difference between means in standard-deviation units. As a rough convention, 0.2 is often called small, 0.5 medium and 0.8 large, but what is meaningful depends on your field, and these labels are only rules of thumb.
| Effect size (d) | Per group, 80% power | Per group, 90% power |
|---|---|---|
| 0.2 (small) | 393 | 526 |
| 0.5 (medium) | 63 | 85 |
| 0.8 (large) | 25 | 33 |
Example 4. A teaching method is expected to raise scores by 5 marks, and the standard deviation is 10, so d = 0.5. At α = 0.05 and 80% power, n = 2 × 7.85 / 0.25 = 62.8, so 63 per group, 126 in total. If you could only recruit 25 per group, you would only be able to reliably detect a large effect of d = 0.8 or more.
6. Comparing two proportions
n per group = [ z_α/2 × √(2 p̄ q̄) + z_β × √(p1 q1 + p2 q2) ]² / (p1 − p2)²
where p̄ = (p1 + p2) / 2, q̄ = 1 − p̄, q1 = 1 − p1, q2 = 1 − p2
Example 5. You expect a new reminder system to raise attendance from 40% to 50%. p̄ = 0.45, so √(2 × 0.45 × 0.55) = √0.495 = 0.7036. And √(0.40 × 0.60 + 0.50 × 0.50) = √0.49 = 0.70. At 95% confidence and 80% power: n = (1.96 × 0.7036 + 0.8416 × 0.70)² / 0.10² = (1.379 + 0.589)² / 0.01 = 3.873 / 0.01 = 387.3, so 388 per group. Detecting a 10-point difference in proportions takes a surprisingly large sample.
7. Allow for dropout and non-response
The calculations give the number of completed, analysable responses. To get them, recruit more:
recruit = required / (1 − expected loss rate)
Example 6. You need 63 per group and expect 10% dropout. Recruit 63 / 0.90 = 70 per group. For a survey with an expected 40% response rate and a target of 385 responses, you would need to contact about 385 / 0.40 = 963 people. Low response is also a source of bias, which a bigger sample does not fix.
8. Cluster sampling and design effects
If you sample whole groups such as classrooms or villages, people within a group tend to be similar, so you get less information per person than from a simple random sample. Multiply the sample size by the design effect: DEFF = 1 + (m − 1) × ρ, where m is the average cluster size and ρ is the intraclass correlation. Example 7. With m = 10 and ρ = 0.05, DEFF = 1 + 9 × 0.05 = 1.45, so a requirement of 385 becomes 385 × 1.45 = 558.
9. Choosing the inputs honestly
- Effect size. Base it on the smallest difference that would matter in practice, on previous studies or a pilot. Do not choose an optimistic value just to get a small sample, because underpowered studies produce unreliable results.
- Variability. Use a realistic or slightly pessimistic estimate of σ.
- Number of comparisons. If you will run many tests, consider adjusting α to control false positives, which raises the required sample.
- Plan before collecting data. Calculating “post-hoc power” from an observed result adds little. A confidence interval is more informative.
10. Software and when to ask for help
The formulas above are normal approximations that work well for common cases. Specialised designs (paired tests, ANOVA with several groups, regression, survival analysis, non-parametric tests, equivalence trials) need dedicated formulas or software, and free tools such as G*Power are widely used for this. For clinical, regulatory or high-stakes work, involve a statistician. Use careful unit handling when your effect size is in measurement units, and see Free Calculators for Engineering Students for related tools.
Quick reference
| Goal | Formula |
|---|---|
| Proportion | n = z² p(1 − p) / E² |
| Mean | n = (zσ / E)² |
| Finite population | n / (1 + (n − 1) / N) |
| Two means (per group) | 2 (zα/2 + zβ)² / d² |
| Dropout | n / (1 − loss rate) |
| Cluster design | n × (1 + (m − 1) ρ) |
Common mistakes
- Choosing a sample size by convention (“30 is enough”) without any calculation.
- Forgetting to round up to the next whole person.
- Ignoring dropout and non-response.
- Assuming a large effect to make the sample look feasible.
- Using a proportion formula for a mean, or the reverse.
- Treating a large biased sample as better than a smaller representative one. Size does not fix bias.
- Confusing the margin of error with the confidence level.
Frequently asked questions
Is 30 a magic sample size?
No. It is a loose rule of thumb about when sample means look roughly normal, not a guarantee of adequate power or precision.
Why 80% power?
It is a common convention that balances cost against the risk of missing a real effect. Use 90% when missing the effect would be costly.
What if I cannot reach the required sample?
Be transparent. Report the achieved power or the minimum detectable effect, widen the margin of error you accept, or adjust the design, for example with paired measurements, which often need fewer participants.
Does a bigger sample always mean better results?
It means more precision, but not less bias. A well-designed sample of the right size beats a huge convenience sample.
Conclusion
Decide your confidence level, margin of error or smallest meaningful effect, estimate the variability, apply the right formula, round up and add a buffer for dropout. Then record your assumptions so that readers can judge your design. Verify the arithmetic in Free Technology Calculators, available on Google Play.
Disclaimer: This article is educational and presents standard approximate formulas. Complex or regulated studies need specialised methods and professional statistical advice.