How standard deviation is calculated
- Find the mean: add the numbers and divide by how many there are (n).
- Subtract the mean from each number, and square each result.
- Add the squares. This total is the sum of squares, SS.
- Divide SS by n − 1 for a sample, or by n for a whole population. That's the variance.
- Take the square root of the variance.
Worked example
Take 2, 4, 4, 4, 5, 5, 7, 9. The sum is 40 and n is 8, so the mean is 5. The squared distances from 5 are 9, 1, 1, 1, 0, 0, 4 and 16, which add up to SS = 32.
- Population: 32 ÷ 8 = 4, and √4 = σ = 2.
- Sample: 32 ÷ 7 = 4.5714, and √4.5714 = s ≈ 2.1381.
- Standard error of the mean: 2.1381 ÷ √8 ≈ 0.7559.
Sample or population?
Use the sample standard deviation when your numbers are a sample from a bigger group, such as 30 customers out of thousands. That covers most real data. Dividing by n − 1 instead of n (Bessel's correction) makes the variance unbiased, so the estimate isn't too small on average. Use the population version only when you have every member of the group, like the scores of every student in one class.
Standard deviation vs. standard error
The standard deviation describes how spread out the individual values are. The standard error, s ÷ √n, describes how precisely you know the mean. It shrinks as you collect more data, while the standard deviation doesn't. The 95% margin shown uses the t distribution with n − 1 degrees of freedom, the same as the confidence interval calculator.
When it doesn't tell the whole story
- Standard deviation is sensitive to outliers: one extreme value can inflate it a lot. The interquartile range in the statistics calculator is more robust.
- The "68% within one standard deviation" rule holds only for roughly bell-shaped data.
- Numbers with a comma as the decimal mark (3,5) are read as two numbers. Use a point (3.5).