Standard Deviation Calculator: Sample vs Population, Step by Step
By FindMySum · Last reviewed
A standard deviation calculator measures how spread out a set of numbers is around its mean. A small standard deviation means the values cluster tightly; a large one means they are scattered. It is expressed in the same unit as the data, which makes it easier to interpret than variance, its square. This calculator gives both the sample and the population versions of each, the mean, the coefficient of variation and a table showing every value's deviation. This article walks through the formulas, explains why the sample version divides by n − 1, works through the default dataset step by step, and covers what standard deviation can and can't tell you.
The formulas
Everything starts from the mean, the sum of the values divided by how many there are:
mean = Σx ÷ n
For each value, the deviation is its distance from the mean, x − mean. Deviations above and below the mean always add up to zero, so they are squared before being combined. The total is the sum of squared deviations, often written SS.
From there, the two versions differ only in what SS is divided by:
| Quantity | Population (σ) | Sample (s) |
|---|---|---|
| Variance | σ² = SS ÷ n | s² = SS ÷ (n − 1) |
| Standard deviation | σ = √(SS ÷ n) | s = √(SS ÷ (n − 1)) |
| Spreadsheet function | VAR.P, STDEV.P | VAR.S, STDEV.S |
Taking the square root at the end returns the result to the original unit: if the data are in centimetres, the variance is in square centimetres and the standard deviation is back in centimetres.
Why the sample version divides by n − 1
When your data are a sample from a larger group, the true mean of that group is unknown, so the deviations are measured from the sample's own mean. The sample mean is, by construction, the point that makes the sum of squared deviations as small as possible, so measuring from it understates the spread around the real mean. Dividing by n − 1 instead of n corrects that bias in the variance. This adjustment is known as Bessel's correction, and the n − 1 is the number of degrees of freedom: once the mean is fixed, only n − 1 of the deviations are free to vary, because the last one must make them sum to zero.
Use the population formulas when your data are the entire group you care about, such as every employee in a small company or every reading a sensor produced in a test. Use the sample formulas when the data stand in for a larger group, which is the usual situation in research, surveys and quality control. The NIST/SEMATECH handbook, like most statistics texts, uses the n − 1 version as its default definition of the sample standard deviation.
Worked example: the calculator's defaults
The calculator opens with eight values: 2, 4, 4, 4, 5, 5, 7, 9.
- Mean. The sum is 40, and 40 ÷ 8 = 5.
- Deviations. Subtract 5 from each value: −3, −1, −1, −1, 0, 0, 2, 4.
- Squared deviations. 9, 1, 1, 1, 0, 0, 4, 16.
- Sum of squares. 9 + 1 + 1 + 1 + 0 + 0 + 4 + 16 = 32.
- Population variance. 32 ÷ 8 = 4, so the population standard deviation is √4 = 2.
- Sample variance. 32 ÷ 7 = 4.57142857143, so the sample standard deviation is its square root, 2.1380899353.
The calculator also reports a range of 7 (from 2 to 9) and a coefficient of variation of about 42.76%, which is the sample standard deviation divided by the mean, times 100.
Reading the example
With a mean of 5 and a population standard deviation of 2, six of the eight values (4, 4, 4, 5, 5, 7) lie within one standard deviation of the mean, between 3 and 7. The value 9 sits exactly two standard deviations above, and 2 sits one and a half below. The largest squared deviation, 16 from the value 9, contributes half of the entire sum of squares on its own, a reminder of how strongly squaring weights the values furthest from the mean.
The sample figure is about 7% larger than the population figure. That gap is the n − 1 correction at work, and it is worth noticing with small datasets like this: with eight values, the choice between the two formulas changes the answer more than most rounding ever will.
Standard error of the mean
The calculator also reports the standard error of the mean, the sample standard deviation divided by the square root of the count: SE = s ÷ √n. It answers a different question from the standard deviation. The standard deviation says how far a typical value sits from the mean; the standard error says how far the sample mean is likely to sit from the true mean of everything you could have measured. For the data 2, 4, 4, 4, 5, 5, 7, 9 it is 2.138 ÷ √8 ≈ 0.756. Because of the square root, four times as much data halves the standard error, and roughly 95% of sample means fall within 1.96 standard errors of the true mean, which is where the usual confidence interval comes from.
What standard deviation doesn't tell you
It assumes the mean is a sensible centre. For skewed data, such as incomes or house prices, a few very large values pull the mean and inflate the standard deviation. The median and interquartile range describe such data better.
It is sensitive to outliers. Because deviations are squared, one wild value can dominate the result. Check unusual values before you report a standard deviation.
It says nothing about shape. Two datasets can share a mean and standard deviation yet look completely different, one bell-shaped and one split into two clusters. The "68% within one standard deviation" rule only holds for roughly normal data.
Small samples give unstable estimates. With five or ten values, the sample standard deviation can differ substantially from the true spread. Treat it as a rough guide until you have more data.
It isn't a measure of error by itself. For the precision of an average, use the standard error (the standard deviation divided by √n, shown with the results), and for intervals, a confidence interval method, which the calculator doesn't compute; nor does it handle grouped or weighted data.
Using the result
Report the standard deviation together with the mean and the number of values, for example "mean 5, SD 2.14, n = 8", and say whether it is the sample or population figure. The average calculator adds the median and mode, which help when the data are skewed. When you round the result, the significant figures calculator can help match it to the precision of your measurements; a common convention is to report the standard deviation to two significant figures and the mean to the same decimal place. To test how the formulas behave, generate a large set of whole numbers with the random number generator and paste them in: for a uniform draw from 1 to 100 the standard deviation should settle near 28.9.
More questions
What share of values fall within one or two standard deviations of the mean?
For data that follow a normal (bell-shaped) distribution, about 68% of values lie within one standard deviation of the mean, about 95% within two and about 99.7% within three. For data of any shape, Chebyshev's inequality still guarantees at least 75% within two standard deviations and at least 89% within three. Check a histogram before relying on the normal figures.
What is the difference between standard deviation and standard error?
Standard deviation describes how spread out the individual values are. The standard error of the mean describes how precisely the sample mean estimates the true mean, and equals the sample standard deviation divided by the square root of n. For the default dataset that is 2.138 ÷ √8, about 0.76. Standard error shrinks as you collect more data; standard deviation does not.
How much can one outlier change the result?
A lot, because deviations are squared. Change the 9 in the default dataset to 29 and the calculator's sample standard deviation jumps from about 2.14 to about 8.80, while the mean moves only from 5 to 7.5. If a single value drives the result, check it for a typing or measurement error, and consider reporting the median and interquartile range alongside.
How do I use the standard deviation to tell whether a value is unusual?
Convert it to a z-score: subtract the mean and divide by the standard deviation. In the default dataset, using the population figure, the value 9 has z = (9 − 5) ÷ 2 = 2, so it sits two standard deviations above the mean. Values beyond about 2 or 3 in either direction are often flagged for a closer look, though with small datasets that rule is rough.
Does collecting more data make the standard deviation smaller?
Not in general. More data makes the estimate of the standard deviation more reliable, but the spread of the values themselves stays about the same. Entering the default dataset twice (16 values) leaves the population figure at exactly 2 and moves the sample figure only from about 2.138 to about 2.066, because the n − 1 correction matters less as n grows.
How many values do I need to halve the standard error?
Four times as many. The standard error is s ÷ √n, so it falls with the square root of the count: going from 25 to 100 measurements halves it, while the standard deviation of the values stays about the same.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.