Sample Size Calculator
This professional-grade tool computes minimum sample sizes for surveys (single proportion), studies of means, and A/B tests (two proportions). It is built for researchers, product teams, analysts, and students who need fast, transparent, and standards-based results.
Calculator
Results
Results update automatically. Values are rounded up to the nearest whole number.
Data Source and Methodology
- W. G. Cochran (1977), Sampling Techniques, 3rd ed., Wiley. (Cochran’s formula for single proportion and finite population correction) — Reference
- NIST/SEMATECH e-Handbook of Statistical Methods (2012). Sections on confidence intervals and sample size. — https://www.itl.nist.gov/div898/handbook/
- J. Cohen (1988), Statistical Power Analysis for the Behavioral Sciences, 2nd ed., Routledge. (Foundations of power analysis)
- J. L. Fleiss, B. Levin, M. C. Paik (2003), Statistical Methods for Rates and Proportions, 3rd ed., Wiley. (Two-proportion test)
Tutti i calcoli si basano rigorosamente sulle formule e sui dati forniti da questa fonte.
The Formula Explained
Single Proportion (Survey):
Finite population size unknown (large):
$$ n_0 \;=\; \frac{z^2 \, p(1-p)}{E^2} $$
Finite population correction (FPC):
$$ n \;=\; \frac{N \, n_0}{N - 1 + n_0} \quad,\qquad n_{\text{deff}} = \text{DEFF} \cdot n_0 $$
Mean:
$$ n_0 \;=\; \left(\frac{z \, \sigma}{E}\right)^2 \quad,\qquad n \;=\; \frac{N \, (\text{DEFF}\cdot n_0)}{N - 1 + (\text{DEFF}\cdot n_0)} $$
A/B Test (Two Proportions, equal allocation):
Let \(d = |p_2 - p_1|\), \(\bar{p} = \tfrac{p_1 + p_2}{2}\).
$$ n_{\text{per-group}} \;=\; \frac{\left[\,z_{1-\alpha/2}\sqrt{2\,\bar{p}(1-\bar{p})} \;+\; z_{1-\beta}\sqrt{p_1(1-p_1)+p_2(1-p_2)}\,\right]^2}{d^2} $$
Glossary of Variables
How It Works: A Step‑By‑Step Example
Goal: Survey a population of N = 10,000 with 95% confidence, ±5% margin of error, and no prior knowledge (p = 0.5). DEFF = 1.0.
- Compute z for 95%: z ≈ 1.96.
- Base size (no FPC): n0 = (1.96^2 × 0.5 × 0.5) / 0.05^2 = (3.8416 × 0.25) / 0.0025 = 0.9604 / 0.0025 = 384.16.
- Apply FPC: n = (10,000 × 384.16) / (10,000 − 1 + 384.16) ≈ 3,841,600 / 10,383.16 ≈ 370.0.
- Always round up: collect at least 371 responses.
Tip: If your expected response rate is R%, divide the required completes by R% to estimate the number of invitations needed.
Frequently Asked Questions (FAQ)
What if I don’t know the proportion p?
Use p = 0.5. It maximizes p(1−p) and yields the most conservative (largest) sample size.
How do I choose margin of error?
It depends on decision risk and cost. ±5% is common for general surveys; regulatory or clinical contexts may require tighter margins.
When should I apply finite population correction?
When the sample is a non-negligible fraction of a finite population (commonly if n/N ≥ 0.05). FPC reduces the required sample.
Does this calculator handle unequal allocation in A/B tests?
This version assumes 1:1 allocation for clarity. For skewed splits, adapt the formula or contact your statistician.
Is the normal approximation valid for very small or extreme proportions?
For very small n or p near 0 or 1, normal approximations can be less accurate. Consider exact methods or a statistician’s advice.
Can I use t instead of z for means with unknown σ?
For planning, z with an estimated σ is standard. After data collection, inference often uses t. Pilot studies help refine σ.