Standard Deviation Formula Explained: Population vs Sample

TL;DR: There are two standard deviation formulas that differ in one place only: the population formula divides the squared deviations by n, while the sample formula divides by n − 1. The n − 1 version (Bessel’s correction) compensates for the fact that a sample usually understates the spread of the whole population. For the numbers 3, 5, 7, 9, 11, the population standard deviation is 2.83 and the sample standard deviation is 3.16.

Every guide to standard deviation shows a formula with a square root, a sum sign and a division — and then, confusingly, a second formula that looks almost identical except for one small change. The two versions are the population formula and the sample formula, and the difference between them is a single number in the denominator: n, or n − 1. This guide explains both formulas, why the difference exists, and how to choose between them, with both worked out on the same data set so you can see the effect directly.

If you want the answer without the arithmetic, our free Standard Deviation Calculator shows both versions side by side for any data set.

The population formula

Use the population formula when your data includes every member of the group you are describing — every student in a class, every product in a batch, every day in a month. The formula is:

σ = √[ Σ(x − μ)² / n ]

Reading it from the inside out: μ is the population mean, x is each individual value, so (x − μ) is how far each value sits from the mean. Squaring each difference makes it positive, Σ means add all the squares together, and dividing by n (the number of values) gives the variance. The square root turns that variance back into the original units, and the result is σ, the population standard deviation.

Because you have the whole population, there is nothing to estimate and nothing to correct for: the answer describes your data exactly. This is the version to use when you are summarising a complete group rather than guessing about a larger one.

The sample formula

Use the sample formula when your data is only a sample taken from a larger group — 50 voters surveyed out of a city of a million, 20 parts tested out of a production run of 10,000. The formula is:

s = √[ Σ(x − x̄)² / (n − 1) ]

It is the same calculation with two small changes: the mean is now the sample mean, written x̄ (x-bar), and the division is by n − 1 instead of n. The letter changes too — s instead of σ — to show that this is an estimate of the population's spread, not an exact description of it.

Population formulaSample formula
Symbolσ (sigma)s
Mean usedμ (population mean)x̄ (sample mean)
Divide bynn − 1
When to use itYou have every value in the groupYou have a sample of a larger group
ResultExact spread of your dataEstimate of the whole population’s spread

Why divide by n − 1? Bessel’s correction in plain words

The n − 1 in the sample formula is called Bessel’s correction, and it exists because samples are biased in a specific way: they understate spread. There are two reasons for that.

First, the most extreme values in a population are the least likely to end up in a small sample. A sample of 10 people from a city will probably not include the very tallest or the very shortest resident, so the sample looks more bunched up than the city really is. Second, the sample mean is calculated from the sample itself, so it sits as close as possible to the sample values — closer than the true population mean would. The deviations measured from the sample mean are therefore a little too small.

Dividing by a slightly smaller number (n − 1 instead of n) makes the result slightly larger, and that bump cancels out the understatement — on average, across many samples. Statisticians call the corrected version an unbiased estimate: not right every time, but right on average, rather than systematically too small. The idea is simple even if the proof is not: a sample is a slightly too-tidy picture of the population, so you widen it by a touch.

Worked example: both formulas on 3, 5, 7, 9, 11

Let us calculate both versions for the same five numbers: 3, 5, 7, 9, 11. The first three steps are identical for both formulas.

Step 1 — the mean. 3 + 5 + 7 + 9 + 11 = 35, and 35 / 5 = 7.

Step 2 — the squared deviations. Subtract 7 from each value and square the result: (3 − 7)² = 16, (5 − 7)² = 4, (7 − 7)² = 0, (9 − 7)² = 4, (11 − 7)² = 16.

Step 3 — add the squares. 16 + 4 + 0 + 4 + 16 = 40. This is where the two formulas part ways.

Population version: divide by n = 5. The variance is 40 / 5 = 8, and the standard deviation is √8 = 2.83.

Sample version: divide by n − 1 = 4. The variance is 40 / 4 = 10, and the standard deviation is √10 = 3.16.

The sample answer is larger, exactly as intended: 3.16 against 2.83, a difference of about 12%. The same data, the same steps — only the denominator changed. A step-by-step walkthrough of the same calculation is in the guide on how to calculate standard deviation.

How much does the choice matter?

The gap between the two formulas shrinks fast as the sample grows. The ratio between them is √[n / (n − 1)], which is 1.12 for n = 5, 1.03 for n = 20, and 1.005 for n = 100. So with 100 values the two answers differ by half a percent — barely worth worrying about — but with 5 values they differ by 12%, which is large enough to change a conclusion.

Sample size (n)Sample SD vs population SD
5about 12% larger
10about 5% larger
20about 3% larger
50about 1% larger
100about 0.5% larger

The practical rule is therefore simple: the choice matters most for small data sets, and that is exactly when you should be careful to pick the right one. For large samples, either version gives nearly the same number.

Which formula should you use?

Ask one question: is my data the whole group, or a sample of something bigger? Test scores for every student in one class are a population — use the n formula. Test scores from 30 students chosen out of a school of 1,000 are a sample — use the n − 1 formula.

In practice, most real-world data is a sample: surveys, experiments, measurements and polls almost always look at part of a group and draw conclusions about the whole. That is why the sample formula is the default in most statistics courses, and why spreadsheet functions come in two versions: STDEV.P for the population formula and STDEV.S for the sample formula. If a question does not say which to use, the sample version (n − 1) is usually the safer choice.

One final note: the same n versus n − 1 choice applies to sample size planning as well. A more spread-out population needs a larger sample to reach the same precision, which is one reason a rough tool like Slovin’s formula — which ignores spread entirely — should be treated as a starting point, not a final answer. And if you want to see the shape of your data before you summarise it, the dot plot maker draws each value as a dot on a number line, so the spread is visible at a glance.

Frequently Asked Questions

What is the formula for standard deviation?

The population standard deviation is the square root of the sum of the squared differences from the mean, divided by n: sigma = sqrt(sum of (x minus mean) squared / n). The sample version is the same, except it divides by n minus 1 instead of n.

Why does the sample formula divide by n minus 1?

Because a sample tends to understate the spread of the full population: the most extreme values are often missing from a sample, and the sample mean sits closer to the sample values than the true population mean does. Dividing by n minus 1 instead of n makes the result slightly larger, which corrects for that understatement on average.

What is Bessel's correction?

Bessel's correction is the name for dividing by n minus 1 instead of n when calculating the variance or standard deviation of a sample. It makes the sample variance an unbiased estimate of the population variance — right on average, rather than systematically too small.

When should I use the population formula and when the sample formula?

Use the population formula when your data includes every member of the group you are describing, such as all students in one class. Use the sample formula when your data is only part of a larger group and you want to estimate the spread of the whole group from it.

How big is the difference between the two formulas?

It depends on the sample size. With 5 values, the sample standard deviation is about 12% larger than the population one; with 100 values, the difference is under 1%. For large samples the two formulas give almost the same answer, so the choice matters most with small data sets.