Standard Deviation Calculator
Sample and population side by side in one standard deviation calculator, because dividing by n when you meant n-1 understates the spread and nobody notices.
Sample standard deviation
- Working SS is the sum of squared deviations from the mean of 5.
- s = sqrt(SS / (n - 1)) = sqrt(32 / 7) = sqrt(4.5714) = 2.1381
- Sample variance
- 4.5714
- Count
- 8
- Mean Sum of 40 over 8 values.
- 5
- Median The average of the two middle values.
- 4.5
- Mode
- 4
- Range
- 7 (2 to 9)
- If this were the whole population Dividing by n instead of n-1 gives 2, which is 6.5% smaller. Use it only when these numbers are every case you care about, not a sample from something larger.
- 2
- Quartiles Interquartile range 2: the middle half of the data. Unlike the standard deviation, it is barely affected by an extreme value.
- Q1 4, median 4.5, Q3 6
- Outliers By the 1.5 x IQR rule: anything below 1 or above 9.
- none
- Z-score of 9 1.87 standard deviations above the mean. If the data were normally distributed, about 96.9% of values would fall below it.
- 1.871
- Standard error of the mean The standard deviation divided by the square root of n: how much the sample mean itself would wobble between samples. Quartering it takes sixteen times the data.
- 0.7559
- Coefficient of variation Standard deviation as a share of the mean. The only one of these figures that compares the spread of two things measured in different units.
- 42.76%
- If the data were normal 95% within 0.7238 to 9.2762, and 99.7% within -1.4143 to 11.4143. That is the empirical rule, and it only holds for roughly bell-shaped data.
- 68% within 2.8619 to 7.1381
| Value | Deviation | Squared |
|---|---|---|
| 2 | -3 | 9 |
| 4 | -1 | 1 |
| 4 | -1 | 1 |
| 4 | -1 | 1 |
| 5 | 0 | 0 |
| 5 | 0 | 0 |
| 7 | 2 | 4 |
| 9 | 4 | 16 |
| Total | 0 | 32 |
- The deviations always sum to zero; that is what the mean is. Squaring them before averaging is what stops them canceling, and it is also why the standard deviation is in the same units as the data while the variance is in units squared.
- Non-numeric entries in the list are ignored rather than read as zero, so a header row pasted in with a column will not drag the mean down.
How the Standard Deviation Calculator works
Standard deviation measures how spread out a set of numbers is. The equation for standard deviation, with SS the sum of squared deviations from the mean, Σ(x - mean)², and n the count:
s = sqrt(SS / (n - 1)) for a sample, and σ = sqrt(SS / n) for a population.
For 2, 4, 4, 4, 5, 5, 7, 9: the mean is 5, the deviations are -3, -1, -1, -1, 0, 0, 2, 4, and their squares sum to 32. Divided by 8 that is a variance of 4 and a standard deviation of exactly 2.
The squaring is not arbitrary. The deviations always sum to zero (that is what makes the mean the mean), so averaging them directly gives 0 for every dataset. Squaring removes the signs, and the square root at the end puts the answer back into the units of the original data. Variance, the figure before the square root, is in units squared, which is why standard deviation is the one that gets quoted.
Now the divisor. Dividing by n gives the POPULATION standard deviation and is right when your numbers are every case you care about: the scores of all thirty students in a class, when the class is the whole question. Dividing by n-1 gives the SAMPLE standard deviation and is right when your numbers are a sample from something larger that you want to say something about.
The n-1 is Bessel's correction, and the reason for it is subtle. You are measuring spread around the sample mean, but the sample mean is itself computed from the same data, and it necessarily sits closer to those particular values than the true population mean does. So the squared deviations come out too small, systematically, and dividing by n would carry that understatement through. Dividing by n-1 corrects it exactly.
On the eight values above, the two answers are 2.00 and 2.14, about 7% apart. On ten values the gap is around 5%, on a hundred it is half a percent, and on a thousand it is negligible. So it matters most on small datasets, which is exactly where most people are working. There the difference is small enough to pass unnoticed while being large enough to change a conclusion. Most software defaults to the sample version; spreadsheet functions split, with STDEV.S and STDEV.P in Excel being the two.
What standard deviation is bad at is data with an extreme value in it. It squares the deviations, so a single outlier dominates: adding one value of 100 to the list above takes the standard deviation from 2.14 to 32.6. The interquartile range (the width of the middle half of the data) barely moves, which is why box plots and the 1.5 x IQR outlier rule exist and why median and IQR are the better summary for skewed data.
The empirical rule is the thing that makes a standard deviation interpretable: in roughly bell-shaped data, about 68% of values fall within one standard deviation of the mean, 95% within two and 99.7% within three. The caveat matters: it is a property of the normal distribution, not of data in general, and income, waiting times and most things with a hard lower bound are not remotely normal.
Standard Deviation Calculator FAQ
What is the difference between sample and population standard deviation?
The divisor. Population divides the summed squared deviations by n; sample divides by n-1. Use the population version when your numbers are every case you care about, and the sample version when they are a sample from something larger. On small datasets the two can differ by 5 to 7%.
Why divide by n-1 for a sample?
Because the spread is measured around the sample mean, which is computed from the same data and therefore sits closer to those values than the true mean does. The squared deviations come out systematically too small, and dividing by n-1 rather than n corrects for exactly that bias.
What is the difference between variance and standard deviation?
Standard deviation is the square root of variance. Variance is in the square of the original units. If your data is in dollars, variance is in dollars squared, which means nothing to anybody. Taking the root returns it to dollars, which is why standard deviation is what gets reported.
Is standard deviation affected by outliers?
Heavily, because the deviations are squared before averaging. Adding a single value of 100 to the list 2, 4, 4, 4, 5, 5, 7, 9 takes the standard deviation from 2.14 to about 32.6. For skewed data with extreme values, the median and interquartile range describe the distribution far better.
More Standard Deviation Calculator pages
Related calculators
- NPS Calculator
- Percentage Calculator
- Ratio Calculator
- GPA Calculator
- Probability Calculator
- Random Number Generator
- Gini Coefficient Calculator
- Linear Regression Calculator
- A/B Test Calculator
- Test Statistic Calculator
- Box Plot Generator
- Hypergeometric Calculator
- Poisson Distribution Calculator
- Z Score Calculator
- Normal Distribution Calculator
- Confidence Interval Calculator
- Sample Size Calculator
- Average Calculator
- Percentile Calculator
- Correlation Coefficient Calculator
- Chi Square Calculator
- T Test Calculator