100+ free calculators - no signup, no ads | 💰 Financial ❤️ Health & Fitness 📐 Math 🔧 Other
🇺🇸 USD | About Contact

Sample Size Calculator

Survey proportion · Mean · Margin of error · Power for two groups

n = z² × p(1 − p) ÷ E²

👥 Enter a confidence level and margin of error to see how many responses you need.

What Is Sample Size?

Sample size is the number of people, items, or measurements you include in a study. A sample that is too small gives estimates with a wide margin of error. A sample that is too large wastes time and money without adding much precision, because the margin of error shrinks only with the square root of n.

The required sample size depends on three choices: how confident you want to be (the confidence level), how close you want the estimate to be to the true value (the margin of error), and how much the answers vary (p for a yes or no question, σ for a measurement). Population size matters only when the population is small. This calculator answers the question "how many people should I survey?" and the related question "what margin of error does my sample give?"

How to Use the Sample Size Calculator

  1. Proportion: for surveys and polls with yes or no answers or percentages. Enter the margin of error in percentage points and the expected proportion. Keep 50% if you have no prior estimate.
  2. Mean: for measurements such as weight, time, or income. Enter the margin in the same units as the data and an estimate of the standard deviation σ.
  3. Margin: works in reverse. Enter a sample size you already have, or can afford, to see the margin of error it gives.
  4. Power: for experiments that compare two group means or test one mean against a target. Enter the smallest difference worth detecting, σ, and the power you want.

Add a population size only when you know it and it is small, such as 800 employees. The response rate converts completed responses into the number of people to contact: 385 completes at a 25% response rate means 1,540 invitations.

Sample Size Formulas

Proportion: n₀ = z² × p(1 − p) ÷ E² 95%, E = 0.05, p = 0.5: 3.8415 × 0.25 ÷ 0.0025 = 384.15, round up to 385
Mean: n₀ = (z × σ ÷ E)² σ = 15, E = 3: (1.96 × 15 ÷ 3)² = 9.8² = 96.04 → 97
Finite population: n = n₀ ÷ (1 + (n₀ − 1) ÷ N) N = 10,000: 384.15 ÷ 1.0383 = 369.97 → 370
Margin of error: E = z × √(p(1 − p) ÷ n) n = 400: 1.96 × √(0.25 ÷ 400) = 1.96 × 0.025 = 0.049 = ±4.9%
Two groups: n = 2(z₁₋α/₂ + z₁₋β)² σ² ÷ Δ² 80% power, σ = 10, Δ = 5: 2 × 2.8016² × 100 ÷ 25 = 62.79 → 63 per group, 126 total

Sample Size Table by Margin of Error

Completed responses needed for a large population with p = 50%. These are the most common survey sample sizes.

Margin90%95%99%
±1%6,7649,60416,588
±2%1,6912,4014,147
±3%7521,0681,844
±4%4236011,037
±5%271385664
±7%139196339
±10%6897166

Halving the margin multiplies the sample by four. Critical z values: 1.645 at 90%, 1.960 at 95%, 2.576 at 99%.

How to Calculate Sample Size Manually

  1. Pick the confidence level and find z: 1.645 for 90%, 1.960 for 95%, 2.576 for 99%.
  2. Write the margin of error as a decimal: ±4% becomes 0.04.
  3. Choose p (use 0.5 if unknown) or estimate σ for a mean.
  4. Calculate n₀ with the proportion or mean formula.
  5. If the population N is known and small, apply n = n₀ ÷ (1 + (n₀ − 1) ÷ N).
  6. Round up, never down, then divide by the expected response rate.

Worked example. A researcher surveys a town of 2,000 residents at 95% confidence with a ±4% margin and p = 0.5. Step 4 gives n₀ = 1.96² × 0.25 ÷ 0.04² = 3.8415 × 0.25 ÷ 0.0016 = 600.23. Step 5 gives 600.23 ÷ (1 + 599.23 ÷ 2,000) = 600.23 ÷ 1.2996 = 461.85, so 462 completed responses. With a 40% response rate she should invite 462 ÷ 0.40 = 1,155 residents.

Does Population Size Matter?

Less than most people expect. The table shows completed responses needed at 95% confidence.

