Sample Size for a Mean Calculator

StatisticsLast updated: August 22, 2026

When a study aims to estimate a mean rather than a proportion — average income, average blood pressure, average duration, average score — the sample size is computed with the formula for estimating a mean, not with Cochran's formula for proportions. The logic is simple: you find how many observations are needed so that the half-width of the confidence interval (the margin of error E) does not exceed the limit you set.

From the confidence level, the margin of error you accept, and the standard deviation of the variable (σ), this calculator computes the required sample with n = (z·σ/E)²; it applies the finite population correction when the population is limited, adds an allowance for data loss, and works back from the rounded sample size to the margin of error you will actually achieve. A table and a line chart show the inverse-square relationship between the margin of error and the sample size: halving the margin of error quadruples the sample.

The probability that the confidence interval around the estimated mean covers the true mean.
Written in the unit of measurement: points, mmHg, dollars, minutes. It is the half-width of the confidence interval.
Taken from a pilot study, from previous research, or from a rough estimate (range / 4).
Enter N for limited populations such as a school, a hospital, or an institution; leave it empty for a general population.
%
A reserve added for missing, invalid, or unreachable observations.

Sample Size for Estimating a Mean

n₀ = ( z · σ / E )²
Finite population correction:  n = n₀ / ( 1 + (n₀ − 1) / N )
z: critical value for the confidence level (90% → 1.645; 95% → 1.960; 99% → 2.576)
σ: population standard deviation, E: accepted margin of error (half-width)
Achieved margin of error:  E = z · σ / √n   (in a limited population × √((N − n)/(N − 1)))
Confidence interval:  x̄ ± z · σ / √n
Target with allowance:  n_target = ⌈ n · (1 + attrition rate) ⌉

The formula rests on the assumptions that x̄ is normally distributed (the central limit theorem) and that σ is known. If the sample standard deviation s is used instead of σ, an iterative solution with t₍df₎ rather than z is theoretically more correct; for n ≥ 30 the difference is negligible.

How to Calculate

  1. Choose the confidence level: 95% is common in the social sciences, 99% in clinical decisions.
  2. Write the margin of error (E) you will accept in the unit of the variable itself — for example 2 points on an exam score, or 3 mmHg for blood pressure.
  3. Enter the standard deviation (σ): a pilot study, the literature, or the rough range / 4 rule can all be used.
  4. If the population is limited (a school, a hospital, an institution), enter N; leave it empty for general population studies.
  5. Set the attrition allowance; 10% is common in surveys and 20% in long follow-up studies.
  6. When reading the result, check both the required n and the margin of error actually achieved with that n; compare alternative scenarios in the table and the chart.

Worked Examples

Mean exam score (95% confidence, ±2 points)

On an exam with a standard deviation of 10 points, estimating the mean with a ±2-point margin of error gives n₀ = (1.9600 · 10 / 2)² = 96.04; rounded up, 97 students are required. With this sample the actual margin of error is ±1.9900, and with a 10% attrition allowance the target is 107 students.

Required minimum sample size (n): 97 · Infinite-population sample size (n₀): 96.04 · z critical value: 1.9600

Finite population correction in an institution of 500

In the same scenario, if the population is limited to 500 people the correction gives n = 96.04 / (1 + 95.04/500) = 80.70; the n₀ = 96.04 needed for an infinite population therefore drops to 81 observations. With 81 observations, and once the finite population factor is taken into account, the achieved margin of error is ±1.9955, which stays below the target; with a 10% attrition allowance, a target of 90 people is enough.

Required minimum sample size (n): 81 · Infinite-population sample size (n₀): 96.04 · z critical value: 1.9600

Precise clinical measurement (99% confidence, ±1 unit)

For a clinical measurement with σ = 8, requiring a ±1-unit margin of error at 99% confidence gives n₀ = (2.5758 · 8 / 1)² = 424.63, so 425 patients are needed. With a 15% attrition allowance the target should be 489 patients; raising the margin of error to 2 units would cut the required sample to 107.

Required minimum sample size (n): 425 · Infinite-population sample size (n₀): 424.63 · z critical value: 2.5758

Frequently Asked Questions

What is the difference between this calculator and the sample size calculator for a proportion?
The proportion formula (Cochran) is for estimating the percentage of a yes/no characteristic and models the variance as p(1−p). This calculator is for estimating the mean of a continuous variable and uses σ² directly instead. If what you measure is a percentage, use the proportion calculator; if it is a mean, use this one.
I do not know the standard deviation — what should I do?
There are three common solutions: take σ from earlier studies that used the same scale, run a pilot study with 20–30 people and compute s, or use the rough rule σ ≈ range / 4 based on the largest and smallest values you expect. Because underestimating σ leads to an insufficient sample, it is safer to be cautious and estimate a little on the high side.
How much does the sample grow if I halve the margin of error?
Because E appears squared in the denominator, the sample grows roughly fourfold. With σ = 10, a margin of error of ±4 units needs 25 observations while ±2 units needs 97; because of rounding up, the ratio is not exactly 4 but very close to it. This quadratic relationship explains why increasing precision gets expensive so quickly.
When should I apply the finite population correction?
The correction makes a meaningful difference once the sample exceeds roughly 5% of the population. In an institution of 500 people, a sample of 97 corresponds to about a fifth of the population, so the correction lowers the required number to 81. If the population is above 10,000, the effect of the correction is negligible in practice.
Shouldn't I use t instead of z?
Theoretically, if σ is unknown and estimated by s, the t distribution is the correct choice; but because the degrees of freedom of t depend on n, the computation becomes iterative. In practice one starts with z and, if n comes out small (roughly n < 30), applies one round of correction with t. Once n ≥ 30, the difference between the two approaches is no more than an observation or two.
How do I get the same result in SPSS or Excel?
In Excel, the formula n = (NORM.S.INV(1−α/2) * σ / E)^2 gives the same result; you then need CEILING to round up. The base version of SPSS has no sample size module; SPSS SamplePower, G*Power, or the R packages 'presize' and 'samplingbook' apply the same formula and produce the same number.
What happens if I cannot reach the computed number?
As the sample shrinks, the confidence interval widens, meaning you estimate the mean with less precision. You are expected to compute the margin of error you will actually achieve with the n you have, using E = z·σ/√n, and to report it clearly in the methods and limitations sections; falling short of the target does not invalidate the study, but the loss of precision must be disclosed.