All topics
Foundational

Statistics · one number for how spread out things are

Standard Deviation Calculator

Paste a column of numbers and the calculator below gives the mean, the variance and both flavours of standard deviation, then plots every value so you can see the spread it is measuring.

Click to begin

Explained like you're twelve. Explained like you've just finished school. Explained like you're at university.

By . Last updated .

Statistics · Pearson, 1894

The average tells you where the numbers sit. This tells you how far they wander.

Standard deviation calculator

Sample standard deviation \(s = \sqrt{\dfrac{\sum (x_i - \bar{x})^2}{n-1}}\), population standard deviation \(\sigma = \sqrt{\dfrac{\sum (x_i - \mu)^2}{n}}\). Use \(s\) when your numbers are a sample of something bigger, \(\sigma\) when they are the whole group.

Count n
Mean
Sample SD (s), ÷ n − 1
Population SD (σ), ÷ n
Variance (s²)
Range

Each dot is one of your values. The vertical line is the mean, the inner band is one standard deviation either side of it and the outer band is two. For data with a roughly normal shape, about two thirds of the dots land in the inner band and about nineteen in twenty land in the outer one.

What is standard deviation?

Two classes both average 70 in a test. In the first, nearly everyone scored between 67 and 73. In the second, half the class scored 45 and the other half scored 95. Same average, completely different stories, and the average alone cannot tell them apart.

Standard deviation is the number that does tell them apart. It answers a simple question: on average, how far from the middle does a value sit? A small standard deviation means the numbers huddle close together. A big one means they are scattered.

To work it out you find the average first. Then you measure how far each number is from that average, square those distances so nothing cancels out, take the average of the squares, and finally undo the squaring with a square root. That last step matters, because it puts the answer back into the same units as your data. Marks, centimetres, seconds, whatever you started with.

The calculator at the top does all of that as you type. Try the outlier example: one strange value drags the mean up a little and blows the standard deviation up a lot, which is a useful reminder that a single odd number can dominate both.

How do you calculate standard deviation?

Start with the mean, \(\bar{x} = \frac{1}{n}\sum x_i\). For each value take its deviation from the mean, \(x_i - \bar{x}\), and square it. The deviations always sum to zero, which is exactly why we square before adding. The average of those squares is the variance, and its square root is the standard deviation.

\[ s = \sqrt{\frac{1}{n-1}\sum_{i=1}^{n}(x_i - \bar{x})^2} \qquad \sigma = \sqrt{\frac{1}{n}\sum_{i=1}^{n}(x_i - \mu)^2} \]

The two formulas differ only in the divisor, and the choice is about what your numbers represent. If you have measured every member of the group you care about, use \(n\) and call it \(\sigma\). If your numbers are a sample standing in for a larger population, use \(n-1\) and call it \(s\). Dividing by the smaller number makes the answer slightly larger, which is the point: a sample tends to underestimate the true spread, and this correction compensates.

Variance and standard deviation carry the same information, but variance is in squared units, so a spread of marks comes out in "marks squared", which means nothing to anyone. Standard deviation is the one you report, because it is in the units of the data and can be compared directly to the mean.

The practical payoff is the rough rule for bell-shaped data: roughly 68% of values fall within one standard deviation of the mean, roughly 95% within two, and roughly 99.7% within three. That is why a result described as "three sigma" sounds impressive, and why standard deviation, not range, is the unit scientists use to say how surprising a measurement is.

Sample versus population, and why we divide by n − 1

Variance as a second moment

For a random variable \(X\), the variance is \(\operatorname{Var}(X) = E[(X - \mu)^2] = E[X^2] - \mu^2\), the second central moment, and \(\sigma = \sqrt{\operatorname{Var}(X)}\). Writing it this way makes its properties immediate: variance is not linear but scales quadratically, \(\operatorname{Var}(aX + b) = a^2\operatorname{Var}(X)\), and for independent variables it simply adds, \(\operatorname{Var}(X+Y) = \operatorname{Var}(X) + \operatorname{Var}(Y)\). That additivity is why standard deviations combine in quadrature, \(\sqrt{\sigma_1^2 + \sigma_2^2}\), and it is the reason the standard error of a mean of \(n\) independent observations shrinks as \(\sigma/\sqrt{n}\).

Why n − 1: Bessel's correction

The sample mean is itself estimated from the data, so the deviations \(x_i - \bar{x}\) are measured from the point that minimises their sum of squares. They are therefore systematically too small, and \(\frac{1}{n}\sum(x_i-\bar{x})^2\) is a biased estimator of \(\sigma^2\), low by a factor \((n-1)/n\). Dividing by \(n-1\), the residual degrees of freedom left after fitting one parameter, makes the variance estimator unbiased. Note the subtlety: \(s^2\) is unbiased for \(\sigma^2\), but \(s\) is still biased low for \(\sigma\), because the square root is concave and Jensen's inequality bites. The bias is small and usually ignored, but it is not zero.

Where it is the wrong summary

Standard deviation inherits the fragility of squaring. A single point at distance \(d\) contributes \(d^2\), so outliers dominate, and the breakdown point of \(s\) is zero: one arbitrarily bad value can send it anywhere. Robust alternatives such as the interquartile range or the median absolute deviation exist for that reason. Worse, for heavy-tailed distributions the population variance may not exist at all. The Cauchy distribution has no finite variance, and a sample standard deviation computed from Cauchy data does not converge to anything as \(n\) grows, it just keeps jumping. Reporting \(\bar{x} \pm s\) quietly assumes a distribution where those two numbers actually summarise the shape.

Computing it without losing precision

The algebraically tidy form \(\sum x_i^2 / n - \bar{x}^2\) is numerically dangerous: for data with a large mean and small spread it subtracts two nearly equal large numbers and can even return a negative variance. Welford's online algorithm updates the mean and the sum of squared deviations in a single pass with far better conditioning, and is what statistical libraries use. The calculator above takes the safe route of computing the mean first, then accumulating the squared deviations directly.

Related: The Normal Distribution · Bayes' Theorem · or go back to all topics.

Sources