Sample Variance Calculator
Calculate the sample and population variance of your data set, with the mean, sum of squares, and a step-by-step breakdown. Free, instant, and shows the work.
https://hexacalculator.com/calculators/mathematics/statistics/sample-variance-calculator
Mathematics
Statistics
Sample Variance Calculator
Calculate the sample and population variance of your data set, with the mean, sum of squares, and a step-by-step breakdown. Free, instant, and shows the work.
Sample Variance Calculator
Your data
5 values
Show related measures
Add the coefficient of variation and the standard error of the mean.
Results
- Sample standard deviation (s)
- Population standard deviation (σ)
- Minimum
- Maximum
- Range
Charts, steps, and the empirical rule
Show the charts
Plot your values and how far each one sits from the mean.
Show the calculation steps
List every value with its deviation and squared deviation from the mean.
Show the empirical rule
The 68, 95, and 99.7 percent ranges around the mean for a normal distribution.
Sample variance is a measure of the spread of a set of numbers. As it is the average of the squared differences between each value and the mean, a small sample variance indicates that the data are clustered around the mean while a large variance indicates that the data are more spread out.
This calculator will provide you with the standard deviation, mean, sum of squares and range in addition to sample variance and population variance. After selecting your data type and entering your comma separated values, you can view the full analysis results.
What it measures:
Each value in a data set is at some distance from the mean. The variance takes all of those distances and combines them into a single number by squaring each one and then averaging the result.
There are two reasons why squaring is important. First, the signs disappear so that values above and below the mean cannot cancel each other out. Second, values farther from the mean get a bigger weight than values closer to the mean.
The variance can never be negative as it is the average of squared numbers. If the variance is zero then all values are equal and the greater the spread of values the larger the variance.
Sample variance and population variance.
The only choice that changes the outcome is whether the numbers represent a sample or the entire population. A population is the complete set of elements we are interested in while a sample is part of it and has been drawn from this population.
In a population the sum of squared deviations is divided by N, which is the number of values. In a sample it is divided by n minus 1.
The smaller denominator in this formula is called the Bessel's correction. Because when calculating from a sample, we use the mean of the sample instead of the true mean of the population, the measured variance will be slightly lower. To correct for this bias and ensure that the sample variance fairly estimates the variance of the population to which the data belongs, we divide by a number that is n minus 1 rather than just n.
The population formula is only used when we actually know all members of the population. If the data represents a part of a larger population then the sample formula should be used and again by default it uses the sample formula.
This is how you calculate variance.
The formula may seem complicated but it's actually just four simple steps.
As a first step, add all the numbers and divide by the number of values to get the average. In the second step, subtract the average from each value to obtain the deviation, then square this deviation.
In the third step, the squared deviations are added together. This sum is the sum of squares. In the fourth step, in a sample, you divide the sum of squares by (n - 1), and for a population, you divide it by N.
A full example:
We're looking at five numbers: 1, 5, 7, 8 and 9. This is a data set that's already loaded into this calculator. The sum is 30, so the mean is 6.
The deviations from the mean of six are negative five, negative one, one, two and three. When you square them, you get 25, 1, 1, 4 and 9, which add up to 40. This sum is called the sum of squares.
The sample variance of 10 is obtained by dividing the sum of squared differences of 40 by a number that is 1 less than n (so by 4).
If the same pairs of numbers are considered a population, then divide by 5. Unlike when dividing by 4 for a sample, this gives the population variance of 8. Although the data is identical, the result from the sample calculation is slightly larger because the formula for sample variance avoids underestimating the spread.
Variance and standard deviation
The standard deviation is the square root of the variance and the variance is the square of the standard deviation. The two are closely related, and contain exactly the same information about spread.
The difference is in the units. For example, if the unit of the numbers was centimeters, then the unit of the variance would be square centimeters while the standard deviation's unit would still be centimeters. This is why the standard deviation is often quoted. On the other hand, the variance is used when a number that can be added directly in mathematical calculations such as analysis of variance or portfolio theory is needed.
In the above example, the sample standard deviation is 3.162 for a sample variance of 10 while the population standard deviation is 2.828 for a population variance of 8.
Simple formula
There are also algebraically equivalent methods to compute the sum of squares without directly computing the deviations.
For the values of 1, 5, 7, 8, and 9, the sum of these values is 30, and the sum of squares is 220. So the sum of squares is 220 minus 900 divided by 5, so 220 minus 180, which is 40, this corresponds to the previous sum, and then the sample variance again comes from dividing 40 by 4, which gives us 10.
The simple formula is convenient for manual calculations but can lead to inaccuracies when there are large differences between the mean and the spread because of subtracting nearly identical large numbers. For this reason, software programs usually use a method that performs this calculation in two steps.
Common Mistakes
Forgot to square the differences.The sum of the original deviations from the mean is always zero, so they must be squared before being summed; otherwise the dispersion would disappear.
A division by a false value.In the calculation for a sample, it is divided by the number reduced by 1 from n while in the calculation of population it is divided by N. The use of n for the sample leads to an underestimation of variance.
The square units are ignored.The unit of variance is the square of the original unit. By taking the square root, we get back to standard deviation which can be compared with the original data.
Use of sample variance:
In finance, the variance of returns is a key indicator for measuring risk and volatility, and used in models such as portfolio optimization and CAPM. As variances of independent assets can be added directly, it is often preferred to use variance rather than standard deviation in mathematical calculations.
In manufacturing and quality management, a low variance indicates that the process is stable and consistent while an increase in variance may indicate that product measurements are slowly going out of specification.
In research and biology, variance is the basis of analysis of variance. Analysis of variance breaks down the total variance of an experiment into portions explained by treatment factors and a random portion in order to measure the extent of differences between repeated results.
Symbols used:
The symbols used in the above formula are shown in the table below.
Symbol | Meaning | Example |
|---|---|---|
x sub i | One value in the data set | 9 |
x-bar | The sample mean | 6 |
mu | The population mean | 6 |
n or N | How many values there are | 5 |
s squared | Sample variance | 10 |
sigma squared | Population variance | 8 |
This calculator is a general tool for education and analysis. For formal statistical work you should check whether your data are a sample or population, and which measure of spread is appropriate to the problem at hand.
Frequently asked questions
- What is sample variance?
Sample variance is a measure of the spread of a set of numbers. It is calculated by taking the sum of the squared differences between each value and the mean, then dividing that number by 1 less than the number of values. The larger the sample variance, the more spread out the data are from the mean.
- Why is a sample divided by a number that is 1 less than the number of values?
When calculating with samples instead of the unknown population mean, the sample's own mean is used, which leads to a slightly smaller variance. This method of dividing by 1 less than the number rather than n is called Bessel's correction and compensates for the bias so that the sample variance can be an unbiased estimate of the population variance.
- What is the difference between sample variance and population variance?
Both are the average of the squared deviations. The population variance is calculated by dividing the sum of squares by N, which is the total number of values, giving a correct result when the whole population is present. The sample variance is divided by n minus 1 because the data represents only a subset that is representative of a larger population, resulting in a slightly larger value.
- What is the difference between variance and standard deviation?
The standard deviation is the square root of the variance. Both contain the same information but while the unit of the variance is the square of the original unit, the unit of the standard deviation has the same units as the data itself. For this reason, the standard deviation is often quoted.
- Can variance be negative, and what are its units?
The variance is the mean of squared numbers and therefore can never be negative. The variance is only zero if all numbers are equal. The unit of the variance is the square of the original unit of data. For example, if a dataset was measured in centimeters, then the unit of the variance would be square centimeters.
Related calculators






Disclaimer: This calculator is provided for general informational and educational purposes only. Our calculators are under active development, and results may be inaccurate, incomplete, or unsuitable for your situation. Always verify the figures independently and seek advice from a qualified professional before relying on them. We make no warranties and accept no liability for any loss or decision arising from use of this tool.
References
- Wikipedia: Variance
Definition, sample and population formulas, and the computational shortcut.
- Wikipedia: Bessel's correction
Why the sample variance divides by n minus 1.
- Wikipedia: Standard deviation
How variance relates to the standard deviation.