Sample Size Calculator
Find how many people to survey for a given margin of error, how big a sample estimates a mean to a set precision, or how many visitors an A/B test needs per group, with the formulas and a curve.
How to Use
- Choose survey (a percentage), mean or A/B test.
- Set the confidence level (95% is usual; for A/B tests this is 1 − α).
- For a survey, type the margin of error and expected percentage (50% if unsure) and, if small, the population size.
- For a mean, type the standard deviation and the margin you want; for an A/B test, the two rates and the power.
- Read the sample size, always rounded up; the curve shows how precision or power changes with n.
Worked Example
A staff survey. For ±5% at 95% confidence with no idea of the answer, n₀ = 1.96² × 0.5 × 0.5 ÷ 0.05² = 384.2. The company has 1,000 staff, so n = 384.2 ÷ (1 + 383.2/1000) = 277.8, and you need 278 responses.
An A/B test. To detect a lift from 10% to 12% conversion (α = 0.05, power 80%): z_α = 1.960, z_β = 0.842, and n = (1.960√(2 × 0.11 × 0.89) + 0.842√(0.09 + 0.1056))² ÷ 0.02² = 3,841 visitors per variant, 7,682 in total.
The common mistake: rounding down. 384.2 must become 385, never 384: with 384 responses the margin of error is slightly over 5%. Sample sizes are always rounded up.
Show Work
Formulas
Why 1,000 People Is Enough
In 1936 the Literary Digest mailed 10 million ballots, got 2.4 million back and predicted Alf Landon would beat Franklin Roosevelt. George Gallup, with a carefully chosen sample of about 50,000, predicted Roosevelt’s landslide. The lesson stuck: a well-drawn sample beats a huge biased one, and the margin of error depends on the sample size, not the population size.
Jacob Cohen’s Statistical Power Analysis for the Behavioral Sciences (1969) made planning for power standard in research, after showing that many published studies were too small to detect the effects they were looking for.
About This Calculator
This calculator works out the sample size for estimating a percentage (with the finite population correction), a mean, or a difference between two percentages with a chosen power, always rounding up. It shows each step and a curve of the margin of error, or the power, against the sample size, so you can see what a smaller or larger sample would buy.
Everything runs in your browser; nothing is sent anywhere.
Related calculators: Confidence Interval Calculator, P-Value Calculator, and Statistics Calculator.
Frequently Asked Questions
How many people do I need to survey?
For a ±5% margin of error at 95% confidence, 385; for ±3%, 1,068; for ±1%, 9,604. The formula is n = z² p(1 − p) ÷ E² with p = 0.5 as the safe guess: 1.96² × 0.25 ÷ 0.05² = 384.2, rounded up to 385. Precision costs a lot: halving the margin of error needs four times as many people.
Does the population size matter?
Only when the sample is a sizeable part of it. For a population of 1,000, the finite population correction n₀ ÷ (1 + (n₀ − 1)/N) brings 385 down to 278. For a city of a million it hardly changes anything (384), which is why national polls of about 1,000 people work for any country size.
What p should I use?
50% if you have no idea, because p(1 − p) is largest there and gives the biggest, safest sample. If earlier data suggest about 10%, then 1.96² × 0.1 × 0.9 ÷ 0.05² = 139 is enough for ±5%.
How big should an A/B test be?
Big enough to detect the difference you care about with high power. To tell a 10% conversion rate from 12% (a 20% relative lift) with α = 0.05 two-sided and 80% power you need about 3,841 visitors per variant. Detecting 10% versus 11% needs about 14,750 per variant.
What is statistical power?
The chance the test detects a real difference of the size you planned for. At 80% power a real effect is missed 1 time in 5. Power rises with sample size and with the size of the effect; 80% is the usual minimum, 90% for important decisions.
How do I use the Sample Size Calculator?
Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Do I need to install or sign up for anything?
Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.
Is my information private?
Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.
Common Use Cases
Customer surveys
±5% at 95% confidence: 385 responses.
Small populations
1,000 employees, ±5%: 278 responses.
Measurements
SD 15, mean within ±2 at 95%: 217 readings.
A/B tests
10% vs 12% conversion, 80% power: 3,841 visitors per variant.
Polls
±3% at 95%: 1,068 people.
Last updated: