Standard Deviation Explained Simply: Formula, Step-by-Step Example and Sample vs Population
Standard deviation is the square root of the average squared distance from the mean. See the formula, a step-by-step marks example, and when to divide by n − 1.
Standard deviation measures how far values typically sit from their average. To find it, subtract the mean from each value, square the differences, average them (dividing by n for a whole population or n − 1 for a sample), then take the square root. A small standard deviation means the values cluster close to the mean; a large one means they are spread out.
This guide works through the calculation by hand on a set of exam marks, explains variance, settles the n versus n − 1 question, and covers the 68-95-99.7 rule, the coefficient of variation and Excel's STDEV.S and STDEV.P.
To check your own numbers, paste them into the standard deviation calculator. It shows the sample and population figures side by side, with the variance, mean, range and coefficient of variation.
The standard deviation formula for a population and a sample
There are two versions. They differ only in what you divide by.
Population standard deviation: σ = √( Σ(x − μ)² ÷ N ) Sample standard deviation: s = √( Σ(x − x̄)² ÷ (n − 1) )
xis each value, andΣmeans "add up for every value".μ(mu) is the population mean andx̄(x-bar) is the sample mean. Both are worked out the same way: total ÷ count.Nornis the number of values.σ(sigma) is the population standard deviation andsis the sample standard deviation.
The part under the square root is the variance: σ² for a population, s² for a sample.
How to calculate standard deviation step by step
Here are the marks (out of 100) of 10 students in a Maths unit test: 56, 62, 68, 70, 72, 75, 78, 81, 85, 93.
- Find the mean. The total is 740, so the mean is 740 ÷ 10 = 74.
- Subtract the mean from each mark. These are the deviations. Some are negative, and together they always add up to zero.
- Square each deviation. Squaring makes every value positive and gives more weight to marks far from the mean.
- Add the squares. This is the sum of squares.
- Divide and take the square root. Divide by n for the population figure or n − 1 for the sample figure, then take the square root.
| Mark (x) | x − 74 | (x − 74)² |
|---|---|---|
| 56 | −18 | 324 |
| 62 | −12 | 144 |
| 68 | −6 | 36 |
| 70 | −4 | 16 |
| 72 | −2 | 4 |
| 75 | 1 | 1 |
| 78 | 4 | 16 |
| 81 | 7 | 49 |
| 85 | 11 | 121 |
| 93 | 19 | 361 |
| Total | 0 | 1,072 |
Now finish the calculation both ways:
- Population variance = 1,072 ÷ 10 = 107.2, so σ = √107.2 = 10.35 marks.
- Sample variance = 1,072 ÷ 9 = 119.11, so s = √119.11 = 10.91 marks.
The calculator gives the same: sample standard deviation 10.9138, population standard deviation 10.3537, range 37.
A shortcut for the variance
For a population, the variance also equals the mean of the squares minus the square of the mean. Here the squares of the marks add up to 55,832, so the mean of the squares is 5,583.2. Subtract 74² = 5,476 and you get 107.2 again. This saves time with whole-number data, but when the mean is a long decimal, round it too early and the answer goes wrong. Keep full precision or use the step-by-step method.
What variance is and why we take the square root
Variance is the average squared deviation. It is useful in further statistics because variances of independent quantities add up neatly. Its drawback is the unit: our marks example has a variance of 107.2 "squared marks", which means nothing to a student or parent.
Taking the square root brings the figure back to the original unit. A standard deviation of 10.35 marks is easy to picture: a typical student in this test scored about 10 marks above or below the class average of 74.
Sample vs population standard deviation: n or n − 1?
Use the population formula (divide by n) when your data covers every member of the group you care about. If a teacher wants to describe the spread of marks in this one class, and only this class, the 10 students are the whole population.
Use the sample formula (divide by n − 1) when your data is a sample used to estimate a bigger group. If those 10 students were picked to estimate how all Class 10 students in a district performed, you want s.
The reason is known as Bessel's correction. A sample's own mean always sits in the middle of that sample, so the deviations from it are slightly smaller than deviations from the true population mean would be. Dividing by n − 1 instead of n makes up for that and gives an unbiased estimate of the population variance.
The difference fades as the sample grows. The ratio s ÷ σ for the same data is √(n ÷ (n − 1)):
| Number of values (n) | s is larger than σ by a factor of | Difference |
|---|---|---|
| 5 | 1.1180 | 11.8% |
| 10 | 1.0541 | 5.4% |
| 30 | 1.0171 | 1.7% |
| 100 | 1.0050 | 0.5% |
If you are unsure which one a textbook or assignment wants, check whether it uses σ or s in the answer. For real-world data, the sample version is the usual default.
Comparing two classes with the same average
Averages hide a lot. Here is a second section that sat the same test: 70, 71, 72, 73, 74, 74, 75, 76, 77, 78. Its total is also 740, so its mean is also 74.
| Section A | Section B | |
|---|---|---|
| Mean | 74 | 74 |
| Range | 37 (56 to 93) | 8 (70 to 78) |
| Sample standard deviation | 10.91 | 2.58 |
| Coefficient of variation | 14.75% | 3.49% |
Section B performed very evenly. Section A has some students who need help and some who are well ahead. A teacher planning revision would treat them quite differently, and only the standard deviation shows why.
Standard deviation treats every value equally. If your marks come with different weights, say an internal assessment worth 30% and a final exam worth 70%, work out the centre with the weighted average calculator instead of a plain mean: 72 and 85 weighted 30:70 give 81.1, not 78.5.
The 68-95-99.7 rule for normal data
When data follows a normal (bell-shaped) distribution, the standard deviation tells you how much of it lies near the mean:
| Range | Share of values inside it |
|---|---|
| Mean ± 1 standard deviation | 68.27% |
| Mean ± 1.96 standard deviations | 95.00% |
| Mean ± 2 standard deviations | 95.45% |
| Mean ± 3 standard deviations | 99.73% |
Applied to Section A (mean 74, s = 10.91), about 68% of marks would fall between 63.09 and 84.91, and about 95% between 52.17 and 95.83, if the marks were normally distributed. In fact 6 of the 10 marks fall in the first band and all 10 in the second. Ten values are far too few to test a bell curve, so read the rule as a description of large, roughly symmetrical data sets.
The same idea gives the z-score, the number of standard deviations a value sits from the mean: z = (x − mean) ÷ standard deviation. The top mark of 93 has z = (93 − 74) ÷ 10.91 = 1.74. To see where a mark stands in the actual list rather than in a theoretical curve, use the percentile calculator.
Coefficient of variation: comparing spread on different scales
A standard deviation of 3.5 marks sounds smaller than 10.9 marks, but not if the first comes from a 25-mark quiz. The coefficient of variation (CV) puts both on the same footing:
CV = standard deviation ÷ mean × 100
A quiz out of 25 with a mean of 18 and a standard deviation of 3.5 has a CV of 3.5 ÷ 18 × 100 = 19.44%. That is relatively more spread out than Section A's unit test at 14.75%, even though its standard deviation is far smaller in marks.
Use CV only for data measured from a true zero, such as marks, heights, prices or times. It gives misleading results when the mean is close to zero, or for values like temperatures in °C, where zero is arbitrary.
STDEV.S vs STDEV.P in Excel and Google Sheets
Spreadsheets have both versions built in. If the marks are in cells B2 to B11, =STDEV.S(B2:B11) returns 10.9138 and =STDEV.P(B2:B11) returns 10.3537.
| Function | Divides by | Use when |
|---|---|---|
STDEV.S | n − 1 | Your data is a sample of a bigger group |
STDEV.P | n | Your data is the whole population |
STDEV (older) | n − 1 | Same as STDEV.S, kept for old files |
STDEVP (older) | n | Same as STDEV.P |
VAR.S / VAR.P | n − 1 / n | The variance instead of the standard deviation |
Scientific calculators label the two results σx (or σn) for the population figure and sx (or σn−1) for the sample figure. If your answer is slightly off from the textbook, you have probably used the other one.
Frequently asked questions
What is a good standard deviation?
There is no universal good value, because it depends on the scale of the data. Compare it with the mean using the coefficient of variation, or compare it with the standard deviation of similar data, such as last year's class.
Can standard deviation be negative?
No. It is the square root of an average of squares, so the smallest it can be is 0, which happens only when every value is the same.
Why do we divide by n − 1 for a sample?
Deviations from a sample's own mean are slightly too small on average. Dividing by n − 1 corrects this, so the sample variance becomes an unbiased estimate of the population variance.
Is standard deviation the same as variance?
No. Variance is the average squared deviation; standard deviation is its square root. Standard deviation is in the same unit as the data, which makes it easier to interpret.
What does a standard deviation of 10 marks mean?
A typical student scored about 10 marks above or below the class average. If the marks are roughly bell-shaped, around two-thirds of students are within 10 marks of the mean.
Should I use STDEV.S or STDEV.P for my class marks?
Use STDEV.P if you only want to describe that one class. Use STDEV.S if the class is a sample you are using to say something about a larger group of students.
- #standard deviation formula
- #sample vs population standard deviation
- #how to calculate standard deviation
- #variance
- #stdev.s vs stdev.p