Variance Calculator

By Harmain Manzoor · Reviewed by Fahad Ullah

MathStatistics & Probability·Last updated August 10, 2026
Variance Calculator for calculating population and sample variance quickly and accurately online.
Use our Variance Calculator to measure data variability with fast and accurate population or sample variance calculations.

This variance calculator works out the sample or population variance of any data set you enter, along with the standard deviation, mean, and sum of squares that go with it. Choose whether your numbers represent a sample or a full population, type or paste in the values, and the tool will returnHandle the result with every calculation step shown underneath. It is built for anyone who needs an accurate variance figure without doing the arithmetic by hand, whether that is a student checking homework, a researcher summarizing a data set, or an analyst comparing two groups of numbers.

What Does Variance Measure in a Data Set?

Variance describes how far the numbers in a data set sit from their average. If most values cluster tightly around the mean, the variance comes out small. If the values are scattered widely above and below the mean, the variance comes out large. Because the calculation is built from squared differences, the result is always zero or a positive number, and it grows faster than the raw spread of the data since bigger differences carry more weight once they are squared.

On its own, a variance figure does not tell you much. It becomes useful once you compare it against the variance of another data set measured in the same units, or once you use it to work out the standard deviation, which puts the spread back into terms you can read directly.

What Is the Variance Formula?

There are two versions of the variance formula, and which one applies depends on whether your numbers represent an entire population or a sample drawn from a larger group.

Type

Formula

What each symbol means

Population variance

σ² = Σ(xᵢ - μ)² ÷ N

xᵢ is each value, μ is the population mean, N is the total number of values

Sample variance

s² = Σ(xᵢ - x̄)² ÷ (n - 1)

xᵢ is each value, x̄ is the sample mean, n is the number of values in the sample

Both formulas follow the same idea. Subtract the mean from each value, square the result, add up all the squared differences, then divide by the count. The only thing that changes is the number you divide by, and that difference is explained in the next section.

Why Are the Deviations Squared Instead of Just Averaged?

If you simply subtracted the mean from every value and averaged those differences, the positive and negative numbers would cancel each other out, and the result would always land on zero no matter how spread out the data actually was. Squaring each difference solves that problem, since a squared number can never be negative, so the positives and negatives stop canceling, and the total reflects the real spread of the data.

The tradeoff is that variance ends up measured in squared units. If your data is in dollars, the variance is in dollars squared, which is one reason people often convert it into standard deviation before reporting it, since that brings the number back into the original units.

Should You Use Sample Variance or Population Variance?

The most common sticking point when using a variance calculator is not the math itself; it is deciding which option to select. The rule is straightforward once you know what to look for: use population variance only when your data already represents every member of the group you care about, and use sample variance whenever your numbers are a subset that stands in for a larger group you cannot fully measure.

Type

Denominator

Symbol

Use it when

Population variance

N

σ²

Your data set is the entire group you are studying, for example, every student in one class

Sample variance

n - 1

Your data is a smaller group standing in for a larger one; for example, 50 customers surveyed out of 10,000

If you are unsure, ask whether you could, in theory, have collected more data points from the same group. If the answer is yes, you are looking at a sample, and the sample variance option is the one to select in the calculator above.

Why Does Sample Variance Divide by n-1 Instead of n?

Dividing by n - 1 instead of n is known as Bessel's correction, and it exists to fix a small bias. When you calculate a sample mean and then measure how far each point sits from that mean, the points end up looking closer to the average than they really are relative to the true population mean, because the sample mean was built from those same points. Dividing by the smaller number, n - 1, inflates the result just enough to correct for that bias, giving a more accurate estimate of the population's true variance.

This adjustment only applies to sample variance. Population variance does not need it, because the population mean is already the real average, not an estimate.

What Are the Step-by-Step Calculations Behind the Result?

To see exactly how the calculator arrives at its answer, walk through a small example using the sample data set 3, 7, 9, 5, and 6.

Value (x)

Deviation (x - mean)

Squared deviation

3

-3

9

7

1

1

9

3

9

5

-1

1

6

0

0

Total

 

20

The mean of these five numbers is 6. Once you have the squared deviations, add them up to get a sum of 20, then divide by n - 1, which is 4, to get a sample variance of 5. If this same data were treated as a population instead of a sample, you would divide the sum of 20 by N, which is 5, giving a population variance of 4. That one-point difference between the two answers is exactly what Bessel's correction accounts for.

How Do You Interpret Your Variance Result?

Once the calculator returns a number, the next question is usually what that number actually means. A low variance tells you the data points sit close together, near the mean, while a high variance tells you the values are more spread out. What counts as high or low depends entirely on the field and the units involved, so a variance of 50 might be large for one data set and small for another. The most useful way to read a variance figure is in comparison, either against another data set measured in the same units or against the same data set over time, so you can see whether the spread is increasing or shrinking.

Can Variance Ever Be Negative?

No. Variance cannot be negative under any circumstances, because it is built entirely from squared numbers, and a squared number is never negative. If you ever land on a negative variance while working by hand or in a spreadsheet, that result points to a mistake somewhere in the calculation, most often a missed squaring step. The smallest possible variance is zero, which happens only when every value in the data set is identical.

What Does a High or Low Variance Mean in Practice?

