Sample Size Calculator
Instantly calculate the minimum sample size needed for your survey, poll, clinical trial, or research study. Enter your confidence level, margin of error, and estimated proportion — with optional finite population correction — and get a statistically valid sample size in seconds.
Trusted by students, researchers, market analysts, and educators at He Loves Math — because every good study starts with the right number of observations.
Quick Answer: The Sample Size Formula
For a population proportion with a large or unknown population size:
For a finite population of size N, apply the correction factor:
Where Z is the z-score (1.96 for 95% confidence), p is the estimated proportion (0.5 if unknown), and E is the margin of error (e.g. 0.05 for ±5%). Always round n up to the next whole number.
Sample Size Calculator
Select your confidence level, enter the margin of error and population proportion, then click Calculate. Click Show Details to see the full step-by-step breakdown.
① Select Confidence Level
The Sample Size Formula — Complete Explanation
The sample size formula for estimating a population proportion is derived from the theory of confidence intervals and the Central Limit Theorem. It answers the question: how many observations do we need so that our sample estimate will be within E of the true value with probability equal to our confidence level?
Step 1 — The Infinite Population Formula
When the population is very large (or effectively infinite), the required sample size is:
- \(Z\) — Z-score from the standard normal distribution for the chosen confidence level
- \(p\) — Estimated proportion of the population with the characteristic of interest
- \((1-p)\) — Complement of the proportion (often written as \(q\))
- \(E\) — The desired margin of error (half-width of the confidence interval)
Step 2 — Where Does This Formula Come From?
The formula is derived from the structure of a confidence interval for a proportion. A 95% confidence interval for a proportion is:
The half-width of this interval is the margin of error \(E\). Setting \( E = Z \cdot \sqrt{p(1-p)/n} \) and solving for \(n\):
Step 3 — Finite Population Correction (FPC)
When the sample represents a significant proportion of the population, the uncorrected formula over-estimates the required size. The finite population correction adjusts for this:
This is algebraically equivalent to:
The FPC makes a meaningful difference when \(n_0 / N > 0.05\) — that is, when the initial sample size exceeds 5% of the population. Below that threshold the correction is negligible and can be skipped.
Step 4 — Round Up
Because you cannot survey a fractional person, always round \(n\) (or \(n_0\)) up to the next whole number using the ceiling function:
What Is Sample Size and Why Does It Matter?
A sample size is the count of individual observations or participants selected from a larger population for inclusion in a research study, survey, or experiment. The population is the entire group about which you wish to draw conclusions; the sample is the subset you actually measure.
Getting the sample size right is one of the most consequential decisions in study design. The consequences of misjudging it run in both directions:
- Too small a sample produces wide confidence intervals and low statistical power. A study that is underpowered may fail to detect a real effect (Type II error) or produce estimates so imprecise they are useless for decision-making.
- Too large a sample wastes resources — participant time, money, laboratory costs, and the opportunity cost of longer data collection. In a clinical trial, an unnecessarily large study also raises ethical concerns because participants in the control arm are kept from a potentially beneficial treatment longer than necessary.
The sample size formula gives you the mathematical minimum that achieves your desired precision and confidence simultaneously. It is the sweet spot between accuracy and efficiency.
Key principle: Sample size calculations are about controlling two types of error — the probability of a false positive (Type I, controlled by the significance level α = 1 − confidence level) and the probability of a false negative (Type II, controlled by statistical power). This calculator handles Type I error via the confidence level; for power-based sample sizes in hypothesis testing, additional parameters are needed.
Understanding Each Input Parameter
Confidence Level & Z-Score
The confidence level is the long-run probability that the confidence interval contains the true population parameter. Choosing 95% means: if you ran the same study 100 times, around 95 of the resulting intervals would capture the true value.
The corresponding Z-score comes from the standard normal distribution:
- 90% → Z = 1.645
- 95% → Z = 1.96
- 98% → Z = 2.326
- 99% → Z = 2.576
Margin of Error (E)
The margin of error is the maximum acceptable difference between your sample estimate and the true population value. A ±5% margin (E = 0.05) means your sample proportion could be up to 5 percentage points above or below the true proportion.
Because E appears squared in the denominator of the formula, small reductions in E require dramatically larger samples. Cutting E in half quadruples the required sample size.
Population Proportion (p)
The proportion is your best estimate of how common the characteristic of interest is in the population. The product \( p(1-p) \) in the formula reflects the variability of a Bernoulli random variable.
This product is maximised at \( p = 0.5 \), giving its maximum value of 0.25. Using \( p = 0.5 \) when the true proportion is unknown produces the most conservative (largest) sample size — a safe default that ensures sufficient precision regardless of the truth.
Population Size (N)
For large or infinite populations, N is irrelevant and can be left blank. When the population is small and known — a school of 500 students, a company of 800 employees — providing N enables the finite population correction, which reduces the required sample size and saves resources.
The rule of thumb: apply the FPC when the initial sample size \(n_0\) exceeds 5% of N.
The Finite Population Correction — When and Why to Use It
The standard sample size formula assumes that each new observation adds independent information — a valid assumption when sampling from a large population. However, when sampling without replacement from a small population, later observations are constrained by earlier ones, and each observation provides more information than it would in an infinite population.
The finite population correction captures this efficiency gain. The mathematical derivation shows that the variance of the sample mean is reduced by a factor of \((N - n)/(N - 1)\) when sampling without replacement from a population of size N. This is equivalent to the FPC formula:
As N → ∞, this reduces to \( n = n_0 \), confirming that the correction vanishes for large populations. As N → n₀, the corrected sample approaches N itself — meaning you would need to survey the entire population, which makes sense: for a population of exactly 385 people when your uncorrected formula says you need 385, you simply survey everyone.
Worked Examples
Example 1 — Standard Political Poll (Large Population)
A polling firm wants to estimate voting intention in a national election with 95% confidence and a ±3% margin of error. The proportion favouring each candidate is unknown. How many voters must they survey?
Since the national electorate contains millions of voters, no finite population correction is needed. The firm needs at least 1,068 respondents.
Example 2 — School Survey (Finite Population)
A researcher surveys students at a school with N = 800 students about smartphone usage. Using 95% confidence, ±5% margin, p = 0.5:
The FPC reduces the required sample from 385 to 260 students — a saving of 125 interviews.
Example 3 — High-Precision Clinical Research (99% Confidence)
A pharmaceutical researcher needs to estimate the proportion of patients experiencing a side effect with 99% confidence and a ±2% margin. Prior data suggests the proportion is about 15% (p = 0.15):
Note how the known proportion (0.15) produces a substantially smaller sample than using p = 0.5 would (which would give 4,147). Using domain-specific prior information can halve your data collection burden.
Example 4 — Effect of Margin of Error on Sample Size
This example illustrates the inverse-square relationship between E and n₀ at 95% confidence, p = 0.5:
| Margin of Error (E) | n₀ Required | Relative Cost vs. ±5% |
|---|---|---|
| ±10% (0.10) | 97 | 0.25× |
| ±5% (0.05) | 385 | 1× (baseline) |
| ±3% (0.03) | 1,068 | 2.8× |
| ±2% (0.02) | 2,401 | 6.2× |
| ±1% (0.01) | 9,604 | 24.9× |
Reducing the margin of error from ±5% to ±1% requires 25× more participants. This is why most surveys use ±3%–5% as a practical compromise between precision and cost.
Common Sample Size Reference Table
The table below shows minimum sample sizes at 95% confidence using p = 0.5 (the most conservative assumption) for various combinations of margin of error and population size.
| Population Size (N) | ±1% Margin | ±3% Margin | ±5% Margin | ±10% Margin |
|---|---|---|---|---|
| 500 | 476 | 341 | 218 | 82 |
| 1,000 | 906 | 517 | 278 | 88 |
| 5,000 | 3,289 | 880 | 357 | 94 |
| 10,000 | 4,900 | 965 | 370 | 95 |
| 50,000 | 8,057 | 1,045 | 382 | 96 |
| 100,000+ | 9,604 | 1,068 | 385 | 97 |
Values are rounded up to the next whole number. Use the calculator above for custom inputs.
Types of Sampling Methods
Calculating the correct sample size is only half the story. The sample method determines whether that size gives valid results. The four principal probability sampling methods each have different implications for how size calculations apply.
Simple Random Sampling
Every member of the population has an equal probability of being selected. This is the basis of the sample size formulas on this page. Truly random selection can be achieved using computer-generated random numbers or a random number table.
Stratified Random Sampling
The population is divided into subgroups (strata), and a random sample is drawn from each stratum. This method improves precision for heterogeneous populations but requires separate size calculations for each stratum or an overall formula that accounts for stratum weights.
Cluster Sampling
Naturally occurring groups (clusters) are randomly selected, and all or many members within each cluster are surveyed. Cluster sampling is cheaper for geographically dispersed populations but introduces a design effect that typically inflates the required sample size compared to simple random sampling.
Systematic Sampling
Every k-th member of the population is selected, starting from a random point. The interval k = N/n. Systematic sampling is simple to implement and approximates simple random sampling when the population list is in random order.
Common Errors in Sample Size Calculations
Even researchers with strong statistical training can make these mistakes when calculating sample sizes. Being aware of them prevents wasted resources and invalid conclusions.
- Using the population size as the sample size: A sample of 1,000 from a population of 1,000,000 is perfectly adequate for many research questions, but researchers sometimes instinctively feel they need to survey a large percentage of the population. They do not — the formula accounts for this.
- Forgetting to round up: The formula produces a real number; always round up using the ceiling function. Rounding down reduces precision below the target margin of error.
- Confusing the margin of error with a percentage value: Enter E as a decimal — 0.05 for ±5%, not 5. Entering 5 instead of 0.05 reduces the calculated sample size by a factor of 10,000.
- Ignoring non-response: The calculated n is the number of completed responses needed. If your expected response rate is 60%, you must approach \( n / 0.60 \) potential participants to achieve the required sample.
- Not adjusting for design effects in cluster sampling: Using a cluster design with a design effect (DEFF) of 1.5 means you need \( n \times 1.5 \) observations to achieve the same precision as simple random sampling of size n.
- Setting a confidence level too high unnecessarily: Jumping from 95% to 99% confidence increases the Z-score from 1.96 to 2.576, inflating the sample size by about 73%. Use 99% only when the decision stakes genuinely justify the cost.
Frequently Asked Questions
What is a sample size?
A sample size is the number of individual participants or observations included in a study or survey. It is chosen to represent a larger population so that statistical conclusions can be drawn about the whole group. The correct sample size balances statistical precision against the cost of data collection.
What is the formula for sample size?
For proportions with a large population: \( n_0 = Z^2 p(1-p) / E^2 \). With a finite population correction: \( n = n_0 / (1 + (n_0 - 1)/N) \). Always round up the final result. The variables are Z (z-score for confidence level), p (estimated proportion), E (margin of error), and N (population size).
What confidence level should I use for my survey?
The 95% confidence level is standard for most academic research, market research, and public opinion polls. It strikes the best balance between confidence and sample size. Use 99% for high-stakes decisions (clinical trials, regulatory submissions) and 90% when budget is particularly tight and the margin of error can be somewhat wider.
Why should I use p = 0.5 when the proportion is unknown?
The expression \( p(1-p) \) is maximised when \( p = 0.5 \), giving a value of 0.25. Any other proportion gives a smaller value and therefore a smaller (and potentially insufficient) sample size. Using 0.5 guarantees the most conservative estimate: your study will be adequately powered regardless of the true proportion.
What is the finite population correction and when should I use it?
The finite population correction (FPC) adjusts the required sample size downward when you are sampling from a small, known population without replacement. Apply it when the initial uncorrected sample size \(n_0\) exceeds 5% of the total population N. The formula is \( n = n_0 / (1 + (n_0 - 1) / N) \). For large populations, the correction is negligible and can be ignored.
How does the margin of error affect sample size?
There is an inverse-square relationship: halving the margin of error quadruples the required sample size. This is because \(E\) appears as \(E^2\) in the denominator. Going from ±5% to ±2.5% margin requires approximately 4× more participants. Carefully weigh precision needs against data collection costs before choosing your margin of error.
What is the minimum sample size for a survey?
At the standard settings of 95% confidence, ±5% margin of error, and p = 0.5, the minimum sample size is 385 for a large or unknown population. For a ±3% margin it rises to 1,068. There is no universal minimum — it depends entirely on your precision requirements and confidence level. Some exploratory studies operate with 30–50 responses, accepting wider margins.
Do I need to account for non-response in my sample size?
Yes. The calculated sample size is the number of completed responses you need. If your expected response rate is, say, 70%, divide the calculated n by 0.70 to find how many people you need to contact. For example, if you need 385 responses and expect 70% response: contact at least ⌈385 / 0.70⌉ = 550 people.
Related Tools & Resources
Further reading: Sample size determination — Wikipedia · CDC — Statistical Methods in Epidemiology
