Variance Calculator
This page opens the average calculator with the variance as its headline figure instead of the mean. Both divisors are worked out on every paste: the sample variance divides the sum of squared deviations by n − 1, the population variance divides that same sum by n, and the Sample and Population buttons decide which of the two sits at the top. Sample is the default, because a list of numbers is usually a subset of something larger. The box arrives filled with twelve numbers, 18, 22, 31, 39, 44, 46, 51, 58, 62, 70, 76 and 83, whose mean is 50 and whose squared deviations add up to 4716, so the sample variance reads 4716 ÷ 11 = 428.72727272727275 and the population variance reads 4716 ÷ 12 = 393. Each figure is printed beside the division that produced it, and the standard deviation rows underneath show the square root they took of it. Paste your own numbers over the sample and the mean, median, mode, range, both standard deviations, the geometric and harmonic means and the sum are still listed below, each with its arithmetic written out.
Commas, spaces, tabs, semicolons and new lines all separate values, so a column pasted straight out of a spreadsheet works. Currency symbols, percent signs and accounting parentheses are understood; anything left over is listed rather than silently dropped.
(18 + 22 + 31 + … + 83) ÷ 12 = 600 ÷ 12 = 50 The arithmetic mean: the one most people mean by “average”.
Sorted: 18, 22, 31, …, 83, an even count (12), so the median is the average of the 6th and 7th values: (46 + 51) ÷ 2 = 48.5
All 12 values appear exactly once, so nothing is more common than anything else: there is no mode. No mode is a real answer, not a failure. Adding a repeat would create one.
Largest − smallest = 83 − 18 = 65
√(sample variance) = √428.72727272727275 = 20.705730432111608 Divides by n − 1. Use this when your numbers are a sample drawn from something larger.
Σ(x − mean)² ÷ (n − 1) = 4716 ÷ 11 = 428.72727272727275 Divides by n − 1. Use this when your numbers are a sample drawn from something larger.
√(population variance) = √393 = 19.82422760159901 Divides by n. Use this when your numbers ARE the whole group.
Σ(x − mean)² ÷ n = 4716 ÷ 12 = 393 Divides by n. Use this when your numbers ARE the whole group.
(18 × 22 × 31 × … × 83)^(1/12) = 45.487558964974305 The geometric mean: the right average for growth rates, ratios and anything that multiplies.
12 ÷ (1/18 + 1/22 + … + 1/83) = 12 ÷ 0.29584565082861597 = 40.56169143061571 The harmonic mean: the right average for speeds, rates and other per-unit quantities.
18 + 22 + 31 + … + 83 = 600
Common questions
- How do you calculate variance by hand?
- Add the values up and divide by the count to get the mean, subtract the mean from each value, square every difference, add the squares together, then divide that total by n − 1 for a sample or by n for a population. The twelve numbers this page opens with are a worked example: the mean is 50, the squared deviations run from (83 − 50)² = 1089 down to (51 − 50)² = 1, and they add up to 4716. Divided by 11 that is a sample variance of 428.72727272727275; divided by 12 it is a population variance of exactly 393. The line under the big figure prints the sum of squares and the division, so the answer can be checked rather than taken on trust.
- Should I use the sample variance or the population variance?
- Sample, unless your numbers really are every member of the group you are describing. The sample variance divides by n − 1 and is the headline here on a first visit; the population variance divides by n and is right only when nothing is left out. Both are computed on every paste and both are rows of their own, each labelled with the divisor it used, so nothing is chosen for you behind the scenes. The gap is not cosmetic: for 2, 4, 4, 4, 5, 5, 7, 9 the squares add up to 32, so the population variance is 32 ÷ 8 = 4 while the sample variance is 32 ÷ 7 = 4.571428571428571, about 14% larger. Pressing Population moves that figure to the top, and the choice is remembered the next time you come back.
- What is the difference between variance and standard deviation?
- The standard deviation is the square root of the variance, which is the only reason both exist. The variance is in squared units, so the spread of a list of prices comes out in squared currency and cannot be read against the values themselves; taking the root puts it back into the original units. For the twelve numbers on screen the sample variance is 428.72727272727275 and the sample standard deviation is its square root, 20.705730432111608, and the standard deviation row prints that root beside the figure. Both variance rows and both standard deviation rows are listed together, so the pair can be read at once.
- Why does a single number give no sample variance?
- Because the sample formula divides by n − 1, which is zero when there is one value, so the row reads Not defined and gives that reason instead of printing 0. One measurement has no spread to measure, and a 0 there would read as a finding about the data when it is only an artefact of the formula. If that single value genuinely is your whole group, the population variance of 0 is the answer you want, and it is shown on the same screen.
- Can the variance be zero, and can it be negative?
- Zero, yes: paste 5, 5, 5 and every value sits on the mean, so the sum of squared deviations is 0 and both variances read 0 ÷ 3 = 0 and 0 ÷ 2 = 0. Negative, never, because every deviation is squared before it is added, and the tool clamps the sum at zero so that rounding in the subtraction can never produce a small negative variance on values that are nearly identical. The deviations are also taken from the mean rather than from a running sum of squares, which is what keeps a list like 100000001, 100000002, 100000003 from cancelling itself into a variance of nothing.
- How do I get my own numbers in, and can I feature something else?
- Select what is in the box and paste your own over the top. Commas, spaces, tabs, semicolons, pipes and new lines all separate values, so a column copied straight out of a spreadsheet works, and currency symbols, percent signs and accounting parentheses for negatives are understood. Anything that is not a number is skipped and named above the results rather than quietly treated as zero. The Featured result menu holds nine statistics: mean, median, mode, range, standard deviation, variance, geometric mean, harmonic mean and sum, and switching it moves that one to the headline. This page always opens on the variance, even if you last chose another statistic or last used the weighted mean, because the page you asked for wins. Your last list of numbers does come back, so you can carry on where you left off.
Exact for median, mode, minimum, maximum and range. The mean, variances and standard deviations use compensated summation and are accurate to roughly 15 significant digits, not claimed as exact, because double-precision arithmetic is not.