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 = 385, N = 1000: nadj = 385 / (1 + 384/1000) = 385 / 1.384 = 278.2 → 279

๐Ÿ“– 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: nadj = 385 / (1 + (385-1)/1000) = 385 / (1 + 0.384) = 385 / 1.384 = 278.2
3
Round up: nadj = 279. Knowing the population is only 1,000 reduces required sample from 385 to 279, saving 106 surveys (27% reduction).
Required Sample Size = 279 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.