Sample Size Calculator
Find the minimum sample size for surveys and experiments at your required confidence level and margin of error.
📊 What is a Sample Size Calculator?
A sample size calculator determines the minimum number of observations you need to collect so that your results meet a stated level of precision and confidence. In other words, it answers the question: "How many people do I need to survey, or how many measurements do I need to take, before I can trust my conclusions?" Getting this number right is one of the most important steps in designing any study, poll, clinical trial, or quality control inspection.
Sample size calculations appear in nearly every field that uses data. Political polling organisations use them to determine how many voters to interview so that the reported margin of error is 3% or less at 95% confidence. Pharmaceutical companies use them to plan the number of patients in a clinical trial so that a real treatment effect will be statistically detectable. Market research firms use them to decide how many consumers to survey for a product preference study. Quality engineers use them to determine how many units to inspect from a batch so that defect rates can be estimated reliably.
There are two distinct sample size problems addressed by this calculator. The proportion problem asks: "How many respondents do I need so that my estimated percentage (e.g. approval rating, defect rate, preference share) is within E percentage points of the true value?" The mean problem asks: "How many measurements do I need so that my estimated average is within E units of the true average?" Both use z-scores for the desired confidence level, and both support finite population correction when the total population is known and not extremely large.
A key insight is that sample size does not depend strongly on population size for large populations. A poll of 385 people gives the same margin of error whether the population is 1 million or 1 billion. Population size only matters when it is small relative to the sample, at which point the finite population correction (FPC) formula reduces the required n. This calculator shows both the unadjusted n and the FPC-adjusted n so you can see the difference clearly.
📐 Formula
📖 How to Use This Calculator
Steps
💡 Example Calculations
Example 1 - Standard Political Poll
95% confidence, 5% margin of error, unknown approval rate (use 50%), infinite population
Example 2 - Precise Survey (3% Margin of Error)
95% confidence, 3% margin of error, 50% expected proportion, infinite population
Example 3 - Estimating a Mean (IQ Study)
95% confidence, margin of error = 3 IQ points, population SD = 15 (known IQ standard deviation)
Example 4 - Survey with Finite Population (Employee Survey)
95% confidence, 5% margin, 50% proportion, company has N = 1,000 employees total
❓ Frequently Asked Questions
🔗 Related Calculators
What sample size do I need for a 95% confidence level with 5% margin of error?
For a proportion with 95% confidence and 5% margin of error, assuming 50% expected proportion (most conservative), the required sample size is n = (1.96)2 x 0.5 x 0.5 / (0.05)2 = 384.16, rounded up to 385. This is the standard sample size cited in most polling methodology notes. If your population is smaller than about 20,000, apply the finite population correction to reduce n.
What is the formula for sample size calculation?
For proportions: n = Z2 x p x (1-p) / E2, where Z is the z-score for your confidence level (1.96 for 95%), p is the expected proportion (use 0.5 to maximize n), and E is the desired margin of error as a decimal (0.05 for 5%). For means: n = (Z x sigma / E)2, where sigma is the population standard deviation and E is the absolute margin of error. Always round n up to the next integer.
What is the finite population correction (FPC) and when should I use it?
The FPC formula is n_adjusted = n / (1 + (n-1)/N), where N is the total population size. Use it whenever your sample would represent more than 5% of the total population (n/N > 0.05). For small populations (under 10,000), FPC can reduce required sample size significantly. For large populations (over 100,000), the correction is negligible and the unadjusted formula applies.
How does confidence level affect sample size?
Higher confidence requires a larger sample. Moving from 90% to 95% confidence increases n by about 40% (z goes from 1.645 to 1.960, and n scales as z2). Moving from 95% to 99% increases n by another 73% (z = 2.576). For a standard survey: 90% confidence needs 271, 95% needs 385, 99% needs 664 (all at 5% margin of error, 50% proportion). Choose confidence level based on the cost of a wrong conclusion, not habit.
What proportion should I use when I have no prior data?
Use p = 0.5 (50%). This maximises p(1-p) = 0.25, which gives the largest (most conservative) sample size. Any other proportion assumption gives a smaller n that could be insufficient if the true proportion turns out to be closer to 50%. If a previous study or pilot survey indicates a proportion far from 50% (e.g. p = 0.1 or p = 0.9), using that estimate will reduce the required n considerably.
What is the difference between margin of error and confidence interval?
The margin of error (E) is a half-width. A confidence interval is mean plus or minus E. If your survey finds 55% support with a 5% margin of error at 95% confidence, the 95% confidence interval is [50%, 60%]. The confidence level tells you how often this procedure captures the true parameter: 95% confidence means that if you repeated the survey many times, 95% of the resulting intervals would contain the true proportion.
How do I calculate sample size for a clinical trial?
Clinical trials typically use the two-sample t-test or proportion difference formula rather than the single-sample formulas shown here. For a two-sample mean comparison: n per group = 2 x (Z_alpha + Z_beta)2 x sigma2 / delta2, where delta is the minimum detectable difference, sigma is the SD, Z_alpha accounts for significance (1.96 for 5% alpha), and Z_beta accounts for power (0.842 for 80% power). Use the Mean mode here for single-group estimation, then multiply by 2 for two-arm trials.
Can I use this calculator for A/B testing sample sizes?
For A/B testing, the goal is detecting a difference between two proportions, not estimating a single proportion. The formula is different: n = (Z_alpha/2 + Z_beta)2 x 2 x p_bar x (1-p_bar) / delta2. Use the proportion mode here as a rough guide, or use a dedicated A/B test calculator for exact two-sample power analysis. Rule of thumb: set the minimum detectable effect as the margin of error and run proportion mode to get a ballpark estimate per variant.
Why must I round sample size up, not down or to the nearest integer?
Rounding down or to the nearest integer can produce a sample that does not technically meet the stated margin of error. If n = 384.16, then n = 384 gives a margin of error slightly larger than 5%, violating the guarantee. Rounding up to 385 ensures the stated precision is actually achieved. This is standard practice in all sample size tables and power analysis software.
How does expected proportion affect sample size?
Sample size is proportional to p(1-p), which is maximised at p = 0.5 (value = 0.25) and decreases symmetrically toward 0 and 1. At p = 0.3 or p = 0.7, p(1-p) = 0.21, requiring 84% as many respondents as at p = 0.5. At p = 0.1 or p = 0.9, p(1-p) = 0.09, requiring only 36% as many. If pilot data strongly suggests the proportion will be near an extreme, you can use that estimate to plan a smaller, more efficient study.
What sample size do I need for a population of 500?
For a population of N = 500, confidence 95%, margin 5%, proportion 50%: first compute n_basic = 385, then apply FPC: n_adj = 385 / (1 + 384/500) = 385/1.768 = 217.8, rounded up to 218. So instead of 385 respondents, you only need 218 when the population is known to be 500. The smaller the population relative to the basic sample size, the greater the reduction from FPC.