Variance calculator

Separate values with commas, spaces, or new lines. Any mix works.

Use sample variance when your data is a sample of a larger group. Use population variance when you have every value.

Show the step-by-step calculation

Variance Calculator

Sample and population variance computed instantly, with the standard deviations and the full working shown.

Variance is the average of the squared deviations from the mean. It is the engine room of most spread statistics: standard deviation is simply its square root. This calculator puts variance first. Sample variance, which divides the sum of squared deviations by n - 1, appears at the top alongside population variance, which divides by n. Both standard deviations, the sum of squared deviations, and the usual summary statistics follow below.

Because variance is measured in squared units, it can feel abstract on its own. That is why the step-by-step section expands the whole calculation for your exact numbers: the mean, every squared deviation, their sum, and the final division by n or n - 1. Want the answer in original units instead? The standard deviation solver leads with the square roots. Looking for averages? Try the mean median mode calculator.

The calculator runs entirely in your browser with plain JavaScript. Your numbers never leave your device, there is nothing to sign up for, and results update as you type.

What is variance?

Variance measures how far a set of numbers spreads out around its mean. To compute it, you subtract the mean from each value, square every difference so that positive and negative deviations do not cancel, and then average those squared differences. A small variance means the values cluster tightly near the mean. A large variance means they are scattered widely.

Squaring the deviations has two effects. First, it makes every contribution positive, so variance can never be negative. Second, it penalizes large deviations more than small ones, which makes variance sensitive to outliers. The cost of squaring is that the result lives in squared units: if your data is in centimeters, the variance is in centimeters squared. Taking the square root of the variance fixes that, which is exactly what standard deviation is.

Sample vs population variance

There are two versions of variance, and they differ only in the divisor used at the final averaging step. Population variance divides the sum of squared deviations by n, the number of values. Sample variance divides by n - 1 instead. That small change, known as Bessel's correction, compensates for the fact that a sample's deviations are measured around the sample mean rather than the true population mean, which makes the uncorrected average systematically too small.

The rule for choosing is simple. If your dataset contains every member of the group you care about, divide by n and report the population variance. If your data is a subset drawn from a larger group and you want to generalize, divide by n - 1 and report the sample variance. The same logic applies to standard deviation, and our sample versus population standard deviation guide walks through the reasoning with worked numbers. This calculator reports both variances every time, so you can pick the one that matches your situation.

Worked example

Take the small dataset 4, 8, 6, 2. Here is the complete variance calculation, step by step.

Step 1, find the mean. The sum is 4 + 8 + 6 + 2 = 20, and there are 4 values, so the mean is 20 / 4 = 5.

Step 2, subtract the mean from each value and square the result:

Step 3, add the squared deviations: 1 + 9 + 1 + 9 = 20. This total is called the sum of squared deviations.

Step 4, divide by the correct divisor. For the population variance, divide by n = 4: 20 / 4 = 5. For the sample variance, divide by n - 1 = 3: 20 / 3 = 6.6667 to four decimal places. Taking square roots gives the standard deviations: about 2.2361 for the population and about 2.5820 for the sample. Paste 4, 8, 6, 2 into the calculator above and you will see exactly these numbers in the results table and in the step-by-step working.

Frequently asked questions

What is variance in statistics?

Variance is the average of the squared deviations from the mean. It measures how spread out a set of numbers is. Because each deviation is squared, variance is never negative, and it is expressed in squared units. The square root of the variance is the standard deviation.

What is the difference between sample and population variance?

Population variance divides the sum of squared deviations by n, the number of values, and is correct when your data contains every member of the group you care about. Sample variance divides by n - 1 instead, a correction called Bessel's correction, and is the right choice when your data is a sample drawn from a larger group.

Why does sample variance divide by n - 1?

Deviations in a sample are measured around the sample mean, which is fitted to that sample, so the raw average of squared deviations comes out slightly too small. Dividing by n - 1 instead of n inflates the result just enough to make the sample variance an unbiased estimate of the population variance.

Can variance be negative?

No. Every deviation from the mean is squared before averaging, and squared values are always zero or positive. The smallest possible variance is zero, which happens only when every value in the dataset is identical.

How is variance related to standard deviation?

Standard deviation is the square root of the variance. Variance comes first in the calculation, but it is measured in squared units, so most people report the standard deviation because it is in the same units as the original data and easier to interpret.