Statistics

Sample Size Calculator

The planning question, solved backwards: how many observations does a margin of E cost? The algebra runs forward once and the ceiling does the rest — for a proportion and for a mean, with the worst case named.

Sample Size Calculator

Results recalculate instantly on every keystroke. Nothing you type is transmitted.

Target
n for a proportion
—
The algebra, with your numbers—
n for a mean (σ known)—
The worst case, priced—
What half the margin costs—
Planning doctrine—

What this result does not account for

  • Large-population answer — no finite-population correction
  • One-sample estimation; two-variant comparison needs the A/B page (in build)
● Zero-Server Execution Updated 11 Aug 2026 Reviewed by Sana Khalid IEEE-754 Double Precision

In short: To land within ±3 percentage points at 95% confidence, n = z*²p(1−p)/E² = 1.959964² × 0.25 / 0.0009 = 1,067.071895, and since a fraction of a respondent buys no margin, the answer is 1,068 — rounded UP, always up. Planning with p = 0.5 is the safe worst case: 0.5×0.5 = 0.25 is the largest p(1−p) can be, so 897 would do if you knew p̂ sits near 0.3. For a mean with σ = 5 and a ±3-unit target the bill is (1.959964×5/3)² = 10.670719 → 11. Precision is bought in whole observations, priced by the square.

Formula

n = z*² p(1−p) / E² · n = (z* σ / E)²

Solved algebraically from the margin formula, then rounded up: a fraction of an observation buys nothing.

Worked Example

  1. Type the confidence level and the margin you need.
  2. Give a planning proportion — 0.5 when unsure.
  3. Give σ to price the mean flavour on the same E.
  4. Read n, the raw algebra, and what half the margin would cost.

95%, E = 3 pp, p = 0.5: raw 1,067.071895 → 1,068. At p = 0.3 the same target needs 897. Halve E to 1.5 pp and the bill quadruples to 4,269. Mean flavour, σ = 5, E = 3: 11.

Strengths & Limits Of This Model

Where this engine is strong

  • Ceiling applied and shown, not hidden
  • Worst-case p = 0.5 priced beside your planning value

Where it stops

  • No stratification or clustering design effects
  • No power-based sizing for hypothesis tests

Risk & accuracy notice. An n sized for a margin is not an n sized for a difference. Planning a comparison with an estimation formula undercounts — the A/B page owns that question and this page says so rather than blur it.

Practical Use Cases

Survey design

respondents per ±3 pp of margin

Experiment planning

the n a ±unit promise costs

Budget defence

precision priced before fieldwork, not after

Methodology & Editorial Standards

Computation runs in IEEE-754 double precision at full internal precision; rounding to two decimal places occurs strictly at the display layer, so no cumulative drift enters the result. All monetary outputs use accounting presentation — grouped thousands, two decimals, negatives in parentheses — so figures can be transcribed directly into a model or working paper. Division-by-zero and out-of-domain inputs return an em-dash rather than a misleading number.

This engine was reconciled against an independent reference implementation and hand-verified for the worked example above before release. Our full five-stage review process is published on the About Us page.

Sana Khalid Principal Front-End Engineer · ApexConverter

Statistical inference, experiment design and numerical stability. Last reviewed: 11 August 2026.

Disclaimer. This calculator is provided for informational and modelling purposes only and does not constitute financial, tax, legal, medical, or engineering advice. Verify all figures with a qualified professional before acting on them.


Sample Size Calculator — 8 Expert FAQs

8 analyst-written answers to the questions practitioners actually ask — optimised for voice and answer-engine retrieval.

Why is the answer always rounded UP?

Because the margin is a promise: n = 1,067.07 delivers slightly worse than ±3 pp, and nobody contracts for the 0.07. The ceiling is part of the algebra, not a rounding habit — every unfractional respondent short of the promise leaves the promise broken.

Why plan on p = 0.5 when I expect 30%?

Because the plan must survive the data. p(1−p) peaks at 0.25 when p = 0.5 and falls to 0.21 at p = 0.3, so planning at 0.5 buys insurance against the estimate landing further from your guess than you expected. If the guess is solid, type it — the worst-case card shows what the insurance cost.

Is this the same n an A/B test needs?

No — and the difference matters. This page sizes a one-sample ESTIMATE (how wrong can a single proportion be). Comparing TWO variants against each other is a different computation with a different owner: the A/B test page (in build) carries it, and its n is bigger because detecting a difference is harder than describing one proportion.

Does a big population change the n?

Only when the population is small enough that sampling without replacement matters — the finite-population correction, which shrinks n when the sample is a noticeable slice of the whole. This page quotes the standard large-population answer and says so.

What happens to n at 99% confidence?

z* grows from 1.959964 to 2.575829, and since n carries z*², the bill grows by (2.575829/1.959964)² ≈ 1.728 — seventy-three percent more respondents for the same margin. Confidence is bought with n.

Why does the mean flavour use raw units?

Because a mean lives in the data’s units. The same E = 3 that means three percentage points for a proportion means three whole units for a mean measured in that unit — the card labels which is which so the two are never silently confused.

Why does the margin barely move for every candidate in a poll?

Because the simple-random-sample margin depends only on n and the proportion — not on who is being asked. Real polls with clustering or stratification carry a design effect that widens the honest margin; this page quotes the simple-random answer and names the boundary.

What if the budget only covers 400?

Then the margin is the output, not the input: carry the 400 to the margin-of-error page and quote what it honestly buys. Planning runs both directions — the failure is reporting the margin you wanted beside an n that cannot price it.

Related Statistics Engines