Variance Calculator

Calculate sample or population variance from any list of numbers. See the variance, standard deviation, mean and a step-by-step deviation table update as you type.

Separate values with commas, spaces, semicolons or new lines. Entries that are not numbers are ignored.
Use sample if your data is a subset of a larger group, population if it is the whole group.
Sample variance (s²) —
Standard deviation (s) —
Mean (x̄) —
Count (n) —
Sum (Σx) —
Sum of squared deviations —
Population variance (σ²) —

How to Use

  1. Enter your data: type or paste numbers into the box, separated by commas, spaces, semicolons or new lines. Negative numbers and decimals work.
  2. Choose the variance type: sample (divide by n − 1) if your numbers are a sample from a larger group, or population (divide by n) if they are the whole group.
  3. Read the results: the variance, standard deviation, mean, count, sum and sum of squared deviations update as you type.
  4. Check the working: the table under the results lists each value, its distance from the mean and that distance squared, so you can follow the arithmetic.

What You'll Discover

  • Variance: the average squared distance of your values from their mean, for the type you selected. A value of 0 means every number is identical; larger values mean more spread.
  • Standard deviation: the square root of the variance, back in the original units of your data (for sample data this is s, for population data it is σ).
  • Mean, count and sum: the average of the values, how many numbers were read, and their total.
  • Sum of squared deviations: the quantity Σ(x − x̄)² that sits on top of both variance formulas.
  • The other variance: a last row shows the variance for the type you did not select, so you can compare sample and population values without switching.
  • Deviation table: for lists of up to 10 values the table shows every row; for longer lists it shows the first 10 and the totals still use all your values.

The sample variance needs at least two values, because it divides by n − 1. With a single number the calculator shows — for sample variance and a population variance of 0. If some entries are not numbers, they are skipped and a note under the data box tells you how many were ignored.

How Variance Is Calculated

Variance is the average squared distance of the values from their mean. By hand it takes five steps: find the mean, subtract it from each value, square each difference, add the squares to get the sum of squared deviations (SS), then divide by n for a population or by n − 1 for a sample.

Population: σ² = Σ(x − μ)² / N

Sample: s² = Σ(x − x̄)² / (n − 1)

Squaring matters. The raw deviations from the mean always add up to zero, so squaring removes the signs and also gives larger gaps more weight than small ones.

Worked example: 6, 8, 9, 12, 15

The mean is 50 ÷ 5 = 10. Each value's distance from 10 and its square are:

xx − 10(x − 10)²
6−416
8−24
9−11
1224
15525
Total050

The sum of squared deviations is 50. Population variance is 50 ÷ 5 = 10, and sample variance is 50 ÷ 4 = 12.5. The standard deviations are √10 ≈ 3.1623 and √12.5 ≈ 3.5355.

The shortcut formula

You can get the same sum of squared deviations without computing each difference: SS = Σx² − n·x̄². Here Σx² = 36 + 64 + 81 + 144 + 225 = 550 and n·x̄² = 5 × 100 = 500, so SS = 550 − 500 = 50. This is handy on a basic calculator, but with large numbers that sit close together it can lose precision, so this page uses the deviation method.

Sample Variance vs Population Variance

The only difference in the arithmetic is the divisor. Which one is right depends on what your numbers represent: every member of the group you care about (population), or a subset used to learn about a bigger group (sample).

Population varianceSample variance
Symbolσ²s²
FormulaΣ(x − μ)² / NΣ(x − x̄)² / (n − 1)
Use it whenYour data is the whole groupYour data is a sample of a larger group
Excel / Google SheetsVAR.PVAR.S
Python statisticspvariance()variance()
NumPynp.var(x) (default, ddof=0)np.var(x, ddof=1)
For 6, 8, 9, 12, 151012.5

Why divide by n − 1?

When you only have a sample, you measure spread around the sample mean, not the unknown true mean. The sample mean is the point that minimises the sum of squared deviations, so those deviations are on average a little too small. Dividing by n − 1 instead of n corrects for this and is known as Bessel's correction. It makes s² an unbiased estimate of the population variance, though s itself is still very slightly low on average.

The sample value is always the population value multiplied by n ÷ (n − 1). That factor is 1.25 when n = 5, about 1.0345 when n = 30 and about 1.0101 when n = 100, so the choice matters most for small data sets. With one value the factor would need a division by zero, which is why sample variance is undefined for n = 1.

If you are unsure, ask whether you could, in principle, measure everyone. A teacher with the scores of every student in one class has a population; a survey of 200 voters drawn from a city is a sample.

Variance vs Standard Deviation and Other Measures of Spread

Variance is measured in squared units. If your data is in grams the variance is in grams², which is hard to picture. The standard deviation is its square root, so it comes back to grams. Use the standard deviation calculator when you want the figure you would quote in a report, and variance when you are doing further maths with it.

