How this calculator works
- Step 1ConfidencezThe normal critical value for your confidence level.
- Step 2Variabilityp (1 − p)Largest at 50%, the safe default.
- Step 3Sample sizez² p(1 − p) ÷ E²Rounded up to a whole person.
The sample size is how many completed responses you need so a survey percentage lands within your margin of error, at your chosen confidence.
The calculator works out the critical value z exactly for any confidence level, so you are not limited to the usual 90%, 95% and 99%.
Worked example: OpenStax Example 8.14
- Sample size
n = z² p (1 − p) ÷ E²
- zCritical value at 90% 1.644854
- pExpected proportion 0.5
- EMargin of error 0.03
- z²1.644854²2.705543
- Before rounding2.705543 × 0.25 ÷ 0.0009751.539848
- Sample sizeround up752 people
OpenStax rounds z to 1.645 and gets 751.7; both round up to the book’s answer of 752 people.
How the choices change the size
Read the result
The answer counts completed responses. If only half of those you ask reply, invite about twice as many.
Expecting a lopsided result needs fewer people: at 20% rather than 50%, the 95%, ±5-point survey needs 246.
Assumptions and limits
- Random sampleEveryone has an equal chance of selection.
- Large populationNo finite-population correction is applied.
- A proportionFor percentages, not averages of measurements.
- Not biasA bigger sample cannot fix a biased question or list.
Related statistics tools
Sample size and margin of error are two sides of the same survey question.
Once you have results, the confidence interval calculator gives the margin of error for a mean or proportion. The z-score calculator explains the critical values behind each confidence level.
Common mistakes
Mistake: Entering the margin as 0.05.
Instead: Enter percentage points: 5 for ±5%.
Mistake: Rounding the answer down.
Instead: Always round up, or the margin is wider than asked.
Mistake: Ignoring non-responses.
Instead: Invite more people so enough complete the survey.
Checking the method
Every golden case is re-worked with Python's NormalDist, and OpenStax Example 8.14 is reproduced.
An independent script finds z with a different algorithm (Wichura’s AS241) and checks each size and the published answer of 752.
Read how we test our calculators, or browse more maths calculators.