Home / Math / Statistics / Sample Size Calculator
Math calculator

Sample Size Calculator

Estimate sample size for a proportion or population mean using confidence, margin of error, and a proportion or standard deviation.

Calculator

%
%
Use 50% when you do not have a prior estimate.
Enter 0 if the population is unknown or very large.
Enter your values and select Calculate.

Sample Size Results

Sample Size Comparison

Calculation Details

MeasureValueMethod

What this sample size calculator estimates

Plan a sample for either a population proportion, such as the share choosing an option, or a population mean, such as an average measurement. The two modes use different inputs and normal-approximation assumptions. This is estimation planning, not a power analysis for comparing groups or testing a hypothesis.

How to use the inputs

Choose a confidence level, set the maximum margin of error in percentage points, and enter a prior estimate for the proportion. If no estimate is available, 50% is a conservative choice that produces the largest sample size for a fixed confidence level and margin of error. Enter the total population when it is known and sampling without replacement; leave it at 0 for an unknown or very large population.

Formula and finite population correction

Large-population sample: n₀ = z² × p × (1 − p) / E²

Finite population: n = n₀ / [1 + (n₀ − 1) / N]

Here, z is the normal critical value for the selected confidence level, p is the expected proportion as a decimal, E is the margin of error as a decimal, and N is the population size. The calculator rounds the result up because a fraction of a completed response is not possible. For the finite-population estimate, it applies the correction for sampling without replacement. NIST explains the proportion-based sample size inputs and finite-population correction in its Engineering Statistics Handbook.

Worked example

For 95% confidence, a 5-percentage-point margin of error, and an unknown proportion set to 50%, z = 1.96 and p = 0.50. The large-population estimate is 384.16, so plan for at least 385 completed responses. If the population is 1,000 and the sample is drawn without replacement, the finite-population correction reduces the estimate to 278.

Sample size from standard deviation for a mean

Mean mode uses a known population standard deviation, or an explicit planning assumption from prior work. Enter the desired margin in the same units as that SD: for measurements in minutes, both entries are in minutes, not percentages. The standard error is not a substitute for SD.

Mean-estimation sample: n0 = (z x SD / E) squared

For SD = 20, absolute margin E = 10, and 95% confidence, the unrounded estimate is (1.96 x 20 / 10) squared = 15.3664, so the target is 16 observations. This matches the rounded sample target in NIST's process-mean planning example, which uses an approximate critical value of 2.

Known SD versus a pilot estimate

A known-SD z model assumes independent random observations and a normal or adequately approximated sampling distribution. A pilot SD is uncertain: substituting it gives a planning estimate, not guaranteed coverage. For small samples with unknown variability, a t-based or other design-specific method may be needed; this calculator does not iterate a t critical value. OpenStax's known-SD mean interval explains the underlying normal model. Mean mode does not apply the proportion mode's finite-population correction.

To summarize existing measurements first, use the standard deviation calculator. A sample SD from that tool is a planning input, not proof that the population SD is known. These modes do not estimate the sample size needed to measure SD itself.

Completed responses are not invitations

The result is the number of usable, completed responses. If you expect an 80% response rate, divide the target by 0.80: 385 completed responses would require about 482 invitations. This adjustment is a separate planning step and does not fix nonresponse bias.

Important limitations

These estimates do not account for clustered or stratified sampling, unequal weights, design effects, subgroup reporting, or nonresponse bias. A larger sample does not repair a biased selection process. Complex surveys and clinical or experimental studies may need different methods and assumptions. CDC's Epi Info population survey guidance also describes its own survey inputs and assumptions. For research decisions, have the study design and sample-size method reviewed by a qualified statistician.

Frequently asked questions

Why is 50% the default expected proportion?

When the true proportion is unknown, 50% maximizes p × (1 − p), giving the most conservative sample size for this proportion-based formula.

What does a 5% margin of error mean?

It means the estimate is planned to be within about 5 percentage points of the population proportion at the selected confidence level, under the stated sampling assumptions.

Does higher confidence require more responses?

Yes. A higher confidence level uses a larger z value, which increases the required sample size when other inputs stay fixed.

Should I enter the total population?

Enter a finite population size when you know the number of eligible people or items and will sample without replacement. Otherwise, use 0 and the calculator will use the large-population estimate.

Related calculators