Variance formulas
Population: σ² = Σ(x − μ)² ÷ N
Sample: s² = Σ(x − x̄)² ÷ (n − 1)
Σ means "add up". μ (or x̄) is the mean, and N (or n) is the number of values.
Step-by-step example
Data: 6, 2, 3, 1, 8. The mean is 20 ÷ 5 = 4.
- Deviations from the mean: 2, −2, −1, −3, 4
- Squared deviations: 4, 4, 1, 9, 16
- Sum of squares: 34
- Population variance: 34 ÷ 5 = 6.8
- Sample variance: 34 ÷ 4 = 8.5
Why square the deviations?
If you simply added the deviations, the positives and negatives would cancel and always sum to zero. Squaring makes every term positive and gives extra weight to values far from the mean, which is exactly what a measure of spread should do.
Want quartiles, outliers and more in one place? Try the statistics calculator or the standard deviation calculator.
Last reviewed October 2026.
Frequently asked questions
What is variance?
Variance measures how spread out numbers are from their mean. It is the average of the squared distances from the mean. A variance of 0 means every value is the same; larger values mean more spread.
Should I use sample or population variance?
Use population variance (divide by n) when your data includes every member of the group you care about. Use sample variance (divide by n − 1) when your data is a sample used to estimate a larger population, which is the usual case in statistics classes and research.
Why divide by n − 1 for a sample?
A sample tends to sit closer to its own mean than to the true population mean, so dividing by n would underestimate the spread. Dividing by n − 1, called Bessel's correction, fixes that bias.
How is variance related to standard deviation?
Standard deviation is the square root of variance. Variance is in squared units (for example, square dollars), while standard deviation is back in the original units, which makes it easier to interpret.
Can variance be negative?
No. Variance is built from squared differences, which are never negative, so the smallest possible variance is 0.