What standard deviation measures
Standard deviation describes how far values typically sit from their mean. Two classes can both average 65% on a test, but if one class's marks run from 60 to 70 and the other's from 30 to 100, the second has a much larger standard deviation. It is in the same units as the data, which makes it easier to read than the variance, its square.
To compute it, find the mean, subtract it from each value, square those deviations so that values below the mean don't cancel those above, add the squares, divide, and take the square root. The only choice is what to divide by.
s = √( Σ(x − x̄)² ÷ (n − 1) ) σ = √( Σ(x − μ)² ÷ n )
Sample or population: why n − 1
If your numbers are every member of the group you care about, such as the scores of all 30 pupils in one class, divide by n. That is the population standard deviation, σ. More often the numbers are a sample from something bigger, and you want to estimate the spread of the whole. Then divide by n − 1 instead; this adjustment is called Bessel's correction.
The reason is that deviations are measured from the sample's own mean, which is pulled towards the sample values, so the squared distances from it are on average a little smaller than those from the true mean. Dividing by n would underestimate the spread; dividing by n − 1 corrects the variance exactly. Put another way, once the mean is fixed only n − 1 deviations are free to vary. The difference shrinks as n grows.
Reading the result
For roughly bell-shaped data, about 68% of values fall within one standard deviation of the mean, 95% within two and 99.7% within three. Because deviations are squared, a single outlier can inflate the result sharply. If the mean and median are far apart, the data is lopsided and the median and range may describe it better.
The mode is the value that occurs most often. If several values tie, all are listed; if nothing repeats, there is no mode. To express how much a figure moved rather than how spread out a set is, use the percent change calculator.
Worked examples
Example 1
Eight values as a whole population
The values 2, 4, 4, 4, 5, 5, 7 and 9 add up to 40, so the mean is 5. The deviations from 5 are −3, −1, −1, −1, 0, 0, 2 and 4, and their squares sum to 9 + 1 + 1 + 1 + 0 + 0 + 4 + 16 = 32. Treated as the whole population, the variance is 32 ÷ 8 = 4 and the standard deviation is √4 = 2.
Example 2
The same values as a sample
If those eight numbers were a sample drawn from a larger group, divide the same sum of squares by 7 instead: 32 ÷ 7 ≈ 4.5714. The square root gives 2.1381, about 7% larger than the population figure. The mean (5), median (4.5) and mode (4) don't change, since they don't depend on the divisor.
Example 3
Five commutes in minutes
Journey times of 32, 35, 29, 41 and 38 minutes over one week are a sample of all your commutes. Their mean is 175 ÷ 5 = 35. The deviations are −3, 0, −6, 6 and 3, whose squares add to 90. Dividing by n − 1 = 4 gives a variance of 22.5 and a standard deviation of 4.7434 minutes. Allowing the mean plus two standard deviations, about 44.5 minutes, covers all but unusually bad days.
Questions people ask
Which should I use in a spreadsheet?
In Excel, Google Sheets and LibreOffice, STDEV.S (or plain STDEV) divides by n − 1 and matches the sample setting here; STDEV.P divides by n and matches the population setting. If you are unsure, the sample version is the safer default, because data is rarely the entire population.
Can the standard deviation be negative or zero?
It can never be negative, because it is the square root of a sum of squares. It is zero only when every value is identical, meaning there is no spread at all.
What is the difference between standard deviation and standard error?
Standard deviation describes the spread of individual values. The standard error describes how precisely the sample mean estimates the true mean, and equals the standard deviation divided by √n, so it shrinks as samples grow.