Sample Size Calculator
Before running a survey or a study, one of the most important questions to answer isn’t what you’ll find — it’s how many people or observations you actually need to trust the result. This calculator answers that question for proportion-based estimates (like “what percentage of customers prefer X”), returning the minimum sample size needed to reach a target margin of error at a chosen confidence level.
How the Sample Size Calculator Works
Enter your desired confidence level, your acceptable margin of error, an estimated population proportion, and — if known — your total population size. The calculator uses the standard formula for estimating a proportion: n = z² × p × (1 − p) / e², where z is the critical value for your confidence level, p is your estimated proportion, and e is your margin of error as a decimal. If you provide a finite population size, it applies a correction that reduces the required sample slightly, since sampling from a small, fully-known population requires proportionally fewer observations than sampling from an effectively infinite one.
Why the Proportion Estimate Matters More Than People Expect
The population proportion input (p) has an outsized effect on the result, because of the p × (1 − p) term in the formula — this expression is mathematically largest, and therefore requires the largest sample, when p = 50%. As your estimate moves toward 0% or 100%, the required sample size shrinks substantially. This is exactly why pollsters and researchers default to 50% when they have no prior information: it’s the most conservative assumption, guaranteeing your calculated sample size is large enough regardless of what the true proportion turns out to be. If you have solid prior data — a previous survey showing 20% adoption, for instance — using that more accurate estimate rather than a blind 50% can meaningfully reduce how many responses you actually need.
Confidence Level vs. Margin of Error: Two Different Dials
These two settings interact, but they aren’t the same thing. Confidence level is how sure you want to be that your sample result is close to the true population value — 95% is the standard default, meaning that if you repeated the survey many times, 95% of the resulting intervals would contain the true proportion. Margin of error is how close “close” needs to be — a tighter margin (say, ±2% instead of ±5%) demands a substantially larger sample, since the formula’s denominator is margin of error squared, meaning cutting the margin in half roughly quadruples the required sample size. This trade-off is unavoidable: more precision and more confidence both cost you sample size, and pushing both dials at once compounds the requirement quickly.
The Finite Population Correction: When Your Total Population Is Small
The base formula assumes you’re sampling from an effectively infinite population — reasonable when surveying, say, all adults in a country. But if your actual population is small and fully countable — 500 employees at a company, or 1,200 students at a school — a finite population correction reduces the required sample size, because sampling a larger fraction of a small, known group naturally produces more reliable estimates than the same sample size would from an unbounded population. Entering your total population size in this calculator applies that correction automatically; leaving it at zero assumes an unlimited population and gives you the more conservative, uncorrected sample size.
What This Calculator Does Not Cover: Mean-Based Sample Size
This tool is specifically built for proportions — estimating a percentage, like the share of people who prefer one option over another. If instead you’re planning to estimate a mean — the average value of a continuous variable, like average spending or average height — the sample size formula is different and requires an estimated standard deviation rather than a proportion as its key input. That calculation isn’t built into this specific tool. If you have pilot data and want to see how variability in a continuous dataset behaves before planning a mean-based study, the Standard Deviation Calculator is the correct starting point for that separate calculation.
After You’ve Collected Data: Building the Confidence Interval
This calculator answers the “before” question — how much data do I need? Once you’ve actually collected your sample and calculated a result, the natural next step is expressing your finding as a range rather than a single number, which is what a confidence interval does. The Confidence Interval Calculator takes over at that stage, using your actual sample mean and standard deviation (for continuous data) to report the range your true population value likely falls within — the two tools work as a before-and-after pair around the same data collection effort.
Testing a Specific Claim Once You Have Your Sample
If your survey or study is designed to test a specific claim — whether a new proportion differs meaningfully from an old one, for example — rather than just estimate a range, that’s a hypothesis test rather than an interval estimate. The P-value Calculator handles that framing directly once your data is collected, determining whether an observed difference is likely a real effect or plausibly just random sampling variation.
Counting Your Population Before You Sample It
If you need to select which specific individuals from a known population will be surveyed — rather than just deciding how many to survey — that’s a separate random selection step. The Random Number Generator can draw a random, unique selection of IDs or list positions from your full population once you know how many observations this calculator says you need.
Understanding the Probability Behind the Formula
The math underlying this calculator connects back to basic probability theory — specifically, the behavior of a proportion as an average of many independent yes/no outcomes. If you want to understand the underlying probability concepts these formulas are built on more directly, the Probability Calculator covers the foundational rules of combining and interpreting probabilities that this sample size formula ultimately rests on.
Frequently Asked Questions
What sample size do I need for a 95% confidence level with a 5% margin of error?
Using the conservative default of a 50% estimated proportion, this typically requires approximately 385 respondents from an effectively unlimited population. A smaller, known population size would reduce this number through the finite population correction.
Why does using 50% as the estimated proportion give the largest required sample size?
Because the formula’s core term, p × (1 − p), reaches its maximum value exactly at p = 50%. Using 50% when you have no prior data guarantees your calculated sample size will be large enough regardless of what the true proportion actually turns out to be, which is why it’s the standard conservative default.
Does a smaller margin of error always require a much larger sample?
Yes, and the relationship isn’t linear — margin of error appears squared in the denominator of the formula, so cutting your target margin of error in half roughly quadruples the required sample size, not just doubles it.
What is the difference between this calculator and the Confidence Interval Calculator?
This calculator answers a planning question before data collection: how many observations do I need? The Confidence Interval Calculator answers an analysis question after data collection: given what I actually found, what range likely contains the true population value? They’re complementary tools used at different stages of the same research process.
Can this calculator be used for a study estimating an average rather than a percentage?
No — this tool is built specifically for proportion-based sample size calculations, which require an estimated population proportion. Estimating sample size for a study measuring a continuous average requires a different formula based on estimated standard deviation instead, which this specific calculator does not compute.