MeasureWhat it describesUnitsEffect of an outlier
VarianceAverage squared distance from the meanSquaredVery large (distance is squared)
Standard deviationSquare root of the varianceSame as dataLarge
RangeLargest minus smallest valueSame as dataSet entirely by the extremes
IQRSpread of the middle half of the dataSame as dataSmall

Two filling machines each fill five bags with a mean of 500 g. Machine A gives 498, 499, 500, 501, 502 g and Machine B gives 480, 490, 500, 510, 520 g. The sample variances are 2.5 g² and 250 g². The variance is 100 times larger, while the standard deviations (about 1.58 g and 15.81 g) differ by a factor of 10. That is the squaring at work: if the spread grows tenfold, the variance grows a hundredfold.

Variance is still the preferred measure in theory because it behaves well algebraically. Adding a constant to every value leaves it unchanged, multiplying every value by k multiplies it by k², and for independent quantities the variances add. For skewed data or data with outliers, compare it with the interquartile range and the median.

What Is the Variance If...

What is the variance if all my values are the same?

If every value is identical, the variance is 0. For 5, 5, 5, 5 the mean is 5, every deviation is 0, and the sum of squared deviations is 0, so both sample and population variance are 0. This is the only case where variance is exactly zero.

What is the variance if I only have one value?

One value has a population variance of 0 and an undefined sample variance. A single number has no spread around itself, so the population figure is 0. The sample formula divides by n − 1 = 0, which is not possible, so the calculator shows — for sample variance and standard deviation. Switch to Population to treat the number as the whole group.

What is the variance if I have two values, 3 and 7?

For 3 and 7 the population variance is 4 and the sample variance is 8. The mean is 5, both deviations are 2 away, so SS = 4 + 4 = 8. Dividing by n = 2 gives 4; dividing by n − 1 = 1 gives 8. With two values the sample variance always equals (a − b)² ÷ 2.

What is the variance if my data is 1, 2, 3, 4, 5?

For 1, 2, 3, 4, 5 the population variance is 2 and the sample variance is 2.5. The mean is 3, the squared deviations are 4, 1, 0, 1, 4, and SS = 10. Then 10 ÷ 5 = 2 and 10 ÷ 4 = 2.5.

What is the variance if my data is 2, 4, 4, 4, 5, 5, 7, 9?

For this classic data set the population variance is exactly 4 and the sample variance is about 4.5714. The mean is 5, the squared deviations are 9, 1, 1, 1, 0, 0, 4, 16, and SS = 32. Then 32 ÷ 8 = 4 and 32 ÷ 7 ≈ 4.571429. The population standard deviation is a tidy 2.

What is the variance if I add 10 to every value?

Adding the same number to every value does not change the variance. Shifting 2, 4, 4, 4, 5, 5, 7, 9 up by 10 gives 12, 14, 14, 14, 15, 15, 17, 19. The mean moves from 5 to 15, but every deviation is unchanged, so the population variance is still 4 and the sample variance still 4.571429. Variance measures spread, not position.

What is the variance if I multiply every value by 10?

Multiplying every value by k multiplies the variance by k², so multiplying by 10 makes it 100 times larger. Scaling 2, 4, 4, 4, 5, 5, 7, 9 by 10 gives 20, 40, 40, 40, 50, 50, 70, 90, with a population variance of 400 (4 × 100) and a sample variance of about 457.142857. The standard deviation only grows by a factor of 10.

What is the variance if my data has negative numbers?

Negative numbers are handled like any other value, and the variance is never negative. For −3, −1, 0, 2, 2 the mean is 0, the squared deviations are 9, 1, 0, 4, 4, and SS = 18. The population variance is 18 ÷ 5 = 3.6 and the sample variance is 18 ÷ 4 = 4.5. Use a plain minus sign (−) in front of the number when you type it.

What is the variance if there is an outlier?

One outlier can inflate the variance enormously, because its distance from the mean is squared. The values 10, 12, 11, 13, 12 have a sample variance of 1.3. Add a single 50 and the sample variance becomes 246.8, roughly 190 times larger, even though five of the six numbers are unchanged. If a result looks surprisingly large, check the data for typing errors or an extreme value.

What is the variance if the standard deviation is 3?

A standard deviation of 3 means a variance of 9. Variance is the standard deviation squared, so 3² = 9 and 2.5² = 6.25. Going the other way, a variance of 36 means a standard deviation of 6.

People Also Search For

How to calculate variance in Excel or Google Sheets

Use VAR.S for sample variance and VAR.P for population variance. With 6, 8, 9, 12, 15 in cells A1:A5, =VAR.S(A1:A5) returns 12.5 and =VAR.P(A1:A5) returns 10. If your spreadsheet answer differs from another tool, the usual cause is that one of them used the sample formula and the other the population formula.

