How to Calculate Standard Deviation
Two cities both have an average daily high of 20°C. In one, the temperature barely moves from 18°C to 22°C all year. In the other, it swings from 0°C in winter to 40°C in summer.
The average is identical. The experience of living there is completely different. The number that captures that difference is the standard deviation, a measure of how spread out values are around their mean.
It's one of the most important numbers in statistics, science, finance and quality control. Here's exactly how to calculate it.
You Divide by n − 1, Not n, for a Sample
When calculating the standard deviation of a sample, the standard formula divides by n − 1 instead of n. It looks like a typo. It's deliberate.
A sample's values are, on average, closer to their own mean than to the true population mean. Dividing by n would systematically underestimate the spread. Dividing by n − 1, a fix called Bessel's correction after German astronomer Friedrich Bessel, removes that bias from the variance.
The Formula
Population standard deviation (you have every value):
σ = √( Σ(xᵢ − μ)² / N )
Sample standard deviation (your data is a sample from a larger group):
s = √( Σ(xᵢ − x̄)² / (n − 1) )
Both follow the same five steps.
Step-by-Step Example
Data: 2, 4, 4, 4, 5, 5, 7, 9
Step 1: Find the Mean
Mean = (2 + 4 + 4 + 4 + 5 + 5 + 7 + 9) ÷ 8 = 40 ÷ 8 = 5
Step 2: Subtract the Mean From Each Value
2 − 5 = −3
4 − 5 = −1 (three times)
5 − 5 = 0 (twice)
7 − 5 = 2
9 − 5 = 4
Step 3: Square Each Deviation
(−3)² = 9
(−1)² = 1, 1, 1
0² = 0, 0
2² = 4
4² = 16
Squaring makes every deviation positive, so values above and below the mean don't cancel out. See the square numbers list.
Step 4: Add Them and Divide
Sum of squares = 9 + 1 + 1 + 1 + 0 + 0 + 4 + 16 = 32
Population variance: 32 ÷ 8 = 4
Sample variance: 32 ÷ 7 ≈ 4.571
Step 5: Take the Square Root
Population standard deviation σ = √4 = 2
Sample standard deviation s = √4.571 ≈ 2.138
The result is back in the original units, which is why we take the square root of the variance. Check roots with the square roots list.
What Standard Deviation Tells You: The 68–95–99.7 Rule
For data that follows a normal distribution (a bell curve):
| Range | Share of data |
|---|---|
| Within 1 standard deviation of the mean | ≈ 68% |
| Within 2 standard deviations | ≈ 95% |
| Within 3 standard deviations | ≈ 99.7% |
If adult heights in a population have a mean of 170 cm and a standard deviation of 7 cm, about 95% of people are between 156 cm and 184 cm. Look up exact values in the standard normal table.
Population or Sample?
| Use population (÷ N) when | Use sample (÷ n − 1) when |
|---|---|
| You have data for the entire group | Your data represents a larger group |
| Example: every employee's salary at your company | Example: a survey of 500 voters |
In practice, most real-world data is a sample. Spreadsheets reflect both: in Excel, STDEV.P is the population version and STDEV.S the sample version.
An Insider Reference: Pearson and Six Sigma
The term "standard deviation" was introduced by English statistician Karl Pearson in the 1890s. He founded the world's first university statistics department at University College London in 1911.
A century later, the idea became a business philosophy. In 1986, Bill Smith, an engineer at Motorola, developed Six Sigma, a quality-improvement method named after σ, the symbol for standard deviation. Its goal is processes so consistent that defects are extremely rare, with the famous target of 3.4 defects per million opportunities. Companies like General Electric later adopted it widely.
Two Concepts Worth Knowing
Variance
The variance is the average squared deviation from the mean: the standard deviation squared. It's mathematically convenient (variances of independent variables add), but it's in squared units.
Coefficient of Variation
The coefficient of variation divides the standard deviation by the mean. It lets you compare spread between datasets on different scales, like the variability of mouse weights versus elephant weights.
Quick Answer: How Do You Calculate Standard Deviation?
Find the mean, subtract it from each value, square each difference, add the squares, divide by N for a population or n − 1 for a sample, and take the square root. For 2, 4, 4, 4, 5, 5, 7, 9, the mean is 5, the sum of squares is 32, and the population standard deviation is √(32/8) = 2.
Try Them Yourself
- Statistics Formulas: variance and standard deviation formulas
- Z-Score Calculator: measure values in standard deviations
- Standard Normal Table: the 68–95–99.7 rule in detail
- Square Roots List: the final step
- How to Calculate an Average: step 1 of every standard deviation
- How to Calculate a Z-Score: put standard deviation to work
Record the time you wake up for 7 days. Calculate the mean and the sample standard deviation. A small standard deviation means a consistent routine.