Skip to tool
ecech.
📊 Math & Statistics

Standard Deviation, and Why Dividing by n Is Usually the Wrong Answer

Population divides by n, sample divides by n−1, and on eight values they differ by 6.9%. Almost all real data is a sample, so the default most tools use is the wrong one.

Sample — divide by n−1

use this unless you measured every single case — STDEV.S

Population — divide by n

only when your data is the whole group — STDEV.P

Count

Mean

Median

Sample variance

Range

Spread

Quartiles and outlier bounds

Advertisement

How the calculation works

Same data: 2, 4, 4, 4, 5, 5, 7, 9 population ÷ n 2.000 only if these eight are everyone sample ÷ n−1 2.138 if they came from a larger group 6.9% apart on eight values, and 15% apart on four. The divisor is not a detail.

How to Use This Tool

Paste your numbers. Both standard deviations are shown, because which one you want depends on your data rather than on the arithmetic.

The question that decides it

Ask: is this every value that exists, or a sample from something larger?

  • Population — you measured every case. The height of everyone in this room, the salary of all twelve employees, the score of every test you ran. Divide by n.
  • Sample — these values came from a larger group you are trying to describe. Divide by n−1.

Almost all real data is a sample. Survey responses are a sample of people. Last month's load times are a sample of all load times. Ten measurements are a sample of the measurements you could have taken. If you are drawing any conclusion beyond the exact numbers in front of you, it is a sample.

Why n−1 rather than n

Because you used the same data twice. The mean was calculated from your values, so your values are closer to that mean than they would be to the true mean of the whole population. Squared differences from your own mean are therefore systematically too small, and dividing by n would give a standard deviation that is systematically too low.

Subtracting one from the divisor corrects for that. The name for it is Bessel's correction, and the justification is that you spent one degree of freedom estimating the mean.

How much the divisor matters, by sample size n = 4 15.5% higher n = 8 6.9% higher n = 30 1.7% higher On small datasets the choice changes the answer materially. On large ones it stops mattering.
Which is why the mistake hides: it is invisible on big data and significant on small.

The spreadsheet trap

Excel and Google Sheets both ship STDEV.P and STDEV.S, and the names give no hint that one of them is usually wrong for your data. Excel also keeps a legacy STDEV, which is the sample version, and a legacy STDEVP, which is not.

The practical advice is to use STDEV.S unless you can state clearly why your data is a complete population. If you cannot articulate what larger group it came from, that is worth pausing over — it usually means it is a sample and you had not thought about it.

What standard deviation does not tell you

It is a summary, and summaries hide things. Two datasets with identical means and standard deviations can look completely different — one symmetric, one heavily skewed, one with two clusters. The familiar rules about 68% falling within one standard deviation assume a normal distribution, and most real data is not normal.

So look at the plot above as well as the number. If the values cluster in two groups, or trail off in one direction, the standard deviation is technically correct and is describing a shape your data does not have.

Advertisement

Frequently Asked Questions

Should I use sample or population standard deviation?
Sample, in almost every case. Use population only when your data is every value that exists — all twelve employees, every test you ran. If you are drawing any conclusion beyond the exact numbers in front of you, it is a sample and you want the n−1 version.
Why divide by n−1 instead of n?
Because the mean was calculated from the same data, so your values sit closer to that mean than to the population's true mean. Squared differences come out systematically too small, and dividing by n would understate the spread. Subtracting one corrects for the degree of freedom spent estimating the mean.
How much difference does the divisor make?
It depends on the sample size: about 15% at four values, 6.9% at eight, and under 2% at thirty. That is why the mistake persists — on large datasets it is invisible, and on the small ones where it matters most, people are least likely to check.
What is the difference between STDEV.S and STDEV.P in Excel?
STDEV.S divides by n−1 and is for samples; STDEV.P divides by n and is for complete populations. The names give no hint which one your data needs. Excel also keeps a legacy STDEV, which is the sample version, and STDEVP, which is not.
What is variance, and how does it relate?
Variance is the standard deviation squared, or equivalently the mean squared difference from the mean. It is easier to work with mathematically because variances of independent things add, but it is in squared units — squared pounds, squared seconds — which is why the square root is what gets reported.
Does 68% of my data fall within one standard deviation?
Only if the data is normally distributed, and most real data is not. The 68-95-99.7 rule is a property of the normal distribution rather than of standard deviation itself. Look at the shape of your data before applying it — skewed or clustered data breaks the rule badly.

Related tools in Math & Statistics

Browse all Math & Statistics tools
The Mac mini the ecech. site is built on, beside a handwritten note reading ecech.com.

Made by one person

ecech. is not a content farm. Every tool here is written and checked by hand, one at a time, by someone who wanted the tool to exist and could not find a version that showed its working.

No accounts and no sign-in, and nothing you type reaches a server — every calculation on this page runs inside your browser. The ads are served by Google and do set their own cookies, which is set out in full on the privacy page. More about the site.