Summary: This sample size calculator computes mean and proportion planning with live steps, formulas and a chart. It accepts labeled numeric inputs, works offline through file:// and includes source-backed explanations for students, analysts and researchers.

Sample Size Calculator

Sample size calculator for means and proportions with confidence level, margin of error and finite population correction. The calculator works offline, updates instantly and includes a worked example, plain-text formula, MathML, references and structured data.

Default values are loaded. Click any field and edit it; results and chart update automatically.

Default example loadedproportion: p=0.5, E=0.05, confidence=95%. Change any value above to test your own data.
Result: -

Sample Size Calculator Quick Reference

Input or settingResult or interpretationUse this when
95%, E=.05, p=.5n=385sample planning
99%, E=.05, p=.5n=664sample planning
unknown puse p=0.5 for largest nsample planning

How to Use This Sample Size Calculator

  1. Choose one calculator from the dropdown, such as Standard Deviation Calculator or Linear Regression Calculator.
  2. Paste raw data into textarea fields or enter summary statistics in number fields.
  3. Review the headline result, supporting metrics, step-by-step solution and SVG visualization.
  4. Use the example button to compare against a known worked example from the reference table.
  5. Copy the result or export the visible output as CSV or PNG for notes and reports.
  6. Read the interpretation, pitfalls, glossary and references before making research decisions, especially when assumptions or tails affect the answer.

Sample Size Calculator Formula

Primary formulamean: n = (z* sigma / E)^2; proportion: n = p(1-p)(z*/E)^2; finite population: n_adj = n/(1+(n-1)/N)
Plain-English meaning

Sample size formulas choose n from confidence level, expected variability and target margin of error.

Example

proportion p=0.5, E=0.05, 95%

n = 385 after rounding up

This page uses the shared statistics core for distribution functions, quantiles and exact integer counting where needed. The formula is shown in plain text so screen readers and search engines can parse it reliably.

result=planning n before data collection

Sample Size Calculator Worked Example

Use Load example in the calculator to reproduce this reference result.

{
  "tool": "Sample Size Calculator",
  "input": "proportion p=0.5, E=0.05, 95%",
  "output": "n = 385 after rounding up",
  "formula": "mean: n = (z* sigma / E)^2; proportion: n = p(1-p)(z*/E)^2; finite population: n_adj = n/(1+(n-1)/N)"
}
CalculatorExample inputExpected output
Sample Size Calculatorproportion p=0.5, E=0.05, 95%n = 385 after rounding up

Interpretation Guide

What does p = 0.03 mean? If the null hypothesis and model assumptions were true, a result at least this extreme would occur about 3% of the time. The American Statistical Association cautions that a p-value alone does not measure effect size, practical importance or the probability that Hâ‚€ is true.3

For most classroom and professional reports, pair the calculator result with the question you are answering. A mean or median summarizes location, but spread explains consistency. A confidence interval estimates plausible values, while a hypothesis test evaluates compatibility with a null model. Regression and correlation describe association, so they should be reported with a chart and residual or outlier review. When a result is statistically significant, still ask whether the effect is large enough to matter in the real setting.

StatisticSmallMediumLargeUse
Cohen's d0.20.50.8t-test effect size
Cramér's V0.10.30.5chi-square association
|r|0.100.300.50correlation strength
R²0.010.090.25variance explained

Pro Tips and Common Pitfalls

Sample Size Calculator FAQ

How do I calculate sample size for a survey?

For a proportion, the standard formula is n = z²p(1 − p)/E², where z is the critical value for your confidence level, p is your expected proportion (use 0.5 if you have no estimate), and E is your target margin of error. At 95% confidence with p = 0.5 and E = 0.05, n ≈ 385. If your population is small (say under 10,000), apply the finite population correction to reduce n. For continuous outcomes (like average income), use n = z²σ²/E² and supply a rough σ from prior data or a pilot.

What sample size do I need for 95% confidence and 5% margin of error?

