How to Calculate Standard Deviation (Step by Step, Plus Z-Scores)
Standard deviation tells you how spread out a set of numbers is. A small standard deviation means the values sit close to the average; a large one means they scatter widely. People use it for test scores, quality control, investing and science.
Quick answer
- First, find the mean (average).
- Then subtract the mean from each value and square the result.
- Next, add the squares and divide by n (population) or n − 1 (sample). This gives the variance.
- Finally, take the square root of the variance.
Worked example
Data: 2, 4, 4, 4, 5, 5, 7, 9 (n = 8).
| Value | Value − mean | Squared |
|---|---|---|
| 2 | -3 | 9 |
| 4 | -1 | 1 |
| 4 | -1 | 1 |
| 4 | -1 | 1 |
| 5 | 0 | 0 |
| 5 | 0 | 0 |
| 7 | 2 | 4 |
| 9 | 4 | 16 |
- First, the mean: 40 ÷ 8 = 5.
- Next, the sum of squares: 32.
- So the population variance is 32 ÷ 8 = 4, so the population standard deviation is √4 = 2.
- By contrast, the sample variance is 32 ÷ 7 = 4.571, so the sample standard deviation is 2.138.
Sample or population?
Use the population formula (divide by n) when your data includes every member of the group, such as every student in one class. Use the sample formula (divide by n − 1) when you use a sample to estimate a larger group. The NIST/SEMATECH e-Handbook of Statistical Methods gives the sample formula and describes the standard deviation as the square root of the variance.
In Excel or Google Sheets
- Sample:
=STDEV.S(A1:A10)(or STDEV in Google Sheets) - Population:
=STDEV.P(A1:A10)(or STDEVP) - Mean:
=AVERAGE(A1:A10)
What the number means
For example, for data that’s roughly bell-shaped (a normal distribution), about 68% of values fall within one standard deviation of the mean, about 95% within two, and about 99.7% within three. So if test scores average 70 with a standard deviation of 10, most students scored between 60 and 80.
Z-scores
A z-score tells you how many standard deviations a value is from the mean: z = (value − mean) ÷ standard deviation. For instance, a score of 85 when the mean is 70 and the standard deviation is 10 has z = 1.5, so it’s 1.5 standard deviations above average. Similarly, negative z-scores are below average.
For means, medians and modes, see how to calculate an average.
Frequently asked questions
How do I calculate standard deviation?
Find the mean, square each value’s distance from it, average those squares (dividing by n or n − 1), and take the square root.
What’s the difference between sample and population standard deviation?
The sample version divides by n − 1 instead of n, giving a slightly larger value.
What does a high standard deviation mean?
The values are spread far from the average.
What is a z-score?
The number of standard deviations a value is from the mean.
