Standard Deviation Calculator
Enter your data to get the sample and population standard deviation, with the full working: deviations, squares, variance and square root.
Step by step
- Mean: add the values and divide by the count: x̄ = 40 ÷ 8 = 5
- Subtract the mean from each value and square the result (table below)
- Add the squares: Σ(x − x̄)² = 32
- Divide by n − 1 = 7: variance s² = 32 ÷ 7 = 4.5714
- Take the square root: s = √4.5714 = 2.1381
| x | x − x̄ | (x − x̄)² |
|---|---|---|
| 2 | −3 | 9 |
| 4 | −1 | 1 |
| 4 | −1 | 1 |
| 4 | −1 | 1 |
| 5 | 0 | 0 |
| 5 | 0 | 0 |
| 7 | 2 | 4 |
| 9 | 4 | 16 |
| Count (n) | 8 |
|---|---|
| Sum | 40 |
| Mean | 5 |
| Median | 4.5 |
| Mode | 4 (appears 3 times) |
| Minimum | 2 |
| Maximum | 9 |
| Range | 7 |
| Q1 (first quartile) | 4 |
| Q3 (third quartile) | 6 |
| Interquartile range (IQR) | 2 |
| Sample standard deviation (s) | 2.1381 |
| Population standard deviation (σ) | 2 |
| Sample variance (s²) | 4.5714 |
| Population variance (σ²) | 4 |
| Standard error of the mean | 0.7559 |
| Coefficient of variation | 42.76% |
| Mean absolute deviation | 1.5 |
| Sum of squares (Σ(x − x̄)²) | 32 |
| Outliers (1.5 × IQR rule) | none |
Sorted data
2, 4, 4, 4, 5, 5, 7, 9
How it works
The calculator finds the mean, squares each value’s distance from it, averages those squares (dividing by n − 1 for a sample or N for a population) and takes the square root. For 2, 4, 4, 4, 5, 5, 7, 9 that gives σ = 2 and s ≈ 2.1381.
The symbols, a hand-worked example and the Excel functions are on the standard deviation formula page. For spread around the median instead, use the IQR calculator; to draw the data, the histogram maker.
Sample vs population
Dividing by n − 1 instead of n (Bessel’s correction) makes the sample variance an unbiased estimate of the population variance. If your numbers are a sample — a class, a survey, an experiment — use s. If they are the whole group you care about, use σ.
What is a “good” standard deviation?
It depends on the units and the mean. For roughly bell-shaped data about 68% of values fall within one SD of the mean and 95% within two (the empirical rule). To compare spreads of data with different means, use the coefficient of variation.
Frequently asked questions
How do you calculate standard deviation?
Subtract the mean from each value, square the results, add them, divide by n − 1 for a sample (or n for a population) and take the square root.
What is the difference between s and σ?
s is the sample standard deviation (divides by n − 1); σ is the population standard deviation (divides by N). s is slightly larger.
Can standard deviation be negative?
No. It is a square root of an average of squares, so it is 0 or positive. It is 0 only when all values are equal.
What is the standard deviation of 2, 4, 4, 4, 5, 5, 7, 9?
The population SD is 2 and the sample SD is about 2.1381.
Last reviewed November 2026. Results are rounded to 4 decimal places; all math runs in your browser.