Population N±5%±3%
1008092
500218341
1,000278517
5,000357880
10,000370965
100,0003831,056
Unlimited3851,068

A national poll of millions and a city poll of 100,000 need almost the same sample. The correction matters once n₀ is more than about 5% of N.

Choosing p, the Margin, and the Response Rate

Expected proportion. The product p(1 − p) peaks at 0.25 when p = 0.5, so 50% always gives a sample large enough. If a pilot shows about 10%, p(1 − p) = 0.09 and the sample drops by 64%.

Margin of error. ±5% is common for internal surveys, ±3% for published polls. Pick the margin that would change your decision; a 52% versus 48% split needs a margin under ±2% to call.

Response rate. The formulas give completed responses. Divide by the expected response or retention rate to get the number of people to contact or enroll.

Sample Size for Comparing Two Groups (Power Analysis)

When an experiment compares two groups, the question changes from "how precise?" to "how likely am I to detect a real difference?". Power (1 − β) is the probability that the test finds a difference of size Δ when it exists. 80% is the usual minimum and 90% is common in clinical trials. α, the false positive risk, equals 1 minus the confidence level.

For two independent groups the sample size per group is 2(z₁₋α/₂ + z₁₋β)² σ² ÷ Δ². For one sample compared with a fixed target, drop the factor of 2. Use z₁₋α instead of z₁₋α/₂ for a one sided test. The ratio Δ ÷ σ is the standardized effect size d: halving d multiplies the sample by four.

These formulas use z and assume σ is known. With small samples, t critical values are larger, so the calculator also iterates with t until n settles. The NIST one sample example (one sided, α = 0.05, 90% power, Δ = σ) gives 8.57 → 9 with z and about 11 with t.

Common Mistakes

  • Rounding down. 384.15 must become 385. Rounding to 384 leaves the margin slightly above target.
  • Entering the margin as a whole number in the formula. ±5% is 0.05 in n = z²p(1 − p) ÷ E². Using 5 gives a sample of 0.04.
  • Confusing completed responses with invitations. At a 20% response rate, 385 completes require 1,925 contacts.
  • Ignoring subgroups. If you will report men and women separately, each subgroup needs its own sample for the same margin.
  • Guessing σ too low. Underestimating σ by 20% cuts the sample by 36%. When unsure, use a larger σ from a pilot or published study.
⚠️
A large sample does not fix bias. The formulas cover random sampling error only. A convenience sample, an opt in web panel, or low response from one group can bias results at any size.

Frequently Asked Questions

How do you calculate sample size?
For a proportion use n = z² × p(1 − p) ÷ E²; for a mean use n = (z × σ ÷ E)². Round up, apply the finite population correction if N is small, then divide by the response rate.
What sample size do I need for a 95 percent confidence level and 5 percent margin of error?
385 completed responses for a large population: 1.96² × 0.25 ÷ 0.05² = 384.15, rounded up. A population of 10,000 needs 370 and a population of 1,000 needs 278.
Does population size affect sample size?
Only for small populations. At 95% and ±5%, 100,000 people need 383 responses and an unlimited population needs 385, while 100 people need 80.
Why use 50 percent as the expected proportion?
p(1 − p) is largest at p = 0.5, so it gives the most conservative sample size and covers every question in a survey. Use a prior estimate only when you trust it.
How do you calculate sample size for comparing two groups?
Use n = 2(z₁₋α/₂ + z₁₋β)² σ² ÷ Δ² per group. At α = 0.05 and 80% power, detecting Δ = 5 with σ = 10 needs 63 per group, 126 in total, before allowing for dropouts.

Sources & References

  • NIST/SEMATECH. Engineering Statistics Handbook, 7.2.2.2 Sample Sizes Required itl.nist.gov
  • OpenStax. Introductory Statistics 2e, 8.3 A Population Proportion openstax.org
  • Penn State. STAT 415, 6.3 Estimating a Proportion for a Small, Finite Population online.stat.psu.edu
  • Penn State. STAT 509, 6a.5 Comparative Treatment Efficacy Studies online.stat.psu.edu

Results are estimates for planning and assume simple random sampling. They are not a substitute for advice from a statistician on a complex design. Methodology reviewed: 2026.