How to Calculate Standard Deviation (Step by Step)
Standard deviation measures how spread out a set of numbers is. Learn the formula, the difference between population and sample, and a full worked example.
Try the standard deviation calculatorPut these numbers to workOpen →Standard deviation is a single number that tells you how spread out a set of values is around their average. A small standard deviation means the numbers cluster tightly near the mean; a large one means they are scattered. It is the most common way to describe variability, used everywhere from test scores to investment risk.
The formula, step by step
- 1Find the mean (average) of all the values.
- 2Subtract the mean from each value to get its deviation.
- 3Square each deviation (so negatives don't cancel positives).
- 4Average the squared deviations — this is the variance. Divide by N for a whole population, or by N − 1 for a sample.
- 5Take the square root of the variance to get the standard deviation, back in the original units.
Worked example
Take the values 2, 4, 4, 4, 5, 5, 7, 9. The mean is 40 ÷ 8 = 5. The squared deviations are 9, 1, 1, 1, 0, 0, 4, 16, which sum to 32. As a population, variance = 32 ÷ 8 = 4, so the standard deviation is √4 = 2. As a sample, variance = 32 ÷ 7 ≈ 4.57, so the standard deviation is about 2.14.
Population vs sample — which to use
- •Use the population formula (÷ N) when your data is the entire group you care about.
- •Use the sample formula (÷ N − 1) when your data is a sample meant to estimate a larger population — dividing by N − 1 corrects the tendency of a small sample to underestimate spread.
- •For large data sets the two answers are almost identical; the difference only matters for small samples.
Why we square the deviations
Deviations above and below the mean would cancel to zero if you just added them. Squaring makes every distance positive and gives extra weight to values far from the mean, so outliers show up strongly. Taking the square root at the end returns the result to the original units, which is why standard deviation is easier to interpret than variance.