How to calculate variance in Python

Use statistics.variance() for a sample and statistics.pvariance() for a population. For 6, 8, 9, 12, 15 they return 12.5 and 10. NumPy's np.var() defaults to the population formula (ddof=0), so pass ddof=1 to get the sample value of 12.5.

How to find variance from a frequency table

Multiply each squared deviation by its frequency, add them up and divide by the total frequency (or by the total minus 1 for a sample). Suppose 2 occurs once, 4 three times, 5 twice, 7 once and 9 once. The total frequency is 8, the mean is 5, and Σf(x − x̄)² = 32, so the population variance is 32 ÷ 8 = 4. To use this calculator, simply type each value as many times as it occurs (2, 4, 4, 4, 5, 5, 7, 9).

What is a good or high variance?

There is no universal good or bad variance, because it depends on the units and scale of the data. A variance of 250 g² can be small for lorry loads and huge for a bag of flour. To compare spread across different scales, divide the standard deviation by the mean (the coefficient of variation). In the filling-machine example, Machine A has about 1.58 ÷ 500 ≈ 0.32% and Machine B about 15.81 ÷ 500 ≈ 3.16%.

How to find the variance of a sum of two variables

For independent variables, the variance of the sum is the sum of the variances. If X has variance 4 and Y has variance 9, X + Y has variance 13 and a standard deviation of about 3.6056 (not 2 + 3 = 5). The same variance of 13 applies to X − Y. This only holds when the variables are independent; correlated variables need an extra covariance term.

Why is sample variance divided by n − 1?

Dividing by n − 1 corrects for the fact that deviations from the sample mean are, on average, smaller than deviations from the true mean. It also reflects the loss of one degree of freedom: once the mean is known, only n − 1 of the deviations can vary freely, because they must add up to zero. See the comparison table above for when to use each form.

Frequently Asked Questions

What is variance in statistics?

Variance is the average of the squared differences between each value and the mean. It measures how spread out a set of numbers is. A variance of 0 means all values are identical, and larger variances mean the values are more spread out. It is the square of the standard deviation.

Should I use sample or population variance?

Use population variance when your numbers are every member of the group you are studying, and sample variance when they are a subset used to estimate a larger group. Most real-world data is a sample, so sample variance (divide by n − 1) is the usual default. If your course or software does not say otherwise, the sample formula is normally the safe choice.

Why is variance in squared units?

Because the deviations are squared, the units are squared too: data in metres gives a variance in square metres. That makes variance harder to interpret than the standard deviation, which is in the original units. Variance is still useful because variances of independent quantities add together.

Can variance be negative?

No. Variance is an average of squared numbers, so it is always zero or positive. If you calculate a negative variance by hand, there is an arithmetic mistake, often from subtracting two large numbers in the shortcut formula.

Can variance be zero?

Yes, but only when every value in the data set is the same. For example 7, 7, 7 has a mean of 7 and no deviations, so the variance is 0. Any data with at least two different values has a positive variance.

Why does the calculator show a dash for sample variance with one number?

Sample variance divides by n − 1, and with one value that is a division by zero, so the result is undefined. Add a second value, or switch to population variance, which is 0 for a single number.

What formats can I paste into the data box?

Separate numbers with commas, spaces, semicolons, tabs or new lines, or any mix of them, so a column copied from a spreadsheet works. Decimals, negative numbers and scientific notation such as 1e3 are accepted. Entries that are not numbers are skipped and counted in the note under the box. Decimal commas (3,5) and thousands separators (1,000) are not supported, because a comma separates values; write 3.5 or 1000 instead.

How many values can I enter?

The calculator does not set a limit on the number of values, so a long column of data works. The deviation table shows the first 10 values to keep the page readable, but the variance, mean, count and sum always use every value you entered.

How many decimal places does it show?

Results are shown to up to 6 decimal places, with trailing zeros removed, so a variance of exactly 4 appears as 4. Very large or very small results switch to scientific notation. Round your final answer to match the precision of your data.

Why is my answer different from my spreadsheet or textbook?

The most common reason is the variance type. Check whether the other tool used the sample formula (n − 1) or the population formula (n); the last row of the results shows both values so you can match one. Rounding intermediate steps can also change the last digits, so keep full precision until the end.

What is the difference between variance and standard deviation?

The standard deviation is the square root of the variance. Both describe spread, but the standard deviation is in the same units as your data, which makes it easier to interpret, while variance is in squared units and is easier to work with in formulas.

Is my data stored or sent anywhere?

No. All calculations run in your browser. Nothing you type is sent to a server or saved, and no account is needed. The Share button only copies a link containing your input to your clipboard.

Last reviewed: November 2026 — formulas and worked examples verified.