Calculator Uni

Variance Calculator

Sample and population variance with the mean and sum of squares shown.

Quick answer

Variance is the average squared distance from the mean: sum the squared deviations, then divide by n − 1 for a sample or n for a whole population. The n − 1 correction offsets the fact that a sample's spread around its own mean understates the true population spread; standard deviation is the square root, in the original units.

Data set

Sample variance (s²)

4.6667

standard deviation 2.1602

Count (n)

7

Mean

6

Sum of squared deviations

28

If population instead

4

Average squared distance from the mean

Variance measures spread. Subtract the mean from every value, square each difference, add them up, and divide — by n − 1 for a sample, by n for a full population. Squaring stops positive and negative deviations from cancelling, but it also changes the units: variance in a data set measured in inches is in square inches, which is why the standard deviation, its square root, is usually what gets reported.

Worked example: 4, 8, 6, 5, 3, 9, 7

Seven values summing to 42, so the mean is 6. The deviations are −2, 2, 0, −1, −3, 3, 1, and their squares are 4, 4, 0, 1, 9, 9, 1 — a sum of squared deviations of 28. As a sample, variance is 28 ÷ 6 = 4.667 and the standard deviation is 2.160. Treated as a whole population, it's 28 ÷ 7 = 4 exactly, with a standard deviation of 2.

Why n − 1 (Bessel's correction)

A sample's own mean is always the point that minimises its squared deviations, so the spread around it is systematically smaller than the spread around the true population mean. Dividing by n − 1 rather than n inflates the estimate just enough to correct that bias. The difference is large in small samples — 17% here with n = 7 — and negligible past a few hundred observations. If your numbers are the entire population, use n.

Which one to pick

The question is not how many values you have but what they represent. Test scores for every student in a class you are describing are a population: use n. The same scores treated as a sample of what the teaching method produces are a sample: use n − 1. When in doubt in research, use the sample formula — nearly all statistical software defaults to it, and it is the conservative choice.

What variance hides

Because deviations are squared, variance is dominated by outliers: one value far from the mean can inflate it beyond recognition. It also says nothing about shape — a uniform spread, a bimodal split, and a normal bell can all share the same variance. And it is scale-dependent, so comparing variance across data sets with different units or magnitudes is meaningless; the coefficient of variation, standard deviation over mean, is the comparable measure.

Frequently asked questions

What is the difference between sample and population variance?
Sample variance divides the sum of squared deviations by n − 1; population variance divides by n. The n − 1 correction compensates for the fact that a sample's spread around its own mean understates the true population spread. For 4, 8, 6, 5, 3, 9, 7 the sample variance is 4.667 and the population variance is 4.
Why do you divide by n − 1?
Because a sample mean sits by construction at the centre of its own data, so squared deviations around it are systematically too small. Dividing by n − 1 — Bessel's correction — removes that downward bias. The effect is substantial for small samples and negligible for large ones.
How do you calculate variance step by step?
Find the mean, subtract it from each value, square each difference, add the squares together, then divide by n − 1 for a sample or n for a population. For 4, 8, 6, 5, 3, 9, 7: the mean is 6, the squared deviations sum to 28, and the sample variance is 28 ÷ 6 = 4.667.
Is variance or standard deviation better to report?
Standard deviation, usually, because it's in the same units as your data — a spread of 2.16 inches is interpretable, while 4.67 square inches isn't. Variance is what the mathematics works with, so it appears throughout statistical theory and in ANOVA.

Related calculators