Sample Size Calculator

Find the minimum sample size for surveys and experiments at your required confidence level and margin of error.

📊 Sample Size Calculator
Confidence Level
Margin of Error5%
%
1%20%
Expected Proportion50%
%
10%90%
Population Size (0 = infinite)
Confidence Level
Margin of Error (same units as SD)5
0.530
Standard Deviation (σ)15
150
Population Size (0 = infinite)
Required Sample Size (n)
Unadjusted n (before FPC)
Z-Score Used
Confidence Level
Actual Margin of Error with this n:

📊 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

n  =  Z² × p × (1 − p) ÷ E²   (Proportion)
Z = z-score for confidence level (1.645 for 90%, 1.960 for 95%, 2.576 for 99%)
p = expected proportion as a decimal (use 0.5 for maximum, most conservative n)
E = desired margin of error as a decimal (0.05 for ±5%)
Example: 95% confidence, 5% margin, 50% proportion: n = 1.960² × 0.5 × 0.5 / 0.05² = 3.8416 × 0.25 / 0.0025 = 384.16 → 385
n  =  (Z × σ ÷ E)²   (Mean)
Z = z-score for confidence level
σ = population standard deviation (estimated from prior data or pilot study)
E = desired margin of error in same units as the measurement
Example: 95% confidence, E = 3 units, σ = 10: n = (1.960 × 10 / 3)² = 6.533² = 42.68 → 43
nadj  =  n ÷ (1 + (n − 1) ÷ N)   (Finite Population Correction)
n = sample size from the proportion or mean formula above
N = total population size (known finite population)
Example: n_exact = 384.16, N = 1000: nadj = 384.16 / (1 + 383.16/1000) = 384.16 / 1.383 = 277.8 → 278

📖 How to Use This Calculator

Steps

1
Select proportion or mean mode - Choose Proportion (Survey) to find the sample size for a proportion or percentage (polls, surveys, quality audits). Choose Mean to find the sample size for estimating an average (height, income, test score) when you know the standard deviation.
2
Set confidence level and margin of error - Select a confidence level (80%, 85%, 90%, 95%, or 99%). Enter your desired margin of error: a percentage for proportions (e.g. 5%) or an absolute value for means (e.g. 3 cm). Tighter margins and higher confidence both increase required n.
3
Enter proportion or standard deviation - In Proportion mode, enter the expected proportion (use 50% if unknown). In Mean mode, enter the estimated population standard deviation from prior research or a pilot study.
4
Enter population size for FPC (optional) - If the total population is known and smaller than 100,000, enter it to apply the finite population correction and reduce the required sample size. Leave blank or enter 0 to assume an infinite population.
5
Click Calculate to get the required sample size - Click Calculate to see the required sample size (rounded up), the achieved margin of error with that exact n, the z-score used, and the FPC adjustment details.

💡 Example Calculations

Example 1 - Standard Political Poll

95% confidence, 5% margin of error, unknown approval rate (use 50%), infinite population

1
Z = 1.960 (for 95% confidence). E = 0.05. p = 0.50 (most conservative assumption).
2
n = 1.960² × 0.5 × 0.5 / 0.05² = 3.8416 × 0.25 / 0.0025 = 0.9604 / 0.0025 = 384.16
3
Round up: n = 385. With 385 respondents, actual margin of error = 1.96 × sqrt(0.25/385) = ±4.99%, confirming the target is met.
Required Sample Size = 385 respondents
Try this example →

Example 2 - Precise Survey (3% Margin of Error)

95% confidence, 3% margin of error, 50% expected proportion, infinite population

1
Z = 1.960. E = 0.03. p = 0.50. Tighter margin requires a larger sample.
2
n = 1.960² × 0.25 / 0.03² = 3.8416 × 0.25 / 0.0009 = 0.9604 / 0.0009 = 1067.1
3
Round up: n = 1068. Narrowing the margin from 5% to 3% increases sample size from 385 to 1068 (a 2.8× increase), because n scales as 1/E².
Required Sample Size = 1,068 respondents
Try this example →

