Variance Calculator
This variance calculator finds the average of the squared differences from the mean, for a sample or for a whole population. For delivery times of 10, 12, 23, 23, 16, 23, 21 and 16 minutes the mean is 18 and the sample variance is 27.43.
Sources: OpenStax Introductory Statistics 2e Updated
Sample variance (s²)
≈ 6.166667
- Sample standard deviation (s)
- 2.483277
- Mean
- 5.166667
- Count (n)
- 6
- Sum of squares
- 30.833333
- Population variance (σ²)
- 5.138889
Show steps Here’s how we got it
Count the values
n = 6
Find the mean
(2 + 4 + 4 + 5 + 7 + 9) ÷ 6 = 31 ÷ 6 ≈ 5.166667
The mean is the sum divided by how many values there are.
Subtract the mean from each value, then square the result
Value x x − mean (x − mean)2 2 −3.1667 10.0278 4 −1.1667 1.3611 4 −1.1667 1.3611 5 −0.1667 0.0278 7 1.8333 3.3611 9 3.8333 14.6944 Sum 30.8333 Squaring makes every difference positive, so values below the mean do not cancel values above it.
Add up the squared differences
Sum of squares ≈ 30.833333
Divide by n − 1
30.833333 ÷ (6 − 1) = 30.833333 ÷ 5 ≈ 6.166667
This is the sample variance. The values in a sample sit closer to their own mean than to the true population mean, so dividing by n would come out too small. Dividing by n − 1 corrects for that.
The variance formulas
For a sample of n values with mean :
For a whole population of N values with mean :
The top of each fraction is called the sum of squares. These are the definitions in OpenStax Introductory Statistics.
How to calculate variance: eight delivery times
A sample of eight delivery times, in minutes: 10, 12, 23, 23, 16, 23, 21 and 16.
Count the values
n = 8
Find the mean
(10 + 12 + 23 + 23 + 16 + 23 + 21 + 16) ÷ 8 = 144 ÷ 8 = 18
The mean is the sum divided by how many values there are.
Subtract the mean from each value, then square the result
Value x x − mean (x − mean)2 10 −8 64 12 −6 36 23 5 25 23 5 25 16 −2 4 23 5 25 21 3 9 16 −2 4 Sum 192 Squaring makes every difference positive, so values below the mean do not cancel values above it.
Add up the squared differences
Sum of squares = 192
Divide by n − 1
192 ÷ (8 − 1) = 192 ÷ 7 ≈ 27.428571
This is the sample variance. The values in a sample sit closer to their own mean than to the true population mean, so dividing by n would come out too small. Dividing by n − 1 corrects for that.
Answer: ≈ 27.428571
Sample variance, population variance and standard deviation
The same eight times give a sample variance of 192 ÷ 7 = 27.43 and a population variance of 192 ÷ 8 = 24. Divide by n − 1 when the eight deliveries stand in for many more; divide by n when they are all the deliveries you care about.
The square root of the sample variance is the sample standard deviation, √27.43 = 5.24 minutes, back in the units of the data. The standard deviation calculator shows that last step.
Why one long or short value matters so much
Squaring makes big differences count far more than small ones: the 10-minute delivery is 8 minutes from the mean and adds 64, while the two 16-minute ones add 4 each. A single unusual value can raise the variance a lot.
When the data has outliers, the interquartile range is a steadier measure of spread. Variance is still the one used inside other methods, such as the least-squares line in the linear regression calculator.
Variance practice question
Find the population variance of 4, 8, 6, 5, 3 and 4.
Check your answer
Answer: ≈ 2.666667
Count the values
n = 6
Find the mean
(4 + 8 + 6 + 5 + 3 + 4) ÷ 6 = 30 ÷ 6 = 5
The mean is the sum divided by how many values there are.
Subtract the mean from each value, then square the result
Value x x − mean (x − mean)2 4 −1 1 8 3 9 6 1 1 5 0 0 3 −2 4 4 −1 1 Sum 16 Squaring makes every difference positive, so values below the mean do not cancel values above it.
Add up the squared differences
Sum of squares = 16
Divide by n
16 ÷ 6 ≈ 2.666667
This is the population variance: the average squared distance from the mean.
Questions about variance
How do you calculate variance?
Find the mean, subtract it from each value, square each difference and add the squares. Divide the total by n − 1 for a sample or by n for a population.
What is the difference between sample variance and population variance?
Population variance divides the sum of squares by n and is used when the data covers the whole group. Sample variance divides by n − 1 and is used when the data is a sample from a larger group.
Why are the differences squared?
Without squaring, the differences above the mean and below the mean would cancel and always add up to zero. Squaring makes every term positive and gives more weight to values far from the mean.
What units does variance have?
The square of the data's units. If the data is in centimetres, the variance is in square centimetres. Take the square root, the standard deviation, to get back to the original units.
Can variance be negative?
No. It is a sum of squares divided by a positive number, so the smallest it can be is 0, which happens only when every value is the same.
Sources
- OpenStax Introductory Statistics 2e, 2.7 Measures of the Spread of the Data — variance as the square of the standard deviation; dividing by n − 1 for a sample and by N for a population (checked October 12, 2026)