How to calculate variance
Variance is the average of the squared deviations from the mean. Find the mean, subtract it from each value, square the results, and add them up. Divide by n for population variance or by n − 1 for sample variance. For 2, 4, 4, 4, 5, 5 the mean is 4, the squared deviations sum to 6, giving population variance 6 ÷ 6 = 1 and sample variance 6 ÷ 5 = 1.2.
Deviations are squared rather than added directly because positive and negative deviations would otherwise cancel to zero for any data set. Take the square root of the variance and you are back to the standard deviation, in the original units.
How to use this calculator
Enter at least two numbers and leave unused fields blank. The big result is the population variance; the badge shows the sample variance and the mean. The square root of variance is the standard deviation. For an absolute-distance spread measure, see the mean absolute deviation calculator.
Population vs. sample variance
Use population variance when your data covers the whole group, and sample variance (dividing by n − 1, Bessel's correction) when your data is a sample drawn from a larger population. For the full spread of the data, see the range calculator.
The correction matters most with small samples: with six values the divisor changes from 6 to 5, a noticeable difference, while with several hundred values the two results are nearly identical.
Frequently asked questions
- How do I calculate variance?
- Find the mean, square each deviation from it, sum them, then divide by n (population) or n − 1 (sample). For 2, 4, 4, 4, 5, 5 the population variance is 1.
- What is the difference between population and sample variance?
- Population variance divides by n; sample variance divides by n − 1 to correct for using a sample. Sample variance is slightly larger.
- How does variance relate to standard deviation?
- Standard deviation is the square root of variance, expressed in the original units.
- How many values do I need?
- At least two, so there is some spread to measure.
- What unit is variance measured in?
- Variance is in the square of the original unit — variance on measurements in centimetres comes out in square centimetres. That is the main reason standard deviation is usually reported instead, since taking the square root returns the figure to the original unit.