Analyze · Power & Corrections

Sample Size for a Margin of Error

How many observations are needed to estimate one percentage or one mean to within a chosen margin of error (for example ±5 percentage points) at a chosen confidence level.

In the menus Analyze › Power & Corrections › Sample Size for a Margin of Error

Also searched as margin of error sample size for a survey survey sample size how many people should i ask how many people do i need sample size for a proportion sample size for a percentage sample size for a mean

When to use it

You are planning a survey or a study whose goal is an estimate (a percentage, an average) with a known precision, and want to know how many people or items to measure.

When not to: When the goal is to detect a difference between groups or from a target with a given power (use Power & Sample Size), or for complex sample designs without a design effect.

Step by step

  1. Open it from the menu

    Click Analyze in the menu bar; under Power & Corrections choose Sample Size for a Margin of Error.

  2. Fill in the form

    Fill in How close the estimate should be (±) (optional), Your best guess of the percentage (50 if unsure) (optional), Spread of the measurement (for a mean) (optional), Size of the whole population (if small) (optional).

  3. Check the options

    The options start at their defaults: What to estimate, Confidence level. Change one only when your question needs it.

  4. Run the analysis

    Press Run analysis. The Result Card opens on its Results tab.

What to choose in the form

Fields of the Sample Size for a Margin of Error form
How close the estimate should be (±) Margin optionalA value you type or choose on the form. How close the estimate should be: percentage points for a percentage (5 means ±5 points), the data's units for a mean.
Your best guess of the percentage (50 if unsure) Expected Pct optionalA value you type or choose on the form. For a percentage: your best guess of the answer. Keep 50 if unknown; it is the cautious choice and needs the most people.
Spread of the measurement (for a mean) Sd optionalA value you type or choose on the form. For a mean: the spread of the measurement, from a small trial run, an earlier study or a best guess (the range of likely values divided by 4).
Size of the whole population (if small) Population optionalA value you type or choose on the form. Only if the whole population is small and known (for example 2,000 employees); leave empty for a large or unknown population.
What to estimateA percentage (a proportion, such as the share who agree) or a mean (an average, such as the mean weight) Default: A percentage.
Confidence levelHow often intervals built this way contain the true value; 0.95 is the usual choice Default: 0.95.

How to read the card

The Results tab starts with what to know first (rows left out, checks that did not pass), then the interpretation in words and the Key Results; charts and assumption checks follow further down. Learn More explains the method in plain words. Read a Result Card covers all four tabs.

A worked example

Estimate a percentage within ±5 points at 95% confidence, no idea of the answer (50%).

Result: n0 = 1.96² × 0.25 / 0.05² = 384.15, rounded up to 385; ±3 points needs 1,068; from a population of 2,000, 323.

Ask about 385 people (more to allow for non-response) to estimate the percentage to within ±5 points with 95% confidence.

From the Statistics Library.

The code tabs

Code gives this analysis as Python, R and MATLAB code (and SAS where the tab offers it), reading the data the way KernelStats did. Export sends the card to a report or to slides. See The Code tab.

Understand the statistics

Ask Oobi

Type one of these into Ask Oobi beside your data:

  • How many people should I ask to estimate a percentage to within ±5 points with 95% confidence?
  • Explain the sample size for a margin of error in plain words.

Last reviewed November 16, 2026.

Report an unclear step