How to calculate standard deviation step by step

Standard deviation measures how spread out a set of values is around its mean, or average. It answers a question the mean cannot: are the observations consistent, or are some far from the centre? If every value equals the mean, the standard deviation is zero; larger differences generally produce a larger result.

A careful method prevents two common errors: dividing by the wrong number and forgetting to take the square root at the end. The process also shows why a result can be sensitive to unusual values, making it easier to decide whether a data set needs further checking.

The worked example below uses six weekly study-hour totals recorded by students in an Australian Year 11 class. The same calculations work for temperatures in Melbourne, travel times in Sydney, prices in Australian dollars, or assessment marks used for an ATAR in New South Wales.

What standard deviation measures

The mean provides the centre of a data set, while standard deviation describes its variability. A small result means the observations cluster near that centre. A larger result means they are more dispersed. Standard deviation uses squared differences from the mean, so values on opposite sides of the average still contribute to the spread.

For example, two classes might both have an average assessment mark of 70 per cent. If their marks are 68, 70 and 72, the values are tightly grouped. Another class with marks of 40, 70 and 100 has the same mean but much greater variability. The mean alone would not reveal this difference.

Choosing between population and sample

A population calculation describes every observation in the group being studied. A sample calculation uses a smaller group to estimate variability in a wider population. The formulas differ mainly in their denominator: population standard deviation divides by N, while sample standard deviation divides by n − 1.

The n − 1 adjustment accounts for the fact that a sample mean is an estimate of the population mean. For the study-hour example, the six students constitute the entire class, so the population calculation is appropriate. If those students were selected to represent Australian students more generally, the sample calculation would be relevant.

An Australian Bureau of Statistics Census extract covering the full enumerated population would also be treated as population data for this purpose. By contrast, surveying one class and using it to estimate variability among all senior students would call for the sample method.

Preparing the data

Begin by recording every value in a clear list and checking that they use consistent units. The study-hour data are:

2, 3, 4, 5, 6, 7 hours

The values should represent the same thing over the same period. Mixing daily totals with weekly totals, or amounts in dollars with amounts in cents, would make the calculation meaningless.

Check unusual entries before calculating. For instance, a recorded supermarket expense of $42 among weekly spends mostly between $20 and $30 could be correct, but it should be verified rather than silently removed. Prices and spending patterns vary between Coles and Woolworths and across Australian cities, so an unusual value may reflect genuine local variation. A genuine outlier still affects standard deviation.

Calculating the mean

Add every observation and divide by the number of observations:

x̄ = (Σx) / n

For the six study-hour totals, the sum is:

2 + 3 + 4 + 5 + 6 + 7 = 27

There are six values, so the mean is:

x̄ = 27 / 6 = 4.5 hours

This is the balancing point of the data set. Each observation will now be compared with 4.5, which is essential because standard deviation measures distances from the mean rather than distances from zero.

Finding variance and taking the square root

Subtract the mean from each value, then square each result. The squared deviations are shown below.

Study hours Deviation from 4.5 Squared deviation
2 −2.5 6.25
3 −1.5 2.25
4 −0.5 0.25
5 0.5 0.25
6 1.5 2.25
7 2.5 6.25

Squaring prevents positive and negative deviations from cancelling each other. If a measurement or mean contains a square root, expand any product involving a sum before continuing; the guide to distributing radical terms explains how to do this while preserving the value.

For the population calculation, divide the sum of squared deviations by the number of values:

Variance = 17.5 / 6 ≈ 2.9167

Variance is expressed in squared hours, so take its positive square root:

σ = √2.9167 ≈ 1.7078

Rounded to two decimal places, the population standard deviation is 1.71 hours.

For a sample calculation, divide by n − 1 instead:

Sample variance = 17.5 / 5 = 3.5

Sample standard deviation = √3.5 ≈ 1.8708

This gives 1.87 hours, showing how the chosen method changes the final result.

Interpreting and applying the result

A population standard deviation of 1.71 hours describes the study-hour data in practical terms: the observations lie, on average, about 1.7 hours from the mean of 4.5 hours, measured as a root-mean-square distance. It does not mean every student studied exactly 1.71 hours away from the average. In a roughly bell-shaped distribution, most values tend to fall within one or two standard deviations of the mean, but a small class may not follow that pattern closely.

When comparing measurements with different units, convert them first or use a relative measure. For example, standard deviations measured in degrees Celsius cannot be compared directly with those measured in millimetres of rain. The coefficient of variation divides standard deviation by the mean and multiplies by 100; here, 1.71 ÷ 4.5 × 100 ≈ 38%. This expresses variability relative to the size of the average.

Before relying on a result, identify whether the data represent a population or sample, retain unrounded values through the calculation, and report the answer in the original units. A defensible standard deviation has a clearly stated method, accurate intermediate arithmetic and a meaning that can be explained in ordinary language.