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

Choose calculation mode
%
±%
%

Results

Results update automatically. Values are rounded up to the nearest whole number.

Required sample size

Data Source and Methodology

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

z
Normal quantile for the chosen confidence level; e.g., 1.96 for 95%.
E
Margin of error (absolute for means; absolute proportion for surveys). For “±5%”, use E = 0.05.
p
Estimated true proportion for the outcome (0–1). 0.5 is conservative if unknown.
N
Finite population size. If omitted or very large, FPC is not applied.
DEFF
Design effect. Multiplier to account for complex sampling (clustering/stratification).
σ
Estimated standard deviation for mean outcomes.
α
Significance level; confidence = 1 − α.
β
Type II error; power = 1 − β.

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.

  1. Compute z for 95%: z ≈ 1.96.
  2. 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.
  3. Apply FPC: n = (10,000 × 384.16) / (10,000 − 1 + 384.16) ≈ 3,841,600 / 10,383.16 ≈ 370.0.
  4. 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 σ.

Authorship and Review

Tool developed by Ugo Candido. Content verified by CalcDomain Editorial Board.
Last reviewed for accuracy on: September 14, 2025.