Example 3 - Estimating a Mean (IQ Study)

95% confidence, margin of error = 3 IQ points, population SD = 15 (known IQ standard deviation)

1
Z = 1.960. E = 3 (IQ points). σ = 15 (population SD for IQ is well established).
2
n = (1.960 × 15 / 3)² = (9.8)² = 96.04
3
Round up: n = 97. With 97 participants, the 95% CI for mean IQ will be within ±3 IQ points of the true population mean.
Required Sample Size = 97 participants
Try this example →

Example 4 - Survey with Finite Population (Employee Survey)

95% confidence, 5% margin, 50% proportion, company has N = 1,000 employees total

1
Basic n (infinite population assumption): n = 385 (as in Example 1).
2
Apply FPC to the exact n (384.16): nadj = 384.16 / (1 + (384.16-1)/1000) = 384.16 / 1.383 = 277.8
3
Round up: nadj = 278. Knowing the population is only 1,000 reduces required sample from 385 to 278, saving 107 surveys (28% reduction).
Required Sample Size = 278 employees (down from 385 without FPC)
Try this example →

❓ Frequently Asked Questions

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)² × 0.5 × 0.5 / (0.05)² = 384.16, rounded up to 385. This is the standard "n = 385" figure cited in most polling methodology notes. If your population is smaller than about 20,000, apply the finite population correction to reduce n further.
What is the formula for sample size calculation?+
For proportions: n = Z² × p × (1-p) / E², 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 × sigma / E)², 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 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 greater than 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 z²). 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 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.
Why does sample size not depend much on total population size?+
The basic sample size formula has no N in it at all. Intuitively, what determines precision is the absolute number of observations, not the fraction of the population sampled. A poll of 385 gives the same margin of error whether the population is 1 million or 1 billion. Population size only enters through the FPC when N is small relative to n (specifically when n/N exceeds 5%). This counterintuitive result is why a 1,000-person national poll can accurately represent 330 million Americans.
How do I estimate the standard deviation for the mean formula?+
Options in practice: (1) Use a published value from prior studies on the same population (e.g. IQ has a well-known SD of 15). (2) Run a small pilot study of 20-30 observations and use the sample SD as an estimate. (3) Use the range/4 rule of thumb: the SD is roughly (max - min) / 4 for normally distributed data. (4) Use a conservative overestimate to ensure adequate power. A larger assumed SD gives a larger required n, so erring on the high side is safer than underestimating.
Why must the sample size be rounded up?+
Rounding down produces a sample that does not technically meet the stated margin of error. If n = 384.16, then n = 384 gives a margin slightly larger than 5%, violating the guarantee. Rounding up to 385 ensures the stated precision is achieved. Always use the ceiling function (round up), never standard rounding or truncation, for sample size calculations. This is standard practice in all sample size tables and power analysis software.
How does the expected proportion affect the required sample size?+
Sample size is proportional to p(1-p), which is maximised at p = 0.5 and decreases toward 0 and 1. At p = 0.3 or p = 0.7, p(1-p) = 0.21, so you need 84% as many respondents as at p = 0.5. At p = 0.1 or p = 0.9, p(1-p) = 0.09, so you need only 36% as many. If prior data strongly suggests the proportion will be near an extreme, use that estimate to plan a smaller, more efficient study.
What is the difference between sample size and sample size per group in a two-sample study?+
This calculator computes the total sample size for estimating a single proportion or mean. In two-sample studies (A/B tests, comparing two groups), the formula changes to account for detecting a difference between two groups. For two-sample proportion tests: n per group = (Z_alpha + Z_beta)² × 2 × p(1-p) / delta². For two-sample mean tests: n per group = 2 × (Z_alpha + Z_beta)² × sigma² / delta². Use a power analysis calculator for these two-sample designs.

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.