Find the mean, measure how far each value sits from it, square those distances, average them, and take the square root. That is the whole method. This page works through it twice on real numbers, covers the case where the mean is already known, lists the mistakes that produce wrong answers, and ends with four practice problems you can check.
The steps
- Find the mean. Add every value and divide by how many there are.
- Subtract the mean from each value. These are the deviations. Some will be negative — that is expected.
- Square each deviation. Every result is now zero or positive.
- Add the squared deviations together.
- Divide by n − 1 if the data is a sample, or by n if it is the whole population. This is the variance.
- Take the square root. This is the standard deviation.
Written as a formula, for a sample of n values with mean x̄:
s = √[ Σ(x − x̄)² / (n − 1) ]
The population version replaces x̄ with μ and n − 1 with N; nothing else changes. If any of the symbols is unfamiliar, the formula page takes the expression apart term by term. Here the point is the arithmetic, so on to a real dataset.
Worked example 1: sample standard deviation
Seven pupils sit a quiz marked out of 10 and score 4, 8, 6, 5, 3, 7, 9. They
are seven pupils out of a much larger year group, so this is a sample and the denominator
will be n − 1.
Step 1 — the mean. The scores add to 4 + 8 + 6 + 5 + 3 + 7 + 9 = 42, and there are 7 of them, so x̄ = 42 ÷ 7 = 6.
Steps 2 and 3 — deviations and squares. Subtract 6 from each score, then square the result. Laying this out as a table is the single best habit for doing the calculation by hand, because each column checks the one before it.
| Value, x | Deviation, x − 6 | Squared, (x − 6)² |
|---|---|---|
| 4 | −2 | 4 |
| 8 | 2 | 4 |
| 6 | 0 | 0 |
| 5 | −1 | 1 |
| 3 | −3 | 9 |
| 7 | 1 | 1 |
| 9 | 3 | 9 |
| Σ = 42 | Σ = 0 | Σ = 28 |
The middle column totals zero. It always does — the deviations above the mean exactly balance the ones below it — so if yours does not, the mean was wrong and there is no point going further. The squared column is what you want: Σ(x − x̄)² = 28.
Step 5 — divide. This is a sample of 7, so divide by n − 1 = 6: 28 ÷ 6 = 4.6667. That is the sample variance, s².
Step 6 — square root. √4.6667 = 2.1602. The sample standard deviation of the seven scores is s ≈ 2.16 marks.
s = √(28 / 6) = √4.6667 = 2.1602
Had these seven been the entire class rather than a sample, step 5 would divide by 7 instead: 28 ÷ 7 = 4 and √4 = 2 exactly. Same data, same working, different denominator, and the answer moves from 2.16 to 2.00 — which is why the sample-or-population question is settled before the arithmetic starts, not after.
The calculator below is loaded with the same seven numbers. Toggle it between sample and population to see the denominator change, or replace them with your own data and compare its working against yours line by line.
Separate values with commas, spaces, tabs or new lines — paste a column straight from a spreadsheet and it will parse. Decimals and negatives are fine.
The shaded bands are one, two and three standard deviations either side of the mean. 5 of 7 values — 71% — fall inside the innermost band.
Show the working, step by step
Worked example 2: population standard deviation
A committee has five members, aged 34, 41, 29, 38, 33. Every member is
included and there is no larger group being estimated, so this is a population and the
denominator is N.
- Sum = 34 + 41 + 29 + 38 + 33 = 175. Mean μ = 175 ÷ 5 = 35.
- Deviations from 35: −1, 6, −6, 3, −2. (Check: they sum to 0.)
- Squared: 1, 36, 36, 9, 4.
- Sum of squares = 1 + 36 + 36 + 9 + 4 = 86.
- Divide by N = 5: 86 ÷ 5 = 17.2. This is the population variance, σ².
- Square root: √17.2 = 4.1473.
σ = √(86 / 5) = √17.2 = 4.1473
The population standard deviation is σ ≈ 4.15 years. For comparison, the sample formula on the same ages would give √(86 ÷ 4) = √21.5 = 4.6368 — about 12% higher, which is typical of the gap at n = 5.
If you already know the mean
Search for "standard deviation from the mean" and you will find two different questions hiding behind the phrase. The first is: the mean has been given to me, what do I do with it? The answer is that you skip step 1 and nothing else. You still need every individual value, because steps 2 to 6 are done on the values, not on the mean.
Suppose you are told a set of five readings has a mean of 20, and the readings are
17, 22, 19, 24, 18. Deviations from 20 are −3, 2, −1, 4, −2. Squared they are
9, 4, 1, 16, 4, which sum to 34. As a sample: 34 ÷ 4 = 8.5, and √8.5 =
2.9155. As a population: 34 ÷ 5 = 6.8, and √6.8 = 2.6077.
The second question is: I have only the mean, can I work out the standard deviation from it?
No. The mean tells you where the data is centred and nothing about how far it is spread. The
sets 19, 20, 21 and 0, 20, 40 both have a mean of 20; their sample
standard deviations are 1 and 20. You need the values, or at the very least the variance,
the sum of squared deviations, or a standard error together with n.
One subtlety worth knowing. If the mean you were given is a rounded figure, the deviations inherit the rounding and the final answer drifts. Where you can recompute the mean exactly from the values, do so. And if the mean is a known population mean supplied from outside the data, rather than one calculated from these values, divide by n rather than n − 1: the correction exists to compensate for measuring spread around the sample's own mean, and it is not needed when you did not.
Sample or population: how to decide
Ask one question: do these values make up the entire group I am describing, or are they a subset I am using to say something about a larger group? Twelve blood-pressure readings from a clinic are a sample of that clinic's patients. The heights of all twenty-three players in a squad, when the question is about that squad, are a population. The same numbers can be either — it depends on what claim you are making, not on the data itself.
When in doubt, treat the data as a sample. Almost every dataset in science, business and
coursework is one, and the sample formula is what STDEV.S, a TI-84's
Sx and the default on this site all compute. The choice matters most for small
n, where dividing by n − 1 rather than n changes the answer by more than 10% at n = 5, and
hardly at all above a few hundred values.
The full guide to deciding is here,
including a table of the gap at each n.
By hand, or with a calculator or spreadsheet
Working through the table by hand is worth doing a few times, because it is the only way to
really understand what the number means, and it is what an exam expects. Beyond about ten
values, though, hand arithmetic is slow and error-prone, and a tool is the right choice.
Excel and Google Sheets do it in one cell: =STDEV.S(A1:A20) for a sample,
=STDEV.P(A1:A20) for a population.
The Excel guide covers the functions and
the text-stored-as-number trap that silently drops rows.
On a TI-84, enter the data in a list and run 1-Var Stats; Sx is the sample
standard deviation and σx the population one.
The TI-84 guide has the keystrokes. And
the calculator on this site shows each of the six steps with the intermediate
numbers, which makes it a good way to check hand working before an exam.
Common mistakes
- Forgetting to square. The raw deviations sum to zero, so an unsquared version gives 0 for every dataset. If your total in step 4 is zero, this is why.
- Dividing by n for a sample. The most common error in coursework. It gives the population figure, which is always slightly too small for a sample. Decide sample or population before you start and write the denominator down.
- Taking the square root too early. Rooting each squared deviation individually just undoes step 3 and returns the absolute deviations. The root is taken once, at the end, of the whole average.
- Rounding intermediate steps. Keep at least four decimal places in the mean and the variance, and round only the final answer. A rounded mean nudges every deviation, and the errors compound through the squaring.
- Mixing units. All values must be in the same unit before you begin. Standard deviation carries the unit of the data, so a mix of centimetres and metres gives a meaningless number.
- Treating the range as the standard deviation. Largest minus smallest is the range, a different and much cruder measure. The SD is always smaller than the range and, for most data, roughly a quarter of it.
Practice problems
Each answer gives the mean and the sample standard deviation, with the population figure where asked. Work them on paper with the three-column table, then check. Rounded to three decimal places; if you rounded earlier your answer may differ in the last digit.
Problem 1
Six delivery times, in minutes: 10, 12, 15, 11, 17, 13. Find the mean and the sample standard deviation.
Show answer
Sum = 78, n = 6, mean = 13. Deviations: −3, −1, 2, −2, 4, 0. Squared: 9, 1, 4, 4, 16, 0. Sum of squares = 34.
Sample variance = 34 ÷ 5 = 6.8. s = √6.8 = 2.608.
Problem 2
Six measured lengths, in centimetres: 2.5, 3.1, 2.8, 3.4, 2.2, 3.0. Find the mean and the sample standard deviation.
Show answer
Sum = 17.0, n = 6, mean = 2.8333. Deviations: −0.3333, 0.2667, −0.0333, 0.5667, −0.6333, 0.1667. Squared: 0.1111, 0.0711, 0.0011, 0.3211, 0.4011, 0.0278. Sum of squares = 0.9333.
Sample variance = 0.9333 ÷ 5 = 0.1867. s = √0.1867 = 0.432 cm. Keep the mean as a fraction (17/6) or to four decimals rather than rounding it early.
Problem 3
Eight test scores: 45, 52, 38, 60, 49, 41, 55, 50. Find the mean, then both the sample and the population standard deviation.
Show answer
Sum = 390, n = 8, mean = 48.75. Deviations: −3.75, 3.25, −10.75, 11.25, 0.25, −7.75, 6.25, 1.25. Squared: 14.0625, 10.5625, 115.5625, 126.5625, 0.0625, 60.0625, 39.0625, 1.5625. Sum of squares = 367.5.
Sample: 367.5 ÷ 7 = 52.5, s = √52.5 = 7.246. Population: 367.5 ÷ 8 = 45.9375, σ = √45.9375 = 6.778.
Problem 4
Eight overnight temperatures, in °C: −5, 3, 0, 7, −2, 6, 1, 6. Find the mean and the sample standard deviation. Watch the signs.
Show answer
Sum = 16, n = 8, mean = 2. Deviations: −7, 1, −2, 5, −4, 4, −1, 4. Squared: 49, 1, 4, 25, 16, 16, 1, 16. Sum of squares = 128.
Sample variance = 128 ÷ 7 = 18.2857. s = √18.2857 = 4.276 °C. Negative values behave no differently: −5 − 2 = −7, and (−7)² = 49.
Related calculators
-
Standard deviation calculator
Paste your numbers and see every step of the working.
-
The standard deviation formula
Both formulas term by term, and why each operation is there.
-
Sample vs population
How to decide, and how much the denominator changes the answer.
-
Variance calculator
The same calculation, stopped before the square root.
Common questions
What are the steps to calculate standard deviation?
Six steps: find the mean; subtract the mean from each value; square each of those deviations; add the squares up; divide by n − 1 for a sample or by n for a population; take the square root. The number before the square root is the variance, so the standard deviation is always the square root of the variance.
How do I calculate standard deviation by hand?
Write the values in a column, put the mean at the top, and add two more columns: one for each value minus the mean, one for that difference squared. Total the squared column, divide by n − 1 (or n for a population), and take the square root. Before squaring, check that the deviation column sums to zero — if it does not, the mean is wrong.
How do I calculate standard deviation from the mean?
You cannot get it from the mean alone: the mean says where the data is centred, not how widely it is spread, and two datasets with the same mean can have completely different standard deviations. What you can do, if the mean is given, is skip step one. Subtract the known mean from each value, square, sum, divide and root exactly as usual.
Should I use the sample or population formula?
Use the sample formula (divide by n − 1) when your values are a subset of a larger group you want to describe, which is nearly every real dataset. Use the population formula (divide by n) only when the values are the complete group and nothing is left out. If you are unsure, sample is the safer default. The full comparison is here.
Why divide by n − 1 instead of n?
Because a sample's mean is fitted to that sample, the values sit slightly closer to it than they do to the true population mean, so the squared deviations come out a little too small on average. Dividing by n − 1 rather than n enlarges the result by exactly enough to cancel that bias. The correction matters a lot for small n and hardly at all for large n.
Why are the deviations squared?
Because the raw deviations from the mean always sum to zero, for any dataset, so their average is zero and tells you nothing. Squaring makes every term positive so the spread cannot cancel out. The square root at the end returns the answer to the original units. More on the formula here.