About the Variance Calculator
Variance is the average squared distance from the mean and underlies standard deviation, analysis of variance and risk measures in finance. This variance calculator gives the sample and population variance for any list, with each deviation and its square laid out in a table. For 2, 4, 4, 4, 5, 5, 7, 9 the population variance is 4 and the sample variance about 4.57.
To find the variance, subtract the mean from every value, square each difference so that negative and positive deviations do not cancel, and add the squares. Divide by n for the population variance, σ², when the data is the entire group, or by n − 1 for the sample variance, s², when the data is a sample from a larger group. Variance is in squared units, such as cm², which is why its square root, the standard deviation, is often easier to interpret.
Example: for 6, 2, 3 and 1, the mean is 3 and the deviations are 3, −1, 0 and −2. Their squares add up to 9 + 1 + 0 + 4 = 14. The population variance is 14 ÷ 4 = 3.5 and the sample variance is 14 ÷ 3 ≈ 4.666667, so the sample standard deviation is about 2.160247. Variances of independent quantities add, which makes variance the natural measure in probability and statistics.
For the spread in the original units use the standard deviation calculator; for spread relative to the mean, the coefficient of variation calculator; and for spread based on absolute rather than squared distances, the mean absolute deviation calculator.
How to use the Variance Calculator
- Enter your dataType or paste numbers separated by commas, spaces or new lines.
- Choose sample or populationPick sample if your data comes from a larger group.
- Read the varianceSee the chosen variance, the other one, the mean and the standard deviation.
- Check the tableSee each deviation and squared deviation.
Variance Calculator features
- Sample variance (n − 1) and population variance (n)
- Mean and standard deviation
- Sum of squared deviations
- Formula worked with your data
- Downloadable deviation table
- Paste data from spreadsheets
- Numerically stable two-pass method
Common uses
- Statistics coursework
- Measuring the consistency of results
- Risk and volatility in investing
- Analysis of variance preparation
- Quality control in manufacturing
Variance in practice: why it adds up, portfolios, ANOVA and the bias-variance trade-off
Variance is the average squared distance from the mean, and the standard deviation is its square root. Variance is harder to picture because its units are squared, yet it is the measure statisticians prefer for many calculations, because variances of independent quantities simply add. This guide explains that property with a worked example, its role in investment portfolios and in comparing groups, and why machine learning talks about a bias-variance trade-off.
Why variance, not just standard deviation?
Standard deviation is easier to interpret, because it is in the same units as the data. Variance is easier to calculate with. When independent sources of variation combine, their variances add, while their standard deviations do not. That property makes variance the natural working measure in probability, statistics and engineering, with the standard deviation reported at the end.
A worked example: combining delays
A delivery involves two independent stages: loading, with a standard deviation of 3 minutes, and driving, with a standard deviation of 4 minutes. The variances are 9 and 16 square minutes, so the variance of the total time is 25, and its standard deviation is 5 minutes. Adding the standard deviations would wrongly give 7 minutes and overstate the uncertainty.
This rule explains why combining several independent uncertain steps produces less total uncertainty than you might expect, and it underpins tolerance calculations in engineering.
Portfolios and diversification
In investing, the variance of a portfolio depends not only on each asset's variance but on how the assets move together, measured by covariance. When assets do not always move in the same direction, their combined variance is lower than a weighted average of their variances. This is the mathematical basis of diversification: spreading money across different investments reduces the overall variation of returns.
Comparing groups with ANOVA
Analysis of variance, or ANOVA, tests whether several groups have different means by comparing the variance between groups with the variance within groups. If the group averages differ by much more than the spread within each group would explain, the differences are unlikely to be due to chance. Agricultural trials comparing fertilisers and medical studies comparing treatments use this method.
The bias-variance trade-off
In machine learning and statistics, a model can go wrong in two ways. A model that is too simple misses real patterns, called bias. A model that is too complex fits the noise in the training data and gives very different results with different samples, called variance. Good models balance the two, which is why simpler models sometimes predict new data better than more complicated ones.
Variance in quality and measurement
Measurement systems have variance too. If a scale's readings for the same object vary, that measurement variance adds to the real variation between objects. Quality engineers separate the two to find out whether a process is truly inconsistent or just measured inconsistently, a step called measurement system analysis.
Sample or population variance
The sample variance divides by n − 1 rather than n, which corrects for the fact that a sample's own mean sits closer to its values than the true population mean does. Use the population version only when you have data for every member of the group you care about. For most real data, which is a sample, the n − 1 version is the right choice.
Common mistakes
- Adding standard deviations instead of variances for independent quantities.
- Reporting variance to readers who expect units they can picture.
- Using the population formula for sample data.
- Ignoring covariance when combining related quantities.
Related tools
For the square root of variance, use Standard Deviation Calculator. For group comparisons, try T-Test Calculator, and for averages, Average Calculator.
Variance in spreadsheets
In Excel and Google Sheets, =VAR.S(range) returns the sample variance and =VAR.P(range) the population variance. Taking the square root of either gives the matching standard deviation. When building a model in a spreadsheet, keeping variances in their own cells and converting to standard deviations only for display makes it easy to add up independent sources of variation correctly.
Many small items add up slowly
When many independent items are combined, the total's variance is the sum of their variances, so its standard deviation grows with the square root of the number of items. If each of 100 parcels has a weight that varies with a standard deviation of 0.1 kg, the total weight of the shipment varies with a standard deviation of about 0.1 × √100 = 1 kg, not 10 kg. This is why totals of many uncertain parts are more predictable than any single part.
Squared units
Because variance squares the deviations, its units are squared too: the variance of heights measured in centimetres is in square centimetres, and the variance of prices in rupees is in square rupees. Such units are hard to picture, which is why reports usually give the standard deviation instead. Keep variance for calculations and convert back to standard deviation before explaining results to others.
Limits
Calculations are exact for the data entered; interpretation depends on whether the data is a sample or a whole population.
Frequently asked questions
What is variance?
The average of the squared differences from the mean. It measures spread: the larger the variance, the more the values differ from each other and from their average.
What is the formula for sample variance?
s² = Σ(x − x̄)² ÷ (n − 1), where x̄ is the sample mean and n the number of values. The population formula is σ² = Σ(x − μ)² ÷ n. Dividing by n − 1 rather than n corrects the bias of estimating from a sample.
Why are the deviations squared?
Because positive and negative deviations from the mean always cancel out exactly, so their plain sum is zero. Squaring makes every deviation count and gives extra weight to values far from the mean.
What is the difference between variance and standard deviation?
Standard deviation is the square root of variance. Variance is in squared units, so the standard deviation, in the same units as the data, is usually easier to interpret.
When should I use sample variance?
Whenever your data is a sample used to estimate a larger population, as with surveys or experiments. Use population variance only when you have every member of the group you care about.
Can variance be zero or negative?
It can be zero, when all values are identical, but never negative, because it is built from squared numbers. A negative result always means a calculation mistake.
Why does variance matter in finance?
It measures how much returns swing around their average, a basic measure of risk. Portfolio theory combines the variances of assets, and their covariances, to find mixes with less risk for the same expected return.
How do I calculate variance by hand?
Find the mean, subtract it from each value, square every difference and add the squares. Then divide by n − 1 for a sample or by n for a population. For 6, 2, 3 and 1 the squares add to 14, so s² = 14 ÷ 3 ≈ 4.67.