Standard Deviation and Variance Calculator
Standard deviation, variance and the coefficient of variation from one list — sample or population, the switch that changes all three.
Updated
8 numbers found. Commas, spaces or one per line all work.
Spread
2.138090s
Sample standard deviation of 8 values, dividing by 7.
- Variance
- 4.571429
- Mean
- 5
- Sum of squared deviations
- 32
- Count
- 8
- Divided by
- 7
- Range
- 7
- Standard error of the mean
- 0.755929
- Coefficient of variation
- 42.76%
The divisor is the whole difference between the two answers. Sample standard deviation divides the squared deviations by 8 − 1 = 7; the population form divides by 8. The sample figure is always the larger of the two, and it is the right one unless your list is genuinely every member of the group rather than a selection from it.
Spreadsheets encode the same split: STDEV.S is the sample form and STDEV.P is the population form. Reaching for the wrong one is the most common way this calculation goes wrong.
Advertisement
In short
Should I divide by n or n − 1 for standard deviation?
Divide by n − 1 when your numbers are a sample drawn from something larger, and by n only when they are the entire group. For 2, 4, 4, 4, 5, 5, 7, 9 the population figure is exactly 2 and the sample figure is 2.138.
Sample is the safer default: a list pasted into a calculator is almost never the whole population.
How to use the standard deviation and variance calculator
Standard deviation answers one question: how far, typically, do these numbers sit from their own average? A small figure means the values cluster; a large one means they scatter. It is in the same units as the data, which is why it is quoted more often than variance — variance is in units squared, and square pounds mean nothing to anybody.
The calculation has four steps and no judgement in any of them. Find the mean. Subtract it from every value and square each result, which removes the signs so that being above and below the mean both count as distance. Add those squares. Divide by a count, and take the square root. Only the fourth step has a decision in it, and that decision is the whole reason this page exists.
n − 1
Divisor for a sample
Bessel's correction
n
Divisor for a population
the entire group
2.138
Sample s for the classic set
where population σ is 2
Advertisement
Sample and population are not two flavours of the same thing. A population is every member of the group you are describing — all fourteen people in a department, every item produced in a batch. A sample is a selection from something larger, and the numbers are being used to estimate what that larger thing looks like. Almost everything pasted into a web calculator is a sample.
The correction matters most on small sets and fades on large ones. With four values, dividing by three instead of four raises the variance by a third. With four hundred, the difference is about an eighth of one percent and nothing downstream will notice. That is why the choice feels academic on big datasets and decides the answer on small ones.
- STDEV.S in Excel
- sample, divides by n − 1
- STDEV.P in Excel
- population, divides by n
- STDEV and STDEVP
- the older compatibility names for the same two
- A scientific calculator
- usually offers both, labelled s and σ
- This page
- sample by default, switchable
Google Sheets accepts all four spellings. Reaching for the wrong one is the most common way this calculation goes wrong, and nothing in the output will tell you it happened.
Start with the mean and the median
Standard deviation is measured around the mean, so it is worth knowing whether that mean is representative. The average page gives all three central figures together.
Open the average calculator →How much the sample and population divisors differ as the count grows, computed from the same sum of squared deviations each time.
| Values (n) | Sample divides by | Sample figure is larger by |
|---|---|---|
| 2 | 1 | 41.4% |
| 3 | 2 | 22.5% |
| 4 | 3 | 15.5% |
| 5 | 4 | 11.8% |
| 8 | 7 | 6.9% |
| 10 | 9 | 5.4% |
| 20 | 19 | 2.6% |
| 30 | 29 | 1.7% |
| 50 | 49 | 1.0% |
| 100 | 99 | 0.5% |
| 400 | 399 | 0.13% |
The textbook set, worked all the way through
The list 2, 4, 4, 4, 5, 5, 7, 9 appears in statistics teaching everywhere because its numbers come out clean. It sums to 40 across eight values, so the mean is exactly 5, and the squared deviations add to exactly 32. From there the two answers separate cleanly.
- Values
- 2, 4, 4, 4, 5, 5, 7, 9
- Mean
- 40 ÷ 8 = 5
- Squared deviations
- 9 + 1 + 1 + 1 + 0 + 0 + 4 + 16 = 32
- Population: 32 ÷ 8
- variance 4, σ = 2
- Sample: 32 ÷ 7
- variance 4.571, s = 2.138
- The gap
- 0.138, about 6.9 percent
Nothing about the data changed between those two lines. The only difference is the divisor, and it moves the answer by seven percent on eight values. On four values it would move it by fifteen.
One consequence worth stating plainly: the sample figure is always the larger of the two. Dividing by a smaller number gives a bigger result, every time, for any dataset. If your sample standard deviation ever comes out below the population one, the arithmetic went wrong somewhere.
Variance, and why anyone reports it
Variance is the step before the square root: the average squared deviation from the mean. It is in units squared, which is why it is rarely quoted to a general audience — square pounds and square seconds describe nothing anybody can picture. On the set worked above the population variance is exactly 4 while the standard deviation is 2, and only the second is in the same units as the data.
So why keep a quantity nobody can picture? Because variance is the one that adds up and standard deviation is not. Combine two independent sources of variation and their variances sum; their standard deviations do not. Every calculation that pools uncertainty — error propagation, portfolio risk, the analysis of variance itself — works in the squared domain and takes the square root only at the very end.
- Part A
- standard deviation 3, variance 9
- Part B
- standard deviation 4, variance 16
- Variances add
- 9 + 16 = 25
- Square root, once, at the end
- √25 = 5
- Adding the deviations instead
- 3 + 4 = 7
- The tempting answer
- 7 — forty percent too high
It is the Pythagorean relationship. What it actually needs is that the two sources be uncorrelated — independence is simply the usual way of guaranteeing that, and is the stronger condition. Where they do move together a covariance term joins the sum, and the combined figure can land anywhere between 1 and 7 for the same pair of deviations.
The divisor argument is identical for both quantities, because one is the square root of the other. Dividing by n − 1 rather than n corrects the variance, and the standard deviation inherits that correction along with a small residual bias of its own. Anything true of the sample variance on a list is true of the sample standard deviation on it.
What the number does not tell you
Standard deviation summarises spread and says nothing about shape. Two datasets with identical means and identical standard deviations can look completely different — one evenly scattered, the other clustered at two extremes with nothing in the middle. The single figure cannot distinguish them, and neither can variance.
That is not hypothetical, and the twin can be built from the set worked above. Replace 2, 4, 4, 4, 5, 5, 7, 9 with 3, 3, 3, 3, 7, 7, 7, 7 and every summary statistic survives intact: eight values, a total of 40, a mean of 5, squared deviations of 32, a population σ of exactly 2 and a sample s of 2.138.
- Set A
- 2, 4, 4, 4, 5, 5, 7, 9
- Set B
- 3, 3, 3, 3, 7, 7, 7, 7
- Mean, both
- 40 ÷ 8 = 5
- Squared deviations, both
- 32
- Population σ, both
- 2
- Sample s, both
- 2.138
- What separates them
- nothing the calculator reports
A holds five distinct values and contains its own mean twice. B holds two, four apart, and contains no 5 at all. Every figure on this page is identical for the pair.
The medians do not rescue it either, though they do hint. A has a median of 4.5 against a mean of 5; B has a median of exactly 5 while not one of its eight observations sits there. Any statistic that cannot separate these two is describing spread rather than distribution, which is why the shape is worth plotting before the summary is trusted.
Do
- Use the sample form unless your list is genuinely everyone
- Report the divisor alongside the figure when it matters
- Look at the mean and median before trusting the spread
- Use the coefficient of variation to compare across different scales
Don't
- Say that dividing by n − 1 makes the standard deviation unbiased
- Describe n − 1 as accounting for a missing observation
- Compare a sample figure from one source with a population figure from another
- Use the coefficient of variation on data that can be negative
The first two of those are subtle and both are commonly repeated. Dividing by n − 1 makes the VARIANCE an unbiased estimate; the square root of an unbiased estimate is not itself unbiased, and the standard deviation stays slightly low. Under a normal distribution the shortfall is about 2.7 percent at ten values, shrinking as the sample grows.
Advertisement
The formula, worked line by line
One formula with one switch in it. Everything below the switch is identical for both cases, which is why the two answers are always in fixed proportion to each other regardless of the data.
“Population when the list is everyone. Sample when the list is a selection. The data cannot tell you which — only you know where it came from.”
That last point is why the switch is a control rather than something detected automatically. Eight numbers are eight numbers; whether they are a whole department or eight people out of two hundred is a fact about the world, not about the list.
mean = Σx / n
sum of squares = Σ(x − mean)²
population variance = sum of squares / n
sample variance = sum of squares / (n − 1)
standard deviation = √variance- Two-pass
- find the mean, then square the deviations
- Shortcut
- Σx²/n − mean², algebraically identical
- On 100000.1, 100000.2, 100000.3
- the shortcut can go negative
- Why
- it subtracts two huge, nearly equal numbers
- This page uses
- the two-pass method
A negative variance is impossible — it is a sum of squares over a positive count — so any tool that produces one has hit catastrophic cancellation. Chan, Golub and LeVeque documented this in 1983 and recommended the corrected two-pass method whenever two passes are available.
Standard deviation against standard error
These are different measurements and the names invite confusion. Standard deviation describes how spread out the individual values are. Standard error describes how much the MEAN would jump about if you took the sample again, and it is the standard deviation divided by the square root of the count. A large sample has a small standard error and its standard deviation is unchanged.
The coefficient of variation, and when not to use it
- Coefficient of variation
- standard deviation ÷ mean, as a percentage
- What it is for
- comparing spread across different scales
- Needs
- a ratio scale with a meaningful zero
- Undefined at
- a mean of zero
- Unstable near
- a mean close to zero
A non-zero mean is not enough on its own. Temperatures in Celsius have an arbitrary zero, so a coefficient of variation computed on them is arithmetic without meaning, however clean the number looks.
Used within its limits it is genuinely useful: it lets you say that one process is more variable than another even when they are measured in different units or at wildly different sizes, which raw standard deviation cannot.
No threshold makes a coefficient of variation good across fields. Where a limit does exist it comes from what that field requires of the measurement rather than from anything in the statistic itself. Outside such a standard the only honest comparison is against another figure from the same kind of measurement, taken the same way.
Advertisement
Questions people ask
Should I divide by n or n − 1?
Divide by n − 1 if your numbers are a sample drawn from a larger group, which is the usual case. Divide by n only when the list is the entire population you are describing. The sample form is always the larger of the two, and on small sets the difference is substantial — with four values it is over fifteen percent.
What is the difference between STDEV.S and STDEV.P in Excel?
STDEV.S is the sample form and divides by n − 1; STDEV.P is the population form and divides by n. The older names STDEV and STDEVP do the same two jobs and remain available as compatibility functions. Picking the wrong one is silent — the answer looks perfectly reasonable either way.
Why is it n − 1 and not n?
Because the mean was estimated from the same data. Deviations measured around an estimated mean are systematically too small, and their expected total is (n − 1) times the true variance rather than n times it. Dividing by n − 1 corrects exactly that. Nothing is missing from the data; one degree of freedom was used up fitting the mean.
Does dividing by n − 1 make the standard deviation unbiased?
It makes the variance unbiased, not the standard deviation. Taking a square root does not preserve unbiasedness, so the sample standard deviation still sits slightly low. Under a normal distribution the shortfall is about 2.7 percent with ten values and falls as the sample grows, which is why it is usually ignored outside small-sample precision work.
Can two datasets have the same standard deviation but look different?
Yes, completely different. The sets 2, 4, 4, 4, 5, 5, 7, 9 and 3, 3, 3, 3, 7, 7, 7, 7 both hold eight values with a mean of 5, squared deviations of 32, a population σ of 2 and a sample s of 2.138. The first spreads across five distinct values and contains its own mean twice; the second sits in two clumps four apart and contains no 5 at all. Standard deviation measures spread, not shape.
What is the difference between variance and standard deviation?
Standard deviation is the square root of variance, so the two carry the same information in different units. Variance is in units squared, which makes it awkward to interpret but easy to combine — the variances of independent sources add together while their standard deviations do not. Reports quote the standard deviation; the arithmetic underneath runs on the variance.
How do you calculate variance?
Find the mean, subtract it from every value, square each of those differences and add them up. Then divide by n − 1 for a sample or by n for a population. For 2, 4, 4, 4, 5, 5, 7, 9 the squared deviations total 32, so the population variance is 32 ÷ 8 = 4 and the sample variance is 32 ÷ 7.
Do two standard deviations add together?
No — the variances do. Two independent sources with standard deviations of 3 and 4 combine to 5 rather than 7, because 9 + 16 = 25 and the square root of 25 is 5. Adding the deviations directly overstates the combined spread by forty percent in that case. What the rule needs is that the sources be uncorrelated; independence guarantees that but is stronger than required.
What is a good coefficient of variation?
There is no figure that works across fields. Where a field does set an acceptance limit, it comes from what that field requires of the measurement rather than from the statistic. Being dimensionless is what lets the coefficient compare across units and also what strips away the context needed to judge it: five percent is loose for a machined part and tight for monthly rainfall.
What counts as a high standard deviation?
Nothing on its own — it is in the same units as your data, so a standard deviation of 50 is enormous for shoe sizes and negligible for house prices. To judge it, compare it against the mean using the coefficient of variation, or against a standard deviation from comparable data measured the same way.
Is standard deviation the same as standard error?
No. Standard deviation measures how spread out the individual values are. Standard error measures how much the sample mean would vary if you drew the sample again, and equals the standard deviation divided by the square root of the count. Increasing your sample size shrinks the standard error while leaving the standard deviation roughly where it was.
Sources
Where the constants and formulas on this page come from. Each line names the figure it backs.
Sample variance divides the sum of squared deviations by n − 1, and the population form divides by n.
NIST/SEMATECH e-Handbook of Statistical Methods — Measures of Scale — National Institute of Standards and Technology
The sample standard deviation is a biased estimator of sigma even when the variance estimator is unbiased, with a normal-theory correction factor c4(n).
NIST/SEMATECH e-Handbook — Variables Control Charts — National Institute of Standards and Technology
The computational formula for variance can suffer catastrophic cancellation, and the corrected two-pass method is recommended where two passes are possible.
Algorithms for Computing the Sample Variance: Analysis and Recommendations — Chan, Golub and LeVeque, The American Statistician
STDEV.S estimates standard deviation from a sample and STDEV.P calculates it for an entire population.
STDEV.S function — Microsoft
Related guides
Math
Why the Quadratic Formula Loses Accuracy on One of Its Two Roots
Completing the square takes four lines and produces the formula. It also shows which of the two roots is safe to trust, and the calculator on this site was corrected to use the other route.
August 19, 2026 · 10 min read
Math
Geometry Backwards: Finding the Radius from the Area
Every geometry formula is printed in the direction you need least. Running it backwards is not the same operation reversed; it is a root, and roots can refuse.
August 17, 2026 · 10 min read
Math
When Cross Multiplication Gives You the Wrong Answer
Cross multiplication answers every question you put to it, including the ones it should refuse. The test is one line: if the input were zero, would the output be zero?
August 17, 2026 · 10 min read