Standard deviation explained: sample vs population, variance and worked examples
The standard deviation measures how far values typically sit from their mean. Two classes can both average 75% on a test, but if one class has a standard deviation of 4 points and the other 15, the first is tightly bunched and the second has students far above and far below the average. Standard deviation is the most widely used measure of spread in science, finance, quality control and exam statistics.
This guide walks through the calculation by hand, explains when to divide by n and when by n − 1, and shows how the result relates to variance, the median and the interquartile range. The calculator above does the arithmetic exactly, using fractions, so the mean and variance carry no rounding error until the final square root.
How to use this tool
- Paste or type your numbers, separated by commas, spaces or new lines. Decimals and fractions are accepted.
- Choose Sample if the numbers are a sample from a larger group (the usual case), or Population if you have every value.
- Press Solve step by step to see the mean, a deviations table, the sum of squares, both variances and standard deviations, and the median, quartiles, mode and range.
Key formulas
x̄ = Σx / nσ² = Σ(x − μ)² / Ns² = Σ(x − x̄)² / (n − 1)σ = √σ², s = √s²Σ(x − x̄)² = Σx² − (Σx)² / nz = (x − x̄) / sWorked examples
Find the population standard deviation of 2, 4, 4, 4, 5, 5, 7, 9.
- Mean: 40 / 8 = 5.
- Deviations: −3, −1, −1, −1, 0, 0, 2, 4. Squares: 9, 1, 1, 1, 0, 0, 4, 16.
- Sum of squares: 32. Population variance: 32 / 8 = 4.
- σ = √4 = 2.
population standard deviation of 2, 4, 4, 4, 5, 5, 7, 9Six plants grew 12, 15, 11, 18, 14 and 16 cm. Find the sample standard deviation.
- Mean: 86 / 6 = 43/3 ≈ 14.33 cm.
- Sum of squared deviations: 100/3 ≈ 33.33.
- Sample variance: (100/3) / 5 = 20/3 ≈ 6.667 cm².
- s = √(20/3) = 2√15/3 ≈ 2.58 cm.
Scores: 70, 85, 85, 90, 62, 78, 85, 94, 88.
- Sorted: 62, 70, 78, 85, 85, 85, 88, 90, 94. Mean: 737/9 ≈ 81.89.
- Median: 85 (the 5th value). Mode: 85. Range: 94 − 62 = 32.
- Quartiles from each half: Q1 = 74, Q3 = 89, so IQR = 15.
- Sample standard deviation: s = √(3739/36) ≈ 10.19.
Sample or population: which formula?
Use the population formula only when your data contains every member of the group you care about, such as the heights of all 28 students in one class when that class is all you are describing. Use the sample formula when your data stands in for something bigger, such as 28 students measured to estimate the heights of a whole school. In science, surveys and statistics courses the sample formula is the default.
Why n − 1? Deviations are measured from the sample mean, which is by construction the centre of your particular sample. That makes them slightly smaller on average than deviations from the true population mean. Dividing by n − 1 instead of n enlarges the variance just enough to remove that bias. With large samples the two answers are almost identical; with small samples the difference matters.
What a standard deviation tells you
For data that is roughly bell-shaped (normal), the empirical rule gives a quick picture of the spread. It does not apply to strongly skewed data or data with outliers.
- About 68% of values lie within 1 standard deviation of the mean.
- About 95% lie within 2 standard deviations.
- About 99.7% lie within 3 standard deviations.
Standard deviation compared with other measures of spread
| Measure | What it uses | Affected by outliers? |
|---|---|---|
| Range | Largest minus smallest value | Very strongly |
| Interquartile range (IQR) | Q3 − Q1, the middle 50% of the data | Hardly |
| Standard deviation | Every value’s distance from the mean | Yes, because distances are squared |
| Variance | The square of the standard deviation | Yes; it is also in squared units |
Common mistakes to avoid
- Dividing by n when the data is a sample. Calculators label the two buttons σx (population) and sx (sample).
- Forgetting to square the deviations. Plain deviations always add up to zero.
- Reporting the variance as if it were the standard deviation. Variance is in squared units (cm², $²).
- Rounding the mean before computing the deviations, which pushes the error into every later step.
- Applying the 68–95–99.7 rule to skewed data, such as incomes or waiting times.
Frequently asked questions
Can a standard deviation be negative?
What is the difference between variance and standard deviation?
What happens if I add a constant to every value?
Which Excel or Google Sheets function should I use?
What is a “good” standard deviation?
Related tools and guides
References
- OpenStax, Introductory Statistics 2e: Measures of the spread of the data
- NIST/SEMATECH e-Handbook of Statistical Methods
Educational content. Results are computed in your browser with standard double-precision arithmetic; double-check anything with legal, financial, medical, or safety consequences. Spotted an error? Tell us and we will correct it.