Sample Size Calculator
Required sample size to estimate a proportion or mean at a chosen confidence level and margin of error.
n = z²·p̂(1−p̂) / E² = 1.960²·0.5·0.500 / 0.05² ≈ 384.1
How many respondents, customers, or measurements do you need? This calculator returns the minimum sample size required to estimate a population proportion or mean within a target margin of error at a chosen confidence level — and applies the finite-population correction when you know N.
The formulas
Proportion: n = z² · p̂ · (1 − p̂) / E². p̂ is your best guess of the true proportion (use 0.5 for the most conservative — largest required n). E is the half-width of the confidence interval you'll accept.
Mean: n = (z · σ / E)². σ is the population standard deviation (use a pilot study or domain knowledge to estimate). E is the half-width of the interval on the mean.
Finite-population correction (proportions): n_adj = n / (1 + (n − 1)/N) where N is the population size. Drops n meaningfully when n approaches N.
Worked example — survey design
You want to estimate the proportion of voters supporting a candidate within ±3 percentage points, at 95% confidence.
z = 1.96, E = 0.03, p̂ = 0.5 (worst case).
n = 1.96² · 0.5 · 0.5 / 0.03² = 3.8416 · 0.25 / 0.0009 ≈ 1067.
Halve the margin to ±1.5 pp and n quadruples to ≈ 4269. Precision is expensive.
Worked example — quality control
Estimate the mean weight of bagged chips to within ±2 g at 99% confidence. Historical σ = 8 g.
z = 2.576, n = (2.576 · 8 / 2)² = 10.304² ≈ 106.
If σ is unknown, the formula uses z; the actual study then uses t. For n > 30 the difference is small; for smaller pilot runs, inflate by ~10–15% as a safety margin.
How precision and confidence interact
Quadrupling confidence width has no fixed cost; doubling precision (halving E) always quadruples n.
Margin of error scales as 1/√n. Going from n = 400 to n = 1600 halves the margin.
If the true p̂ is close to 0 or 1, the required n is smaller than the p̂ = 0.5 worst case — but unless you're confident about p̂, use 0.5 to be safe.
Common pitfalls
Ignoring non-response. If 60% of contacted respondents reply, you need to contact 1067 / 0.6 ≈ 1779 people to land 1067 responses.
Stratified or clustered designs need a design effect (DEFF) multiplier, often 1.2–2.0, on top of the simple-random-sample n.
Multiple subgroup estimates each need their own n. A national poll with N = 1067 can have ±3pp overall but ±10pp for a 100-person subgroup.
Forgetting the FPC when N is small relative to n. Sampling 400 of 1000 needs only n_adj ≈ 286.
Frequently asked questions
Why use p̂ = 0.5 by default?
Because p̂(1−p̂) peaks at 0.25 when p̂ = 0.5 — that's the largest possible n you'd need, so you're guaranteed enough precision regardless of the true proportion.
Margin of error in percentage points vs percent?
±3 percentage points means the interval has half-width 0.03 in proportion units. Don't enter 3 — enter 0.03.
How do I plan for hypothesis testing instead?
That uses POWER analysis — you specify the effect size you want to detect, α, and 1 − β (power). Different formula. We can add a power calculator on request.
Does this account for design effect?
No — it's the simple-random-sample formula. Multiply by your DEFF if you have a clustered design.
More in Statistics & Probability
From z-scores and confidence intervals to t-tests, chi-square, correlation, regression, and the binomial/Poisson distributions — textbook-grade tools with worked examples.
- Z-Score Calculator
Convert a value to a z-score, percentile, and tail probabilities using the standard normal distribution.
- Normal Distribution Calculator
Find P(X<x), P(X>x), and between-range probabilities for any normal distribution with mean μ and SD σ.
- Binomial Distribution Calculator
Compute P(X=k), cumulative probabilities, mean, and variance for n trials with success probability p.
- Poisson Distribution Calculator
Model rare events with rate λ — get P(X=k), cumulative probability, mean, and variance.
- Permutations & Combinations Calculator
Compute nPr (order matters) and nCr (order doesn't) with full counting-principle explanation.
- Bayes' Theorem Calculator
Update prior beliefs with new evidence using Bayes' rule — posterior probability with tree diagram.
Related calculators
Browse all Education →Confidence Interval Calculator
Compute z or t confidence intervals for a mean, with margin of error breakdown.
Standard Deviation Calculator
Mean, median, mode, range, sample/population standard deviation, variance, quartiles, IQR, and SEM for any list of numbers.
T-Test Calculator
One-sample and two-sample t-tests with t-statistic, p-value, and rejection regions.
Scientific Calculator
Free online scientific calculator with trig, logs, exponents, square roots, parentheses, and constants pi and e.
Average Calculator
Mean, median, mode, sum, count, min, max, and range for any list of numbers.
Proportion Calculator
Solve any proportion a/b = c/d for the missing value using cross-multiplication.
Binomial Distribution Calculator
Compute P(X=k), cumulative probabilities, mean, and variance for n trials with success probability p.
Poisson Distribution Calculator
Model rare events with rate λ — get P(X=k), cumulative probability, mean, and variance.