The classic answer: 385. Plug in z = 1.96, p = 0.5 (worst-case variability), E = 0.05 into n = z²p(1 − p)/E²: n = (1.96² × 0.25)/0.0025 = 0.9604/0.0025 ≈ 384.16, rounded up to 385. This assumes a large population. If your actual proportion is far from 0.5 — say 0.2 or 0.8 — you'd need fewer respondents. And if your population is finite (a school of 800, for example), the finite population correction can pull n down meaningfully. But 385 is the universal go-to.

How does population size affect sample size?

For very large populations, sample size depends almost entirely on confidence level, margin of error, and variability — not the population total. That's why the same n ≈ 385 works for surveying a city of 100,000 or a country of 100 million at the same precision. For smaller, finite populations (under about 10,000), the finite population correction (FPC) kicks in and reduces the required n. Example: with N = 500, the corrected sample size for a 5% MOE drops from 385 to about 217. Bigger relative samples need this adjustment.

Why is 385 a common sample size?

It comes straight from the formula at the most common settings: 95% confidence (z = 1.96), worst-case proportion p = 0.5, and 5% margin of error. Plug those in: n = 1.96² × 0.5 × 0.5 / 0.05² = 384.16, which rounds up to 385. Choosing p = 0.5 maximises the product p(1 − p) = 0.25, giving the largest possible n — a conservative, safe choice when you have no prior estimate. That's why pollsters and survey designers default to roughly 400 respondents for nationwide studies.

How do I calculate sample size for a proportion?

Use n = z²p(1 − p)/E². Choose z based on confidence (1.96 for 95%, 2.576 for 99%), pick p (set 0.5 if uncertain), and set E to your acceptable MOE. At 95% confidence, p = 0.3, and E = 0.04: n = 1.96² × 0.3 × 0.7 / 0.04² = 504.21, round up to 505. For finite populations, multiply by the FPC: n_corrected = n / (1 + (n − 1)/N). Always round up — partial respondents don't exist, and rounding down would leave you short of your precision target.

How do I calculate sample size for a mean?

The formula for a mean is n = (zσ/E)², where z is the critical value, σ is the population standard deviation (or your best estimate), and E is the margin of error in the same units as your data. Example: estimating average household income within ±₹500 at 95% confidence, with σ ≈ ₹5,000: n = (1.96 × 5000 / 500)² = (19.6)² = 384.16, round up to 385. The tricky part is getting σ — pull it from a pilot study, prior research, or a reasonable rule-of-thumb estimate.

What confidence level should I use for sample size?

The most common choice is 95%, balancing precision with sample-size cost. Use 90% when budget is tight and a slightly higher chance of error is acceptable — say in early-stage market research. Use 99% for high-stakes contexts like medical studies, safety testing, or any decision where being wrong is costly. The trade-off: jumping from 95% to 99% confidence raises required sample size by about 70% for the same MOE. Match the level to the consequences of error, not just convention.

What margin of error should I use for sample size?

Match the MOE to how precise you actually need to be. ±5% is the standard for general public-opinion surveys — moderate cost and adequate precision. ±3% suits political polling close to elections, where small differences sway interpretation. ±10% can work for early exploratory research or pilot studies where rough numbers are fine. Halving the MOE roughly quadruples the required sample, so don't ask for more precision than your decisions actually require. Tight MOE on questions you don't need precise answers to is just wasted budget.

Sample Size Calculator Glossary

Sample size
The number of observations needed for a target precision.
Margin of error
The maximum planned sampling error.
Finite population correction
Adjustment used when sampling from a known finite population.
Planning value
A prior estimate such as p=0.5 or a pilot standard deviation.
Confidence level
The desired coverage level used to choose z*.
Round up
Sample size formulas are rounded upward to ensure enough observations.

References and Sources

  1. NIST/SEMATECH e-Handbook of Statistical Methods, descriptive statistics, uncertainty and modeling formulas.
  2. OpenStax Introductory Statistics, definitions for inference, probability and summary statistics.
  3. ASA Statement on p-values, Wasserstein and Lazar, 2016.
  4. R stats package documentation, t.test, cor, quantile and distribution conventions.