Standard deviation

Analytika TeamLast reviewed 7 min read

Two classes can have the same average exam score and look nothing alike. In one, everyone scored between 60 and 70. In the other, scores ran from 20 to 100. The mean can’t tell these apart. The standard deviation can, which is why the two are almost always reported together.

What the standard deviation tells you

The SD measures how far values typically sit from the mean, in the same units as the data. If heights have a mean of 170 cm and an SD of 8 cm, most people are within a few centimetres of 170. An SD of 20 cm would mean a much more varied group.

For roughly bell-shaped data, there’s a useful rule of thumb: about 68% of values fall within one SD of the mean, about 95% within two SDs, and nearly all within three. See the normal distribution lesson for where those numbers come from.

The formula

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

In words: take each value’s distance from the mean, square it, add the squares up, divide by n − 1, and take the square root. The result before the square root is the variance (s²).

Step-by-step example

Five students score 4, 6, 7, 8 and 10 on a 10-point quiz.

  1. Find the mean: (4 + 6 + 7 + 8 + 10) / 5 = 35 / 5 = 7.
  2. Find each deviation from the mean: −3, −1, 0, 1, 3.
  3. Square them: 9, 1, 0, 1, 9. (Squaring stops negatives and positives cancelling out.)
  4. Add them up: 9 + 1 + 0 + 1 + 9 = 20. This is the “sum of squares”.
  5. Divide by n − 1: 20 / 4 = 5. This is the sample variance.
  6. Take the square root: √5 ≈ 2.24. This is the standard deviation.

So the scores average 7, and a typical score is a bit over 2 points away from that.

Why divide by n − 1?

You almost always have a sample and want to estimate the spread in the population. A sample’s values sit closer to their own mean than to the true population mean, so dividing by n slightly underestimates the population variance. Dividing by n − 1 (Bessel’s correction) fixes that bias. Use n only if your data genuinely are the whole population. In software:

  • Excel: STDEV.S (sample, n − 1) vs STDEV.P (population, n).
  • R: sd() uses n − 1.
  • Python: numpy.std() uses n by default, so pass ddof=1 for the sample SD. pandas uses n − 1 by default.

That NumPy default is a common source of small, puzzling mismatches with SPSS or R.

Standard deviation vs standard error

These get confused constantly, including in published papers.

  • The standard deviation describes how much individual values vary. It doesn’t shrink as you collect more data. It just gets estimated more accurately.
  • The standard error of the mean (SE = SD / √n) describes how precisely your sample mean estimates the population mean. It shrinks as n grows.

For fuel economy in the mtcars data (32 cars), the SD is 6.03 mpg: cars vary a lot. The SE is 6.03 / √32 ≈ 1.07 mpg: the average is pinned down fairly well. The SE is what feeds into a confidence interval.

Use the SD when you describe your sample. Use the SE (or better, a confidence interval) when you talk about how precise an estimate is. Error bars showing the SE look smaller and more impressive than SD bars, so always label which one a chart uses.

When the SD is a poor summary

The SD is built on the mean, so it inherits the mean’s sensitivity to outliers and skew. For skewed data such as incomes, one extreme value can inflate it hugely. In that case report the median and interquartile range instead (see mean, median and mode). A sign of trouble: an SD that is larger than the mean for a variable that can’t go negative.

Reporting

In APA style, report the SD next to its mean, to the same number of decimals: “Quiz scores averaged 7.00 (SD = 2.24).” Or in a table with columns for M and SD. Our free descriptive statistics calculator gives the sample SD, variance and SE for any column you paste in.

More in Descriptive statistics

Try it with the free tools

Run this on your own data

Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.

Try it free