Sample size (survey / A-B test) calculator
How many samples you need for a given margin of error. Enter your values and see the formula, your numbers plugged in and every step of the working. Free, no sign-up, SI and imperial units.
Formula
n = z² · p · (1 − p) / E²
Inputs
- Confidence level (z)
- Margin of error (E), in % or other units
- Expected proportion (50 % if unknown) (p), in % or other units
Worked example: 95 % confidence, ±5 %, unknown proportion
- Confidence level z = 95 % (z = 1.96)
- Margin of error E = 5 %
- Expected proportion (50 % if unknown) p = 50 %
- Convert inputs to SI units: E = 5 % = 0.05 ; p = 50 % = 0.5
- n = 1.96² × 0.5 × 0.5 ÷ 0.05² = 0.9604 ÷ 0.0025 = 384.16
- Round up: n = 385
- Assumes simple random sampling from a large population.
Answer: Required sample size n = 385
More data engineering calculators
- Data transfer time: How long it takes to move data over a network link.
- Storage estimate: Plan storage from row count, row size, retention, replication and compression.
- Event throughput: Bandwidth and daily volume of a streaming data pipeline.
- Unix timestamp converter: Convert a Unix timestamp to a UTC date and time.
Data Engineering formula sheet · All calculators · Practice problems