Variance Calculator
Result
Variance
- Standard deviation
- 2.1381
- Sum of squared deviations
- 32.0000
- Mean
- 5.0000
- Count
- 8
The variance is the average squared distance from the mean, so it answers the same question the standard deviation does but in squared units. Type or paste the numbers — one per line, or separated by semicolons, commas or spaces — and this calculator prints the count, the sum, the mean and the sum of squared deviations, then divides that sum by n − 1 for a sample or by n for a population. The standard deviation is shown next to it, because that is the version in the original units, and the two differ by nothing except a square root.
Formula
Variance = Σ (xᵢ − x̄)² ÷ (n − 1) for a sample, or the same sum divided by n for a population
- xᵢ
- One value in the data set. It enters as its distance from the mean, and that distance is squared before anything is added up
- x̄
- The mean of the data: the sum of all the values divided by how many there are. It is printed beside the result so the arithmetic can be checked
- n
- How many values the data set holds, up to 200 here. The divisor is n − 1 for a sample and n for a population — the only difference between the two variances
- Σ (xᵢ − x̄)²
- The sum of squared deviations: each distance from the mean, squared, then added. Squaring gives the values far from the mean much more weight — a point 10 units out adds 100 to this sum, while a point 2 units out adds 4
- σ²
- The variance itself. It is in squared units, which makes it the right quantity to add up and the wrong one to read
Use the variance when the squared quantity is what you actually need: variances of independent sources add, so the variance of a total is the sum of the variances, while the standard deviations do not add; analysis of variance, regression and most of the machinery built on them take a variance as their input, not a standard deviation. Use the standard deviation instead whenever a human has to read the number — a spread of 4.5714 squared marks means nothing, while 2.1381 marks can be compared with the scores themselves. The panel gives both, so the choice is about which one you quote. Note that the variance is far more sensitive to a single extreme value than the standard deviation is, because that value's distance is squared before it counts.
Worked examples
Eight values, sample variance
- Sum: 2 + 4 + 4 + 4 + 5 + 5 + 7 + 9 = 40 over 8 values, so the mean is 5
- Deviations: −3, −1, −1, −1, 0, 0, 2, 4
- Squared deviations: 9 + 1 + 1 + 1 + 0 + 0 + 4 + 16 = 32
- Sample variance: 32 ÷ (8 − 1) = 4.5714
- Standard deviation, for comparison: √4.5714 = 2.1381
The variance is 4.5714 and the standard deviation is 2.1381, which is not a coincidence: one is the square of the other. Read the middle two steps before believing the answer — the sum of squared deviations is the only number in the calculation that is hard to judge by eye, and the panel prints it so you never have to take it on trust.
The same eight values as a population
- Same sum of squared deviations: 32
- Population variance: 32 ÷ 8 = 4
- Population standard deviation: √4 = 2
Two variances from one data set, 4.5714 and 4, differing only in the divisor. Switching the drop-down is worth doing once on your own numbers: if a spreadsheet and this page disagree, the divisor is almost always why. The variance is the more sensitive of the two to that choice, because it has not been shrunk by a square root.
Four identical readings, where the spread is exactly zero
- Every value is 3, so the mean is 3 and every deviation is 0
- Sum of squared deviations: 0
- Population variance: 0 ÷ 4 = 0
- Population standard deviation: √0 = 0
Zero variance means the values carry no spread at all, and it is the one case where a variance of zero is a real answer rather than a sign that something went wrong. It is also the reason the coefficient of variation has a positive mean as its condition rather than a non-zero variance: a zero spread divided by a positive mean is a perfectly good 0%.
Limitations
This is the plain unweighted variance of a list of numbers: a value entered once counts once, so a frequency table or a weighted survey needs a different calculation. Its units are squared — grams become squared grams — so the number cannot be compared with the data it came from, which is what the standard deviation shown beside it is for. Because every deviation is squared, a single extreme value dominates: one reading that is ten times too large contributes a hundred times as much as a reading twice as far out as usual. A skewed data set is better described by quartiles than by a variance or a standard deviation. The list is capped at 200 values, and a token like 1,500 is refused rather than guessed at, because a comma between digits is a decimal comma in much of the world; write 1500 or 1.5.
Frequently asked questions
- How do I calculate the variance?
- Four steps. Find the mean by adding the values and dividing by how many there are. Subtract the mean from each value. Square every one of those differences and add them up — that total is the sum of squared deviations. Divide by n − 1 for a sample or by n for a population. For the values 2, 4, 4, 4, 5, 5, 7, 9 the sum of squares is 32, so the sample variance is 32 ÷ 7 = 4.5714 and the population variance is 32 ÷ 8 = 4.
- What is the difference between variance and standard deviation?
- A square root. The standard deviation is the square root of the variance, so each is the other's square: the variance here is 4.5714 and the standard deviation is 2.1381. The variance is the one that makes sense to add up, because variances of independent sources add while standard deviations do not. The standard deviation is the one that makes sense to read, because it comes back in the units of the data instead of squared units.
- Why does the variance stay the same when I add a constant to every value?
- Because the variance only looks at distances from the mean, and shifting every value shifts the mean by the same amount. Add 100 to each of 2, 4, 4, 4, 5, 5, 7, 9 and the mean rises from 5 to 105 while every deviation is unchanged, so the sum of squared deviations is still 32. Multiplying every value by a constant is the opposite case: the variance is multiplied by the square of that constant, and the standard deviation by the constant itself.
- Can a variance be negative?
- No. Every term in the sum of squared deviations is a square, so the sum is never negative, and the divisor is a positive count. The smallest possible variance is zero, which happens only when every value is identical — four readings of exactly 3 give a variance of 0. A negative variance on a screen means a calculation went wrong, not that the data is unusual.
- Can I paste a column straight out of a spreadsheet?
- Yes. Newlines, tabs, semicolons, spaces and a comma followed by a space all separate values, so a pasted column works as-is and empty segments are skipped rather than rejected. Up to 200 values are read. A token like 1,500 or 1.500 is refused on purpose: three digits after the separator means a thousands separator in some countries and a decimal point in others, so write 1500 or 1.5.
References
- Measures of Scale — e-Handbook of Statistical Methods, section 1.3.5.6 — National Institute of Standards and Technology (NIST)
- Measures of the Spread of the Data — Introductory Statistics 2e, section 2.7 — OpenStax, Rice University