How standard deviation is calculated
Standard deviation measures how far values typically sit from their mean. A small value means the numbers cluster tightly; a large one means they are spread out. It is measured in the same units as the data, which is why it is more useful than variance for describing real measurements.
The method has four steps. First find the mean. For 2, 4, 4, 4, 5, 5, 7, 9 the sum is 40 and the mean is 40 ÷ 8 = 5. Second, subtract the mean from each value to get its deviation. Third, square each deviation so that negative and positive ones do not cancel (9, 1, 1, 1, 0, 0, 4, 16) and add them: 32. Fourth, divide by the count to get the variance, 4, and take the square root: σ = √4 = 2. Squaring is the reason a single extreme value moves the standard deviation so much.
Sample versus population standard deviation
The only difference between the two is the denominator. If your numbers are the whole group you care about, every student in one class, say, use the population form and divide the sum of squares by n. If they are a sample drawn from a larger group, divide by n − 1 instead. The result is called the sample standard deviation, s.
Why n − 1? A sample's values sit closer to their own mean than to the true population mean, which makes the raw spread too small. Dividing by n − 1 corrects for this: one degree of freedom is used up by estimating the mean from the same data. For the same eight numbers the population value is 2 and the sample value is 2.13809. The gap shrinks as the data grow, and with a single value the sample version is not defined at all, because n − 1 would be zero.
Two worked examples
Example one is the dataset above treated as a complete population: mean 5, variance 4, standard deviation 2. A typical value is about 2 away from 5, and 6 of the 8 values lie within one standard deviation of the mean (from 3 to 7).
Example two is a sample: delivery times in minutes of 12, 15, 11, 18, 14, 20. The mean is 15, the sum of squared deviations is 60, and the sample variance is 60 ÷ 5 = 12. The sample standard deviation is 3.4641 minutes. Had we wrongly treated these six as a whole population, we would have reported 3.16228, which understates the spread. A third check: for 1, 3, 5 the mean is 3 and s = 2.
Standard error and confidence intervals
The standard error of the mean, SEM = s ÷ √n, describes how much the sample mean itself would wobble from sample to sample. For the delivery times it is 1.41421. A 95% confidence interval for the true mean is the sample mean plus or minus a critical value times the SEM. With only 6 values we use a Student t value with 5 degrees of freedom, 2.57058, which gives 11.3646 to 18.6354 minutes.
Two assumptions matter. The data should be an independent random sample, and roughly bell-shaped unless the sample is large. A z value is only appropriate when the true population standard deviation is known in advance, which is rare; tick the box on the calculator if that is your case. A mean alone can never reveal a standard deviation, because very different spreads share the same average.
Reading a standard deviation in practice
A standard deviation is only meaningful next to the mean and the units of the data. A value that looks large for delivery times in minutes could be tiny for house prices in dollars, so compare it with the mean, or use the coefficient of variation, the standard deviation divided by the mean, when you need a unit-free comparison. In roughly bell-shaped data, most values fall within two standard deviations of the mean, but that rule weakens for skewed data or data with extreme outliers, because a single large value inflates the result. If your data has outliers, check it against the median and the quartiles on the statistics calculator before drawing conclusions.
Frequently asked questions
Why divide by n − 1 for a sample?
The sample mean is estimated from the same data, which uses up one degree of freedom. Dividing by n − 1 removes the resulting bias in the variance.
Can a standard deviation be negative?
No. It is a square root of an average of squares, so it is zero or positive.
What if all the numbers are the same?
The standard deviation is zero: nothing varies, so every deviation from the mean is zero.
What is the difference between standard deviation and variance?
Variance is the average squared deviation; the standard deviation is its square root, so it is in the original units.
For the median, quartiles and mode of the same numbers use the statistics calculator. To turn a mean and standard deviation into probabilities, try the normal distribution calculator or the probability calculator, or browse all calculators.