A classroom where every student scores close to 80 percent has a low variance in exam results, while a classroom with a wide mix of high and low scores has a high variance, even if both classes share the same average. In investing, a stock whose returns barely move from year to year has low variance and is generally considered more predictable, while a stock with large swings up and down has high variance and is considered more volatile. On a factory floor, a low variance in a part's measurements usually signals a tightly controlled process, while a rising variance over time can be an early warning that something is drifting out of tolerance.

How Does Variance Fit Into Wider Data Analysis?

Variance rarely stands alone. Once you have it, it typically feeds into other calculations, such as standard deviation for reporting, confidence intervals for estimating a range around the mean, or risk models when the data represents financial returns. Depending on what you are trying to find out next, a few related tools and topics can pick up directly from the variance you just calculated.

How Is Standard Deviation Calculated From Variance?

Standard deviation is simply the square root of variance, which brings the measure of spread back into the same units as your original data. If your variance came out to 25 dollars squared, the standard deviation is 5 dollars, a figure that is far easier to explain to someone who is not familiar with statistics. Once you have your variance result from this page, you can run the same numbers through the standard deviation calculator to get that figure directly, along with its own step-by-step breakdown.

How Do You Calculate the Mean of a Data Set?

The mean has to be worked out before variance can be calculated at all, since every deviation in the formula is measured against it. If you only need the average of your numbers, or you want to double-check the starting mean behind a variance result, the mean calculator handles that on its own without walking through the rest of the variance steps.

How Is Variance Used to Measure Investment Risk?

In finance, the variance of an investment's historical returns is one of the standard ways analysts describe how volatile that investment has been. A higher variance means the returns have swung further from their average, which usually signals more risk, though it can also come with the potential for higher returns. Variance alone does not capture everything about risk, since it treats gains and losses the same way, but it remains a useful starting point for comparing how steady or unpredictable different investments have been. For a version of this calculation built specifically around returns and portfolios, the portfolio variance calculator applies the same math in that context.

How Is Variance Used in Confidence Intervals?

A confidence interval gives you a range around a sample mean where the true population mean is likely to fall, and both variance and standard deviation are direct inputs into that range. The more spread out your data is, the wider that interval becomes, because more variance means less certainty about where the true average sits. If you want to take the variance you just calculated and turn it into an actual confidence interval, the confidence interval calculator builds on the same numbers.

How Do You Calculate Variance in Excel, R, or Python?

Spreadsheets and programming languages calculate variance the same way this page does, but they split the sample and population versions into separate functions. In Excel and Google Sheets, VAR.S and STDEV. S handles sample data, while VAR.P and STDEV. P handle population data. R's var() and sd() functions default to the sample formula, so applying them to data that is actually a full population will quietly give you the wrong number unless you adjust for it. Mixing up which function matches which type of data is one of the most common reasons a spreadsheet result does not match a web calculator. The step-by-step guide to calculating variance in Excel and Python walks through the exact formulas and functions for each.

How Do You Calculate Variance for Grouped or Probability-Weighted Data?

Grouped data, where values are organized into frequency bands, and probability-weighted data, such as a discrete random variable, both need a slightly different setup than a plain list of numbers. Instead of treating every value equally, each squared deviation gets multiplied by its frequency or its probability before the values are summed. This calculator is built for raw individual values, so if your data already comes grouped or weighted, the grouped data and discrete variable variance calculator is set up to take that format directly.

What Other Statistics Calculators Work Alongside Variance?

Once you have a variance figure, a few related measures often come up next depending on what you are trying to learn from the data. The coefficient of variation calculator compares spread across data sets with different units, the covariance calculator looks at how two variables move together rather than just one, and the correlation coefficient calculator measures the strength of that relationship on a fixed scale. If you want to see the raw sum of squared deviations before it is divided down into a variance, the sum of squares calculator isolates that step on its own, and the z-score calculator uses your mean and standard deviation to show where a single value falls relative to the rest of the data.

Frequently Asked Questions

Can variance be negative?

No. Variance is calculated from squared differences, and a squared number is never negative, so the result is always zero or higher. If a calculation produces a negative variance, there is an error somewhere in the working, not a valid result.

Should I use sample variance or population variance for my data?

Use population variance only if your data set already covers everyone or everything you are studying. Use sample variance whenever your numbers are a smaller group standing in for a larger population you have not fully measured.

Why does sample variance divide by n-1 instead of n?

Dividing by n - 1 corrects a small bias that comes from estimating the mean using the same sample you are measuring. This adjustment, known as Bessel's correction, gives a more accurate estimate of the true population variance.

What does 20% variance mean?

This phrase usually has nothing to do with statistical variance. It typically refers to a percentage difference between an actual figure and a planned or expected one, a concept used in budgeting and forecasting rather than the spread calculation covered on this page.

What is the variance between two numbers?

This can mean the statistical variance of a two-value data set, though that calculation carries little meaning with only two points. More often, it is used loosely to describe the plain difference or percentage gap between two figures, which is a separate calculation from statistical variance.


work,

Related Calculators

System of Inequalities Calculator

Instantly solve systems of linear and non-linear inequalities step-by-step with interactive overlapping shaded regions, solid/dashed boundary lines, and 2D/3D graphs.

Leave Your Feedback

Help us improve this calculator

Rating

Recent Feedback

No feedback yet.