Sample vs Population Standard Deviation: Why n − 1, and When It Matters
Dividing by n − 1 instead of n is not a convention or a safety margin. It corrects a specific, provable bias. Here is the same dataset both ways, the size of the error at every sample size, and the software defaults that silently pick for you.
Sample vs Population Standard Deviation
Two formulas, one difference: the denominator. The population version divides the sum of squared deviations by N. The sample version divides by n − 1. Everything else is identical, and the choice is not stylistic.
The rule is about what your data represents, not how much of it you have. If your numbers are the entire group you care about, use N. If they are a subset standing in for a larger group, use n − 1. A census of a 30-person department uses N. A survey of 3,000 voters uses n − 1.
Try the standard deviation calculatorPaste a dataset and toggle between sample and population mode to see both results and the full working.The two formulas
The same eight numbers, both ways
Eight test scores: 72, 85, 78, 90, 66, 81, 94, 74. They sum to 640, so the mean is 80.
Swipe sideways to compare columns.
| Score | Deviation | Squared |
|---|---|---|
| 72 | −8 | 64 |
| 85 | +5 | 25 |
| 78 | −2 | 4 |
| 90 | +10 | 100 |
| 66 | −14 | 196 |
| 81 | +1 | 1 |
| 94 | +14 | 196 |
| 74 | −6 | 36 |
| Total | 0 | 622 |
Why n − 1 is a correction, not a fudge
When you compute deviations from the sample mean rather than the true population mean, you understate the spread. Not sometimes: always, on average. The reason is that the sample mean sits wherever your particular sample happens to sit, and by construction it is the point that minimises the sum of squared deviations for that sample.
Any other centre, including the true population mean, would give a larger sum of squares. So using x̄ pulls the number down every time, and dividing by n leaves an estimate that is systematically too small. Dividing by n − 1 corrects exactly that shortfall.
The n − 1 is the degrees of freedom. Once you know the mean and any seven of the eight scores, the eighth is determined, because the deviations must sum to zero. Only seven of the eight deviations carry independent information, so you divide by seven.
How much the choice actually changes the answer
The gap depends only on n, and it shrinks fast. The sample figure exceeds the population figure by a factor of √(n / (n − 1)).
Swipe sideways to compare columns.
| n | Correction factor | Sample result is larger by |
|---|---|---|
| 3 | 1.2247 | 22.5% |
| 5 | 1.1180 | 11.8% |
| 8 | 1.0690 | 6.9% |
| 10 | 1.0541 | 5.4% |
| 30 | 1.0172 | 1.7% |
| 100 | 1.0050 | 0.5% |
| 1,000 | 1.0005 | 0.05% |
Past about n = 100 the distinction is academic for reporting purposes. Below n = 10 it is large enough to change a conclusion. That is exactly the range where small studies, pilot batches, and quality samples live, which is why the correction matters most precisely where people are most casual about it.
Deciding which one you need
Swipe sideways to compare columns.
| Your data | Use | Why |
|---|---|---|
| Every employee in your company | Population, N | There is no wider group you are inferring about |
| A survey of 400 customers | Sample, n − 1 | You are estimating all customers |
| All 12 monthly sales figures for the year | Population, N | The year is complete and is the thing being described |
| 12 months used to forecast next year | Sample, n − 1 | You are treating the year as a draw from a process |
| Every measurement from a finished production run | Population, N | Describing that run |
| Hourly samples from an ongoing process | Sample, n − 1 | Estimating the process, not the samples |
| Exam scores for a single class you teach | Either, state which | Depends on whether the class is the subject or a stand-in |
The last row is honest rather than evasive. The same numbers can be a population or a sample depending on the question. If you are reporting how this class did, the class is the population. If you are asking what the material does to students generally, the class is a sample. Say which you meant.
The software defaults that choose for you
Most tools default to one or the other silently, and they do not agree with each other. This is a genuine source of mismatched numbers between a spreadsheet and a script.
Swipe sideways to compare columns.
| Tool | Sample (n − 1) | Population (N) | Default |
|---|---|---|---|
| Excel and Google Sheets | STDEV.S, VAR.S | STDEV.P, VAR.P | No default, you must pick |
| Excel legacy names | STDEV | STDEVP | Still supported |
| Python statistics module | stdev | pstdev | No default, you must pick |
| NumPy | np.std(x, ddof=1) | np.std(x) | Population |
| pandas | series.std() | series.std(ddof=0) | Sample |
| R | sd(x) | no built-in | Sample |
| Most calculators, 1-Var Stats | Sx | σx | Both shown |
Where the choice propagates
Standard deviation rarely stops at itself. It feeds confidence intervals, t-tests, control limits, z-scores, and coefficient of variation. Using the population formula on sample data makes every one of those downstream numbers too narrow or too confident.
On the eight scores above, a 95% confidence interval for the mean built on s = 9.426 with seven degrees of freedom spans roughly 72.1 to 87.9. Built incorrectly on σ = 8.818 with a normal critical value, it spans about 73.9 to 86.1: nearly two points narrower on each side, from an error that looked like a rounding difference.
Try the confidence interval calculatorSee how the interval width responds to the standard deviation, the sample size, and the confidence level.What this does not tell you
- Bessel's correction fixes bias, not small-sample unreliability. With n = 5, the estimate is unbiased on average and still wildly variable from one sample to the next.
- It assumes the sample is random and independent. A biased sample gives a biased spread no matter which denominator you use, and no correction repairs that.
- Standard deviation is a poor summary for skewed or multi-modal data. Two datasets can share a mean and a standard deviation and look nothing alike.
- It is sensitive to outliers, because deviations are squared. One extreme value can dominate the result, and neither formula protects you.
- For finite populations sampled without replacement, a further finite population correction applies, which this article ignores.
- The confidence interval figures above assume approximate normality, which is a strong assumption at n = 8.
Which should I use if I am not sure?
Use the sample formula. Most real data is a sample of something, and the sample formula is the conservative choice: it reports slightly more spread rather than less. Understating uncertainty is the more damaging error.
Does n − 1 matter with large datasets?
Not numerically. At n = 1,000 the two differ by 0.05%, well below the precision of anything you would report. It still matters conceptually, because it signals whether you are describing your data or inferring beyond it.
Why does the sample version give a bigger number?
Because dividing by a smaller denominator produces a larger quotient, and that is the intended effect. Deviations measured from the sample mean understate the true spread, so the correction inflates the result back to an unbiased level.
What is a degree of freedom, concretely?
The number of values that could still vary once you have fixed what you already know. Fix the mean of eight numbers and seven of them, and the eighth has only one possible value. Seven pieces of independent information, so seven degrees of freedom.
Can I convert between the two after the fact?
Yes, if you know n. Multiply the population figure by √(n / (n − 1)) to get the sample figure, or divide to go the other way. On the eight scores, 8.818 × 1.0690 = 9.426.
Why did my spreadsheet and my Python script disagree?
Almost certainly the NumPy default. np.std uses the population formula unless you pass ddof=1, while STDEV.S in a spreadsheet uses the sample formula. On a small dataset the gap is several percent and looks like a bug elsewhere.
Written by
Do The Calculation Team
Do The Calculation
Do The Calculation is built by a small team of data analysts and spreadsheet developers. Where a guide depends on a published formula, standard, or government rule, the calculator it links to names that source directly so you can check the number yourself.
About the team