ProMathTools
ProMathTools

Sample Size Calculator – Surveys & Margin of Error

Find how many survey responses you need from confidence level, margin of error, and optional population size — or reverse the formula to get the margin from a given n.

e.g. 5 for ±5%

Default 50% (most conservative)

Leave blank for infinite / very large population

How sample size is calculated

Survey planners pick a confidence level (often 95%), a margin of error (for example ±5%), and an assumed response proportion p. The classic Cochran formula for an infinite population is n₀ = z² p (1 − p) / E², where z comes from the standard normal at your confidence level and E is the margin as a proportion. When the population N is known and not huge, apply the finite population correction n = n₀ / (1 + (n₀ − 1)/N). Required n is always rounded up so you meet the target precision. For estimating a mean instead of a proportion, use n = (z · σ / E)² with a planning value of the standard deviation σ and a margin E in the same units.

Required Inputs & Typical Use Cases

Use proportion mode for polls, NPS-style yes/no questions, conversion rates, and classroom sampling problems. Use mean mode when you care about an average (test scores, weights, wait times) and already have a ballpark σ. Use reverse mode after fieldwork to report the achieved margin of error for a completed sample of size n, with or without a finite N.


The Formula

Proportion (infinite): n₀ = z² · p · (1 − p) / E²
Finite correction: n = n₀ / (1 + (n₀ − 1)/N)
Mean: n = (z · σ / E)²
Reverse margin: E = z √(p(1−p)/n)  [× √((N−n)/(N−1)) if N known]
  • z

    Normal critical value for the confidence level

  • E

    Margin of error (proportion or same units as the mean)

  • p

    Expected population proportion (use 0.5 if unknown)

  • N

    Finite population size (optional)

  • n₀

    Sample size before finite population correction

  • σ

    Planning standard deviation for a mean


Worked Example

  1. 95%, ±5%, p = 50%

    z ≈ 1.96, E = 0.05, p = 0.5 → n₀ ≈ 384.16 → round up to n = 385. With N = 1,000, the finite correction gives n = 278.

  2. Mean: σ = 15, E = 3, 95%

    n = (z · 15 / 3)² ≈ (1.96 · 5)² ≈ 96.04 → round up to n = 97.

  3. Reverse: n = 385 at 95%, p = 50%

    E ≈ 0.05, so the margin of error is about ±5% — matching the planning inputs that produced n = 385.


Tips, Assumptions & Limitations

  • Default to p = 50% when you do not know the expected split; it maximizes required n.
  • Leave population N blank for large or unknown populations; fill it in for small closed groups.
  • Margin of error in proportion mode is a percent (5 means ±5%), not a raw proportion.
  • Always round sample size up — partial respondents are not possible.
  • Common mistake: treating a 95% confidence level as a 95% chance that this one sample “got it right.”
  • Common mistake: using a tiny planning p without realizing it understates the sample you may need if the true share is nearer 50%.

With the conservative proportion p = 0.5 (50%), a 95% confidence level and a 5% margin of error, the infinite-population formula gives n = 385. If your population is finite (for example N = 1,000), apply the finite population correction and you need about 278 responses.

In the proportion formula, the product p(1 − p) is maximized when p = 0.5. Using 50% therefore plans for the worst-case variability and is the usual default when you do not yet know the expected response share.

Use it when you are sampling without replacement from a known, relatively small population N (often when the planned n is more than about 5% of N). The correction shrinks n₀ to n = n₀ / (1 + (n₀ − 1)/N). Leave N blank for a large or unknown population.

For a mean you need an estimate of the population standard deviation σ and a margin of error E in the same units as the mean. Then n = (z · σ / E)², rounded up. There is no percent-based p term as in the survey proportion formula.

Reverse mode takes a planned or achieved sample size n (and optional population N), confidence level, and assumed proportion p, then returns the margin of error. It answers “how precise is this sample?” rather than “how large must the sample be?”

Sample size must be a whole number of respondents, and rounding down would understate the precision you requested. The calculator always applies Math.ceil so the reported n meets or exceeds the target margin at the chosen confidence level.

Related Calculators

Confidence Interval CalculatorZ-Score CalculatorT-Test CalculatorStandard Deviation CalculatorCorrelation Coefficient CalculatorLinear Regression CalculatorCovariance CalculatorMeanMedian ModeVarianceNormal Distribution
About UsBlogChrome ExtensionFAQsTerms and ConditionsPrivacy PolicySitemap
EmailLinkedInFacebook

© 2025-2026 PromathTools. All rights reserved.

Built by KruskalCode – SaaS & Automation Experts · EverydayDevTools