Sample Size Calculator tool

Sample Size Calculator

Before you run a voter poll, customer survey, or factory measurement batch, you need to know how many responses will be enough.

What is a sample size calculator?

A sample size calculator estimates how many responses or measurements you need before collecting data. Pick proportion mode for yes/no surveys or mean mode for numeric averages, set confidence level and margin of error, and read the required n rounded up. Proportion mode uses p = 50% when you are unsure, which gives the safest (largest) sample.

How to use the Sample Size Calculator

  1. Choose proportion or mean estimation mode.
  2. Select 90%, 95%, or 99% confidence.
  3. Enter margin of error (percent for proportions).
  4. For proportions, set expected yes-rate or leave 50%.
  5. For means, enter expected SD and error in data units.

About this calculator

Before you run a voter poll, customer survey, or factory measurement batch, you need to know how many responses will be enough. Too few and your margin of error is wide; too many wastes time and money.

This calculator supports two common setups. For proportions (yes/no, approve/disapprove, defect rate), enter the confidence level, margin of error as a percentage, and expected proportion. If you do not know the proportion, leave it at 50% — that is the conservative choice used by most election survey planners in India.

For means (average weight, voltage, exam score), switch to mean mode and enter the margin of error in the same units as your measurement plus the standard deviation from a pilot run. The formula returns the minimum n, always rounded up to a whole number.

Example: 95% confidence, ±5% margin, p = 50% needs about 385 responses. For means with σ = 10 and e = 2 at 95%, you need 97 observations.

Use with the [[confidence-interval]] calculator after you collect data, the [[probability]] calculator for event odds, and [[mean-median-mode]] to estimate σ from a pilot sample.

How the math works

n=z2 p(1−p)e2n = \frac{z^2 \, p(1-p)}{e^2}
  • nn: Required sample size (rounded up)
  • zz: Critical z for confidence level
  • pp: Expected proportion (0 to 1)
  • ee: Margin of error

Worked examples

95% confidence, ±5%, p = 50%

n = 1.96² × 0.25 / 0.05² ≈ 385 responses.

This is the standard pre-election survey size in India for state-level polls at ±5%.

Mean mode — factory weight

SD = 10 grams, margin ±2 grams, 95% confidence.

n = (1.96 × 10 / 2)² = 97 observations.

Run 20–30 trial units first if you don't have historical SD.

Common uses

  • Plan voter or market survey sample size before fieldwork
  • Size a factory QC batch to estimate average weight within ±2 grams
  • Decide how many A/B test users you need for a conversion estimate
  • Budget interview counts for academic research proposals
  • Check whether an existing dataset is large enough for a target margin

Frequently asked questions

How many people do I need for a survey with 95% confidence and 5% margin?

With unknown proportion, use p = 50%. The formula gives n ≈ 385. If you already expect about 30% yes responses, the required n drops to roughly 323.

Why use 50% for expected proportion when I do not know it?

p(1−p) is largest at p = 0.5, so the sample size you get is the worst-case (safest) number. You will not undershoot if the true proportion differs.

What margin of error should I pick for an election poll?

National polls often target ±3% at 95% confidence, which needs about 1,067 responses with p = 50%. State-level polls with ±5% need around 385.

How do I get standard deviation for the mean sample size formula?

Run a small pilot — 20 to 30 measurements — and compute SD from those values. You can paste them into the [[mean-median-mode]] calculator if needed.

Does sample size change with 99% vs 95% confidence?

Yes. Higher confidence uses a larger z, which increases n. Moving from 95% to 99% typically adds 50–70% more responses for the same margin of error.

Deep dive

Why p = 50% when unknown

Worst-case sample size is safest.

Confidence vs margin of error

Two knobs that both increase n.

Related calculators

Maintained by J Jaya Prakash · Last updated: October 2026