Statistics calculator

Sample Size Calculator

Estimate a planning sample size from confidence level, target margin and expected variability, then round up.

Last reviewed: August 6, 2026Statistics calculation engine v2.0.0

Sample Size Calculator

Estimate a planning sample size from confidence level, target margin and expected variability, then round up.

local statistics model
Estimate a proportion inputs

Plan from expected p and target decimal margin.

Result and visual stay hidden until you choose Calculate. This prevents a fake default result from appearing on the page.

Formula and assumptions

Primary formula

Proportion n=z^2 p(1-p)/E^2. Mean n=(z sigma/E)^2. Optional finite-population correction n/[1+(n-1)/N].

Input assumptions

The formula matches simple random-sampling precision planning. The variability estimate is reasonable. Finite-population correction is used only for a known finite population.

Precision note

Statistics calculations use Decimal.js for deterministic arithmetic; displayed values are rounded only after the selected method is evaluated.

How NexaCalc evaluates the inputs

Parse

Finite numeric observations and method-specific inputs are validated locally.

Calculate

The selected Statistics method runs in a pure TypeScript engine.

Explain

The result includes substitutions, ordered data, supporting measures and method warnings.

Visualize

A tool-specific dataset visual appears only after a valid calculation.

What the Sample Size Calculator does

Use this Statistics page for initial precision planning before collecting a simple random sample.

Sample Size Calculator processes the entered values locally and exposes the selected convention, calculation steps and related values.

When to use the Sample Size Calculator

Use this Statistics page for initial precision planning before collecting a simple random sample.

Choose the mode that matches the data available and the question being answered before entering values.

Formula, variables and units

Proportion n=z^2 p(1-p)/E^2. Mean n=(z sigma/E)^2. Optional finite-population correction n/[1+(n-1)/N].

  • z is the confidence critical value.
  • E is the target margin in the parameter's units.
  • p or sigma supplies expected variability and N is optional population size.

Statistical assumptions

The calculation is deterministic, but interpretation depends on whether the selected model and entered data fit the real situation.

  • The formula matches simple random-sampling precision planning.
  • The variability estimate is reasonable.
  • Finite-population correction is used only for a known finite population.

Step-by-step worked example

Use the default example inputs to reproduce the primary worked example. The result breakdown is produced by the same pure TypeScript engine used by the page.

  • At 95%, p=0.5 and E=0.05, initial n is about 384.15 and rounds to 385.
  • For sigma=10 and E=2, initial n is about 96.04 and rounds to 97.
  • Applying N=1000 to about 384.16 gives about 277.7 and rounds to 278.

Additional examples and interpretation

The following examples show how data, event structure, count or method changes the result.

  • At 95%, p=0.5 and E=0.05, initial n is about 384.15 and rounds to 385.
  • For sigma=10 and E=2, initial n is about 96.04 and rounds to 97.
  • Applying N=1000 to about 384.16 gives about 277.7 and rounds to 278.

Concept explanation

Sample-size planning balances desired precision against variability. Higher confidence or tighter margins increase the required count.

The finite-population correction reduces the count when sampling without replacement from a population that is not much larger than the sample.

How to read the statistics visual

The dynamic visual is a population feeding a selected sample with confidence and margin controls. It appears only after a valid calculation and uses the current result.

Visual proportions are normalized for readability and are explanatory rather than a substitute for a full statistical plot.

Common mistakes

Check dataset parsing, method choice and denominator before using a result.

  • Entering five percent as 5 instead of 0.05.
  • Rounding the required sample down.
  • Treating precision size as a guarantee of representativeness or statistical power.

Limitations and method-choice notes

Statistical conventions and model assumptions can change a result or its interpretation.

  • Design effects, nonresponse, clustering, subgroup goals and power may require larger samples.
  • A calculated size does not make a biased sample representative.

Educational and privacy note

This calculator provides educational statistics calculations and does not replace statistical consulting, instructor guidance or professional analysis.

Input values are processed in the browser calculator session and are not sent to an external statistics service.

Frequently asked questions

What does the Sample Size Calculator calculate?

It returns an unrounded planning estimate and the required whole-number sample rounded up.

What inputs does the Sample Size Calculator require?

confidence level, target margin and either expected proportion or standard deviation, plus optional population size

Which formula does the Sample Size Calculator use?

n=z^2p(1-p)/E^2 or n=(z sigma/E)^2 with optional finite-population correction

How should I interpret the Sample Size Calculator result?

It returns an unrounded planning estimate and the required whole-number sample rounded up. Interpret it only under the assumptions stated on the page.

What assumptions are important for the Sample Size Calculator?

The result addresses simple precision only; power, design effects, nonresponse and subgroup analyses need separate planning.

What common mistake should I avoid in the Sample Size Calculator?

Select the mode that matches the question, keep units or probabilities consistent and do not treat a model output as stronger evidence than the inputs support.

How does the Sample Size Calculator differ from the Margin of Error Calculator?

The tools answer related but different questions. The Sample Size Calculator follows n=z^2p(1-p)/E^2 or n=(z sigma/E)^2 with optional finite-population correction, while the Margin of Error Calculator reports its own named quantity or model.

Can I use decimal values in the Sample Size Calculator?

Yes where the selected model permits them. Whole-number count fields reject decimals, while measurements, probabilities and dataset values accept finite decimals.

Does the Sample Size Calculator prove a statistical conclusion?

No. It performs a deterministic calculation; study design, data quality and subject-matter interpretation remain separate.

How does the Sample Size Calculator visual help?

The visual uses the current inputs and result to show the model structure, selected region or interval. It appears only after a valid calculation.

Why might another Sample Size Calculator return a different value?

Different conventions, critical values, rounding rules or event assumptions can change results. NexaCalc labels the selected method and rounds only for display.

What are the main limitations of the Sample Size Calculator?

The result addresses simple precision only; power, design effects, nonresponse and subgroup analyses need separate planning.

References

  • OpenStax Introductory Statistics 2e, Measures of the Center of the Data. Relevance: mean, median and mode. Last verified: August 5, 2026. Source.
  • OpenStax Introductory Statistics 2e, Measures of the Spread of the Data. Relevance: range, variance and standard deviation. Last verified: August 5, 2026. Source.
  • NIST/SEMATECH e-Handbook, Measures of Scale. Relevance: statistical spread and scale measures. Last verified: August 5, 2026. Source.
  • NIST/SEMATECH e-Handbook, Percentiles. Relevance: ordered data, ranks and percentile-method differences. Last verified: August 5, 2026. Source.
  • OpenStax Introductory Statistics 2e, Two Basic Rules of Probability. Relevance: conditional, multiplication and addition rules. Last verified: August 6, 2026. Source.
  • OpenStax Introductory Statistics 2e, Poisson Distribution. Relevance: discrete event-count probability models. Last verified: August 6, 2026. Source.
  • OpenStax Introductory Statistics 2e, Confidence Intervals chapter review. Relevance: interval estimation, margin of error and sample size. Last verified: August 6, 2026. Source.

Statistics methods and references reviewed on August 6, 2026.

Educational disclaimer

This calculator provides mathematical results from the values, conventions and methods you enter. Verify important academic, engineering or professional work independently.