How to Calculate Standard Deviation
By the Calculator.hair team · Updated · 6 min read
Short answer
To calculate standard deviation, find the mean, subtract it from each value, square those differences, add them, divide by n for a population or n − 1 for a sample, and take the square root. For 10, 12, 23, 23, 16, 23, 21, 16, the mean is 18 and the squared differences total 192, so the population standard deviation is √(192 ÷ 8) = 4.90 and the sample standard deviation is √(192 ÷ 7) = 5.24.
Key takeaways
- Standard deviation measures how far values typically sit from the mean, in the same units as the data.
- Population standard deviation divides the sum of squared deviations by n; sample standard deviation divides by n − 1.
- Variance is the standard deviation squared, before taking the square root.
- In a normal distribution about 68% of values fall within 1 standard deviation of the mean and about 95% within 2.
What is the standard deviation formula?
Population standard deviation is σ = √(Σ(x − μ)² ÷ N), and sample standard deviation is s = √(Σ(x − x̄)² ÷ (n − 1)). In both, x is each value, μ or x̄ is the mean, N or n is the number of values, and Σ means "add up."
Standard deviation is a measure of spread: the typical distance between a data point and the mean. A small value means the numbers cluster tightly around the average; a large one means they are scattered. Because it is the square root of the variance (the average squared deviation), it comes out in the original units, so the standard deviation of test scores is in points and of heights is in inches.
| Population | Sample | |
|---|---|---|
| Use when | You have every member of the group | Your data is a subset used to estimate a larger group |
| Mean symbol | μ (mu) | x̄ (x-bar) |
| Divide squared deviations by | N | n − 1 |
| Variance symbol | σ² | s² |
| Standard deviation symbol | σ (sigma) | s |
How do you calculate standard deviation step by step?
Work through five steps: mean, deviations, squares, sum and divide, square root. Take eight quiz scores: 10, 12, 23, 23, 16, 23, 21, 16.
- Step 1, the mean: add the values and divide by the count. 144 ÷ 8 = 18.
- Step 2, the deviations: subtract the mean from each value, as in the second column below. They always sum to zero.
- Step 3, the squares: square each deviation so negatives and positives do not cancel.
- Step 4, sum and divide: the squares add up to 192. Divide by 8 for the population variance (24) or by 7 for the sample variance (27.43).
- Step 5, the square root: √24 = 4.90 and √27.43 = 5.24.
What does the worked example table look like?
Each row below is one value, its deviation from the mean of 18 and the squared deviation. These are the figures the standard deviation calculator produces for the same eight numbers.
| Value (x) | x − 18 | (x − 18)² |
|---|---|---|
| 10 | −8 | 64 |
| 12 | −6 | 36 |
| 23 | 5 | 25 |
| 23 | 5 | 25 |
| 16 | −2 | 4 |
| 23 | 5 | 25 |
| 21 | 3 | 9 |
| 16 | −2 | 4 |
| Sum: 144 | 0 | 192 |
Why does sample standard deviation divide by n − 1?
Dividing by n − 1 corrects a bias: deviations measured from a sample's own mean are, on average, smaller than deviations from the true population mean, so dividing by n would understate the spread. The adjustment is called Bessel's correction, and n − 1 is the number of degrees of freedom left after estimating the mean from the same data.
In the example, the two answers differ by about 7%: 4.90 as a population and 5.24 as a sample. The gap shrinks as n grows; with 100 values, dividing by 99 instead of 100 changes the variance by about 1%.
Choose population when the data is the whole group you care about, such as every employee's salary at one company. Choose sample when the data stands in for something larger, such as 50 customers surveyed out of thousands. Most research and survey data are samples. In spreadsheets, STDEV.P is the population formula and STDEV.S is the sample formula.
| Result for 10, 12, 23, 23, 16, 23, 21, 16 | Population | Sample |
|---|---|---|
| Count | 8 | 8 |
| Mean | 18 | 18 |
| Sum of squared deviations | 192 | 192 |
| Divisor | 8 | 7 |
| Variance | 24 | 27.43 |
| Standard deviation | 4.90 | 5.24 |
| Standard error of the mean | 1.73 | 1.85 |
How do you interpret standard deviation?
For data that follow a bell-shaped normal distribution, about 68% of values lie within 1 standard deviation of the mean, about 95% within 2 and about 99.7% within 3. This is often called the 68-95-99.7 rule or the empirical rule.
With a mean of 18 and a population standard deviation of 4.90, a typical score falls between about 13.1 and 22.9. Eight scores are too few to call any distribution normal, so treat the rule as a guide for larger, roughly symmetric data sets. For skewed data, such as incomes or home prices, the median and interquartile range often describe the center and spread better; the mean, median, mode and range calculator shows that the same eight scores have a median of 18.5, a mode of 23 and a range of 13.
How is standard deviation used to find a z-score?
A z-score tells you how many standard deviations a value is from the mean: z = (x − μ) ÷ σ. In the quiz example, a score of 23 has z = (23 − 18) ÷ 4.90 = 1.02, about one standard deviation above average, and a score of 10 has z = −1.63.
Converting to z-scores puts values from different scales on a common footing and, for normal data, links them to percentiles. The z-score calculator reports that z = 1.02 corresponds to about the 85th percentile of a normal distribution. For a fuller summary, including the variance, standard error and confidence intervals, use the statistics calculator.
What mistakes are common when calculating standard deviation?
Most wrong answers trace back to one of these slips.
- Using n when the data is a sample, or n − 1 when it is the whole population.
- Forgetting to square the deviations, which makes them sum to zero.
- Stopping at the variance and forgetting the square root.
- Rounding the mean too early; keep full precision until the last step.
- Reading standard deviation as the range. The range (13 here) is the gap between the extremes; the standard deviation is a typical distance from the mean.
Calculators in this guide
Frequently asked questions
What is the formula for sample standard deviation?
s = √(Σ(x − x̄)² ÷ (n − 1)). Subtract the sample mean from each value, square, add, divide by one less than the count, and take the square root.
Can standard deviation be negative?
No. It is the square root of an average of squared numbers, so it is zero or positive. It is zero only when every value is the same.
What is the difference between variance and standard deviation?
Variance is the average squared deviation; standard deviation is its square root. In the example, the population variance is 24 and the standard deviation is 4.90.
What is a good standard deviation?
There is no universal good value. Compare it to the mean: a standard deviation of 4.9 on scores averaging 18 is about 27% of the mean, which is fairly wide; the same 4.9 on scores averaging 90 would be tight.
Should I use population or sample standard deviation?
Use population if your data covers the entire group you are describing, and sample if it is a subset you are using to estimate a larger group. When unsure, the sample formula is the safer default.