Survey responses for a chosen margin of error, measurements for a mean, or people per group for an A/B test or a t-test, with finite population, response rate and dropout built in.
What sample size do you need for a population of 4000?
Survey responses for a chosen margin of error, measurements for a mean, or people per group for an A/B test or a t-test, with finite population, response rate and dropout built in.
The calculator below is set to a survey of a population of 4000, at a 95% confidence level, a margin of error of ±5 percentage points and an expected share of 50%, the most cautious assumption when you have no earlier result. Press Calculate for the number of completed responses you need after the finite population correction. Change any of the three assumptions in the form, or add a response rate to see how many invitations to send.
Parameters
Enter data for calculations
💡 Fill in all required fields to unlock the calculate button
Sample size for a survey, a mean, an A/B test or a two-group comparison
How many people do you actually need? For a poll with a ±5 point margin at 95% confidence the classic answer is 385, and it barely moves whether the population is 50,000 (382) or 50 million. For an A/B test hoping to lift a 3% conversion rate to 3.6% the answer is 13,914 visitors per variant. This sample size calculator covers four planning questions in one form: a survey percentage with an optional finite population and response rate, the mean of a measurement, two conversion rates, and two means compared with a t-test. The two-means mode uses the exact noncentral t distribution, so it returns 64 per group for an effect of d = 0.5, the figure R and G*Power give, where the plain normal formula says 63.
Four decisions to make before you type anything
Estimating one number (a share, an average) or detecting a difference between two groups. Estimation is planned with a margin of error, comparison with power.
For a survey, the margin in percentage points. For a mean, the margin in the units of the measurement. For a comparison, the smallest difference that would change a decision, not the difference you hope to see.
Confidence 95% is standard for estimates. For comparisons, alpha 0.05 and 80% power are the usual pair; 90% power costs about a third more participants.
Response rates for email surveys are often a fraction of those invited, and trials lose participants along the way. Enter the rate you expect and the calculator returns the number to invite or recruit.
The form, one field at a time
- What is the sample for - survey percentage, estimated mean, A/B test on two rates, or two means. Only the fields for that goal appear.
- Confidence level (estimates) - 90%, 95% or 99%. It sets the z value: 1.645, 1.960 or 2.576.
- Margin of error - for a survey in percentage points (5 means ±5 points), for a mean in the units you measure (±10 minutes, ±2 lb).
- Expected percentage - your best guess of the answer. Use 50 when you have none; it gives the largest, safest sample.
- Population size and response rate - optional. Leave the population empty when it is large or unknown; fill in the response rate to get the number of invitations.
- Standard deviation - for a mean or two means, taken from a pilot, earlier data, or roughly the range divided by 4.
- Baseline and target rate, or the difference in means - the effect you want to be able to detect.
- Alpha, power, one- or two-sided, dropout - for the two-group goals. Dropout is optional.
- Read the result: the headline n, the tiles with the alternative formulas, the table of how n changes with the margin or the power, and the step table.
Normal formula, exact t or continuity correction: which number to trust
Textbooks and online tools disagree by a few percent. Here is where each figure comes from.
| Question | Normal (z) formula | The refinement shown beside it | Who should use the refinement |
|---|---|---|---|
| Two means, d = 0.5 | 63 per group | exact t-test power: 64 | anyone who will analyze with a t-test, which is almost everyone |
| Two means, d = 0.333 (4 points, SD 12) | 142 per group | exact t: 143 | the gap is always one or two people, larger for small groups |
| A/B test, 3% to 3.6% | 13,914 per group | Fleiss continuity correction: 14,245 | teams whose analysis uses R's prop.test with its default correction |
| Mean, SD 40, margin 10 | 62 measurements | t-based interval: 64 | anyone reporting a t confidence interval, which is standard for means |
| Verdict | the textbook answer | the one to plan with | plan with the larger number; the difference is cheap insurance |
The formulas behind each goal, with three worked cases
mean: n0 = (z sigma / e)², then stepped up until t(n - 1) sigma / sqrt(n) fits e
two rates: n = [z_a sqrt(2 p(1 - p)) + z_b sqrt(p1(1 - p1) + p2(1 - p2))]² / (p1 - p2)²
two means: smallest n with noncentral t power at least the target, starting from 2 ((z_a + z_b) / d)²
Survey sizes for an expected 50%, by margin and confidence
The worst case p = 50% for an unlimited population. The 95% row at ±5 is the famous 385; halving the margin to about ±2.5 quadruples the sample, because the margin enters the formula squared.
| Confidence | ±1 | ±2 | ±3 | ±4 | ±5 | ±10 |
|---|---|---|---|---|---|---|
| 90% | 6,764 | 1,691 | 752 | 423 | 271 | 68 |
| 95% | 9,604 | 2,401 | 1,068 | 601 | 385 | 97 |
| 99% | 16,588 | 4,147 | 1,844 | 1,037 | 664 | 166 |
A finite population matters only when the sample is a noticeable slice of it. At ±5 points and 95% the answer is 218 for 500 people, 323 for 2,000 and 382 for 50,000.
Where sample size plans usually go wrong
Instead: plan for the smallest effect that would still change a decision. If only a 30% lift is worth shipping, fine; if 10% would also matter, plan for 10%.
Instead: the survey mode takes absolute points: 5 means the interval runs from 25% to 35% around an estimate of 30%.
Instead: comparing two percentages is a different question and needs the A/B mode; detecting 50% against 55% takes 1,565 per group at 80% power.
Instead: 385 completed surveys at a 10% response rate means 3,850 invitations. Fill in the response rate or the dropout field.
Instead: fix n in advance with this calculator and analyze once, or use a sequential design built for repeated looks.
Sample size questions with numbers in the answers
Related tools
Z-Test Calculator
Tests an A/B result on two conversion rates, with the continuity-corrected p and the traffic that gap would need - See calculator
Chi-Square Calculator
Tests independence in a table of counts or the fit of one list to expected shares - See calculator
Two-Sample T-Test Calculator
Compares two group means with Welch, Student or a paired test - See calculator
One-Sample T-Test Calculator
Tests one mean against a target and reports the n needed for 80% power - See calculator
Coefficient of Variation Calculator
Shows spread relative to the mean, useful for guessing a standard deviation from earlier data - See calculator
See also
Calculator verified by the LiczGrupa.pl team
Content, formulas and results have been reviewed for accuracy and relevance by our team of specialists.

Reviewed by: Natalia Skrzek