➗ Math

How to Calculate Standard Deviation (With a Worked Example)

Understand what standard deviation measures, the step-by-step formula, and why a sample and a whole population are calculated differently.

Updated 12 October 2026 · 2 min read

An average tells you the middle of a data set, but it says nothing about how spread out the numbers are. Standard deviation fills that gap: it measures how far, on average, each value sits from the mean. A small standard deviation means the data clusters tightly; a large one means it's scattered.

The formula, step by step

Standard deviation is the square root of the variance, and variance is the average of the squared distances from the mean. Squaring keeps negative and positive distances from cancelling out, and the final square root brings the result back to the original units.

  1. Find the mean (add all the values and divide by how many there are).
  2. Subtract the mean from each value to get its distance from the centre.
  3. Square each of those distances.
  4. Average the squared distances — this is the variance.
  5. Take the square root of the variance to get the standard deviation.

A worked example

Take the numbers 2, 4, 4, 4, 5, 5, 7, 9. The mean is 40 ÷ 8 = 5. The squared distances from 5 are 9, 1, 1, 1, 0, 0, 4, 16, which add up to 32. Divide by 8 (treating this as the whole population) to get a variance of 4, and the square root of 4 is a standard deviation of 2.

Sample vs population

Population standard deviation divides the squared distances by n (the count). Sample standard deviation divides by n − 1 instead, which slightly increases the result to correct for the uncertainty of only measuring part of a group.

The choice matters more than it looks. If your numbers *are* the complete set — every student in one class, say — use the population formula. If they're a sample meant to represent something larger, divide by n − 1. This is called Bessel's correction, and it stops a small sample from systematically underestimating the true spread.

Reading the result

  • Standard deviation is in the same units as your data, so a set of heights in centimetres gives a standard deviation in centimetres.
  • For many natural data sets, about two-thirds of values fall within one standard deviation of the mean.
  • Variance is the squared version — useful in further statistics, but harder to interpret directly because its units are squared.

Working the squares out by hand is slow and error-prone past a handful of values, so the standard deviation calculator does the mean, variance and standard deviation in one step and lets you switch between sample and population. If you're still getting comfortable with averages, start with the mean, median and mode, and for the square-root step there's a short guide to finding a square root.

Frequently asked questions

What does standard deviation actually measure?
It measures how spread out a set of numbers is around their mean. A low standard deviation means the values are close to the average; a high one means they're widely scattered.
When should I use sample instead of population standard deviation?
Use the sample formula (dividing by n − 1) when your data is only part of a larger group you want to describe. Use the population formula (dividing by n) when your data includes every member of the group.
What's the difference between variance and standard deviation?
Variance is the average of the squared distances from the mean, and standard deviation is its square root. They describe the same spread, but standard deviation is in the original units, which makes it easier to interpret.

Related calculators