How to Calculate Standard Deviation by Hand, Step by Step

The mean tells you where the middle of a data set is. The standard deviation tells you how far the values typically sit from that middle. Two classes can both average 70 on a test, but if one has scores from 68 to 72 and the other from 40 to 100, they are very different groups.

The calculation has only five steps and needs nothing beyond addition, squaring and a square root. This guide does it on a small example, explains the single choice you have to make (divide by n or by n − 1), and shows how to read the answer.

The five steps

  1. Find the mean of the values.
  2. Subtract the mean from each value to get its deviation.
  3. Square each deviation, which removes the minus signs.
  4. Add the squares and divide by n (population) or n − 1 (sample). This is the variance.
  5. Take the square root of the variance. This is the standard deviation.

s = √( Σ(x − mean)² ÷ (n − 1) )Sample standard deviation. For a whole population, divide by n instead.

Squaring in step 3 matters because the plain deviations always add up to zero. The square root in step 5 returns the answer to the original units, so a standard deviation of heights is in centimetres, not square centimetres.

A worked example with eight values

Take the values 2, 4, 4, 4, 5, 5, 7 and 9. They add up to 40, so the mean is 40 ÷ 8 = 5.

ValueDeviation (x − 5)Squared deviation
2−39
4−11
4−11
4−11
500
500
724
9416
Total032

The squared deviations add up to 32. If these eight values are the entire population, the variance is 32 ÷ 8 = 4 and the standard deviation is √4 = 2.

If they are a sample drawn from a larger group, divide by n − 1 = 7 instead. The variance is 32 ÷ 7 ≈ 4.571 and the standard deviation is √4.571 ≈ 2.138. You can confirm both results with the standard deviation calculator.

Why n minus 1 for a sample?

When you only have a sample, you do not know the true population mean, so you measure deviations from the sample mean instead. The sample mean is, by construction, the point closest to your own values, so deviations measured from it come out slightly too small on average.

Dividing by n − 1 instead of n compensates for this. The result is called Bessel's correction, and it makes the sample variance an unbiased estimate of the population variance. The standard deviation, being a square root, is still very slightly biased, but the n − 1 version is the standard choice.

  • Use n when your data is the complete group you care about, such as every score in one class.
  • Use n − 1 when the data is a sample used to learn about a bigger group, which is the usual case in surveys and experiments.
  • With large samples the two answers are almost the same. The choice matters most below about 30 values.

Reading the result

A standard deviation has no meaning on its own: it needs the mean beside it. For data that is roughly bell-shaped, the empirical rule gives a useful guide:

RangeShare of values (approx.)
Mean ± 1 SD68%
Mean ± 2 SD95%
Mean ± 3 SD99.7%

In the example above, a bell-shaped population with mean 5 and SD 2 would have about 95% of its values between 1 and 9. The rule is a poor fit for strongly skewed data, so check the shape before relying on it.

Spread is what separates data sets that share a mean. The values 48, 49, 50, 51, 52 and 30, 40, 50, 60, 70 both average 50. The squared deviations total 10 for the first set and 1,000 for the second, so with n − 1 = 4 the sample standard deviations are about 1.58 and 15.81. The second group is ten times as spread out, which the mean alone would never reveal.

To compare spread between data sets measured on different scales, divide the standard deviation by the mean to get the coefficient of variation. The coefficient of variation calculator does this directly.

Common slips to avoid

  • Forgetting to square: the deviations then sum to zero and the result is meaningless.
  • Taking the square root of the sum instead of the variance, or forgetting the root altogether and reporting the variance.
  • Mixing up the two formulas. Check whether your calculator or spreadsheet function is the sample or population version.
  • Rounding the mean early. Keep a few extra decimals until the final step.

If you need the variance itself rather than its root, the variance calculator reports it for either case.

Try the tools
  • Standard Deviation Calculator: Paste your numbers, choose sample or population, and get the standard deviation with the variance, mean, standard error of the mean, range and count. A second mode handles proportions and rates.
  • Variance Calculator: Enter your numbers, choose sample or population, and read off the variance along with the standard deviation, mean, standard error and count. A proportion mode covers yes/no outcomes.
  • Coefficient of Variation Calculator: The coefficient of variation expresses spread as a fraction of the mean, so variability can be compared across data sets with different units or scales. Enter summary values, paste raw data, or give a proportion and a sample size.

This article is general information, not professional advice. See our Disclaimer and Editorial Policy.

More articles