Variance Calculator
Variance is the average squared distance from the mean. Paste your numbers and the calculator returns both versions: the sample variance s², which divides the sum of squared deviations by n − 1, and the population variance σ², which divides by n. For 2, 4, 4, 4, 5, 5, 7, 9 the sum of squares is 32, so σ² = 32 ÷ 8 = 4 and s² = 32 ÷ 7 = 4.5714.
Sample variance (s²)
4.5714
Population variance (σ²)
4
Sample SD (s)
2.1381
Population SD (σ)
2
Count (n)
8
Mean
5
Sum of squares
32
Working
- Mean x̄ = 40 ÷ 8 = 5
- (2 − 5)² = 9
- (4 − 5)² = 1
- (4 − 5)² = 1
- (4 − 5)² = 1
- (5 − 5)² = 0
- (5 − 5)² = 0
- (7 − 5)² = 4
- (9 − 5)² = 16
- Sum of squared deviations = 32
- Population: σ² = 32 ÷ 8 = 4, σ = √4 = 2
- Sample: s² = 32 ÷ 7 = 4.5714, s = √4.5714 = 2.1381
Example: 2, 4, 4, 4, 5, 5, 7, 9
- Mean x̄ = 40 ÷ 8 = 5
- (2 − 5)² = 9
- (4 − 5)² = 1
- (4 − 5)² = 1
- (4 − 5)² = 1
- (5 − 5)² = 0
- (5 − 5)² = 0
- (7 − 5)² = 4
- (9 − 5)² = 16
- Sum of squared deviations = 32
- Population: σ² = 32 ÷ 8 = 4, σ = √4 = 2
- Sample: s² = 32 ÷ 7 = 4.5714, s = √4.5714 = 2.1381
Formulas and which one to use
Population variance: σ² = Σ(x − μ)² ÷ N, used when your list is every value in the group you care about. Sample variance: s² = Σ(x − x̄)² ÷ (n − 1), used when your list is a sample drawn from a larger population. Dividing by n − 1 instead of n corrects the tendency of a sample to understate the spread of the population, because deviations are measured from the sample mean, which sits closer to the data than the true mean does.
If you are unsure, use the sample variance: it is the default in most statistics courses and in spreadsheet functions such as VAR.S. The population version is VAR.P. Variance is in squared units (dollars squared, metres squared), which is why people report the standard deviation, its square root, as well.
Using variance next
The standard error of a mean is s ÷ √n, so it starts from the sample variance. The F test compares two variances by their ratio, and the F table gives the critical values for that ratio. A variance of 0 means every value is identical; variance can never be negative.
Frequently asked questions
- What is the formula for variance?
- Subtract the mean from each value, square the differences, add them up and divide by n for a population or by n − 1 for a sample.
- What is the difference between sample and population variance?
- The sample variance divides by n − 1 and estimates the population variance from a sample; the population variance divides by n and describes a complete population.
- Can variance be negative?
- No. It is an average of squares, so it is zero or positive.
- How is variance related to standard deviation?
- The standard deviation is the square root of the variance, so it is in the same units as the data.
Sources and references
- OpenStax Introductory Statistics 2e: Measures of the Spread of the Data: sample and population standard deviation.