Variance Calculator
- Mean of the 8 values: 5.00.
- Squared deviations from the mean sum to 32.00.
- Population variance: 32.00 ÷ 8 = 4.00; sample variance: 32.00 ÷ 7 = 4.57.
- Dividing by n − 1 (Bessel's correction) makes the sample variance an unbiased estimate of the population variance — use it whenever your data is a sample of something bigger.
This variance calculator takes a set of numbers you enter and computes both the population variance and the sample variance in one pass. Variance is the mean of the squared deviations from the mean. Population variance divides that sum by n; sample variance divides by n minus 1, a method known as Bessel's correction, which makes it an unbiased estimate of the population value. You should use the sample formula whenever your numbers are a sample drawn from something larger, such as exam scores of one class estimating a school, or a week of measurements estimating a process. Standard deviation is the square root of variance and returns to the original units; for example, the dataset 2, 4, 4, 4, 5, 5, 7, 9 has a mean of 5.00, squared deviations summing to 32.00, population variance of exactly 4.00, sample variance of 4.57, and standard deviations of 2.00 for population and 2.14 for sample.
The method behind this calculator is the accepted standard because the division rule is what keeps each result honest for its purpose: dividing by n describes a complete group, while dividing by n minus 1 corrects the underestimation that occurs when a sample is used to infer a larger population. This page shows the formula, the step-by-step workings, worked examples, and the sources behind these verified results, so you can confirm every number yourself. Additional verified examples include the values 10, 12, 14, 16, 18, which have a mean of 14.00, a squared-deviation sum of 40.00, population variance of 8.00, and sample variance of 10.00, as well as the values 1.5, 2.5, 3.5, 4.5, which give a population variance of 1.25 and a sample variance of 1.67.
Worked examples
The textbook dataset
Primary result: 4.57 — sample variance of 2, 4, 4, 4, 5, 5, 7, 9; the population variance is exactly 4.00. (8 values · 2 · 4 · 4 · 4 · 5 · 5 · 7 · 9)
| Sample variance | 4.57 |
| Population variance | 4.00 |
| Sample standard deviation | 2.14 |
| Population standard deviation | 2.00 |
| Mean | 5.00 |
An even spread
Primary result: 10.00 — five values stepping by 2 around a mean of 14.00. (5 values · 10 · 12 · 14 · 16 · 18 · 0 · 0 · 0)
| Sample variance | 10.00 |
| Population variance | 8.00 |
| Sample standard deviation | 3.16 |
| Population standard deviation | 2.83 |
| Mean | 14.00 |
Decimal values
Primary result: 1.67 — four half-step values with a population variance of 1.25. (4 values · 1.5 · 2.5 · 3.5 · 4.5 · 0 · 0 · 0 · 0)
| Sample variance | 1.67 |
| Population variance | 1.25 |
| Sample standard deviation | 1.29 |
| Population standard deviation | 1.12 |
| Mean | 3.00 |
Variance in one idea
Variance is the mean of the squared deviations from the mean. In plain terms, you find the average distance each data point sits from the center, but you square each distance before averaging. Squaring does two things at once: it makes every value positive so that distances below the mean do not cancel out distances above the mean, and it gives larger gaps more weight than smaller ones. That is why a few points far from the center can drive the variance up much more than many points sitting close to it.
Because each deviation is squared, the units come out squared too. If your data is measured in dollars, the variance is in dollars squared; if it is in inches, the variance is in inches squared. That is why people often take the next step and compute standard deviation, which is the square root of variance and returns to the original units. For the classic dataset 2, 4, 4, 4, 5, 5, 7, 9, the mean is 5.00 and the squared deviations sum to 32.00, giving a population variance of exactly 4.00 and a sample variance of 4.57. The corresponding standard deviations are 2.00 for the population and 2.14 for the sample.
A variance calculator will ask whether your numbers represent an entire population or a sample. Population variance divides the sum of squared deviations by n. Sample variance divides by n minus 1, which is Bessel's correction, and this makes it an unbiased estimate of the population value. Use the sample formula whenever your numbers are a sample drawn from something larger, such as exam scores of one class estimating a school, or a week of measurements estimating a process.
The same logic applies across different datasets. The values 10, 12, 14, 16, 18 have a mean of 14.00 and a squared-deviation sum of 40.00, yielding a population variance of 8.00 and a sample variance of 10.00. The values 1.5, 2.5, 3.5, 4.5 give a population variance of 1.25 and a sample variance of 1.67. The gap between the two results narrows as the dataset grows, because dividing by n minus 1 matters less when n is large.
Worked examples
The table below walks through three verified datasets so you can see exactly what a variance calculator does behind the scenes. In each case the mean is found first, every value is subtracted from that mean, the differences are squared, and the squares are added together. Population variance divides that sum by n, the count of values. Sample variance divides by n minus 1 instead, a step known as Bessel's correction that makes the result an unbiased estimate of the population value.
Use the sample formula whenever your numbers are a sample drawn from something larger — exam scores of one class estimating a school, or a week of measurements estimating a process. Reach for the population formula only when the dataset is the entire group you care about. Standard deviation is the square root of variance and returns to the original units: the first dataset's standard deviations are 2.00 (population) and 2.14 (sample).
| Dataset | Mean | Sum of squared deviations | Population variance | Sample variance |
|---|---|---|---|---|
| 2, 4, 4, 4, 5, 5, 7, 9 | 5.00 | 32.00 | 4.00 | 4.57 |
| 10, 12, 14, 16, 18 | 14.00 | 40.00 | 8.00 | 10.00 |
| 1.5, 2.5, 3.5, 4.5 | 3.00 | 5.00 | 1.25 | 1.67 |
Sample vs population: n or n - 1?
Variance is the mean of the squared deviations from the mean. The choice between n and n − 1 in the denominator comes down to whether your data represents an entire group or just a sample of something larger. Population variance divides the sum of squared deviations by n; sample variance divides by n − 1, a adjustment known as Bessel's correction. That correction makes the sample result an unbiased estimate of the population value.
The reason is straightforward. When you compute squared deviations using the sample's own mean, those deviations tend to be slightly smaller than deviations measured from the true population mean. Dividing by n − 1 instead of n scales the result upward just enough to correct that downward bias. A variance calculator should let you choose which formula to apply, because using the wrong one will understate spread whenever you are working with sample data.
Consider the classic dataset 2, 4, 4, 4, 5, 5, 7, 9. Its mean is 5.00, and the squared deviations sum to 32.00. Dividing by n = 8 gives a population variance of exactly 4.00. Dividing by n − 1 = 7 gives a sample variance of 4.57. The same pattern holds for the values 10, 12, 14, 16, 18: the mean is 14.00, the squared-deviation sum is 40.00, the population variance is 8.00, and the sample variance is 10.00. A smaller set confirms it as well — 1.5, 2.5, 3.5, 4.5 produce a population variance of 1.25 and a sample variance of 1.67.
Use the sample formula whenever your numbers are a sample drawn from something larger. Exam scores from one class estimating an entire school, or a week of measurements estimating an ongoing process, both call for n − 1. Reserve the population formula for cases where you genuinely have every member of the group. Standard deviation, which is the square root of variance and returns to the original units, follows the same choice: for that first dataset the standard deviations are 2.00 using the population formula and 2.14 using the sample formula.
Variance vs standard deviation
Variance and standard deviation carry the same information about spread, but they express it in different units. Variance is the mean of the squared deviations from the mean, which means its unit is the square of whatever you measured — squared dollars, squared seconds, squared points. Standard deviation is simply the square root of variance, and taking that root returns the result to the original units of the data. That difference matters when you need to interpret a result alongside the mean, because a standard deviation of 2.00 points sits naturally next to a mean of 5.00 points, while a variance of 4.00 squared points does not.
A variance calculator typically reports both values so you can choose the one that fits your purpose. Consider the classic dataset 2, 4, 4, 4, 5, 5, 7, 9. Its mean is 5.00, and the squared deviations sum to 32.00. The population variance is exactly 4.00, and the sample variance is 4.57. Taking the square root gives standard deviations of 2.00 for the population and 2.14 for the sample. The same pattern holds for the values 10, 12, 14, 16, 18: mean 14.00, squared-deviation sum 40.00, population variance 8.00, sample variance 10.00. A third example — 1.5, 2.5, 3.5, 4.5 — gives a population variance of 1.25 and a sample variance of 1.67.
The reason two variances exist is that population variance divides the squared-deviation sum by n, while sample variance divides by n − 1. That adjustment, called Bessel's correction, makes the sample result an unbiased estimate of the population value. Use the sample formula whenever your numbers are a sample drawn from something larger — exam scores of one class estimating a school, or a week of measurements estimating a process.
In practice, standard deviation is the value most often reported because its units match the data and readers can picture it on the same scale as the mean. Variance is the value most often used in further calculations, because squared quantities add cleanly and underpin many statistical formulas. Reporting both lets you describe spread in plain terms and carry the math forward without converting back and forth.
FAQs
When do I divide by n - 1 instead of n?
Divide by n - 1 when your data is a sample of a larger population. This corrects for the fact that a sample tends to underestimate spread. For the verified dataset, the choice changes the answer from 4.00 (population) to 4.57 (sample). Use n only when you have the entire population.
What is the variance of 2, 4, 4, 4, 5, 5, 7, 9?
The population variance is 4.00 and the sample variance is 4.57. This dataset comes from a famous statistics lecture, and its mean is exactly 5.00. The two answers differ because the sample formula divides by n - 1 instead of n, adjusting for the fact that a sample tends to underestimate the true spread.
Can variance be negative?
Never — variance is an average of squares, and squared values are always zero or positive. It is zero only when every value equals the mean, meaning there is no spread at all. Any deviation from the mean, positive or negative, becomes positive once squared, so variance can never drop below zero.
How is variance related to standard deviation?
Standard deviation is the square root of variance. For example, a variance of 4.00 gives a standard deviation of 2.00. Taking the square root brings the measure back into the data's original units, making it easier to interpret alongside the mean. This is why standard deviation is often preferred in everyday reporting.
Why square the deviations at all?
Raw deviations always sum to zero, so averaging them would tell you nothing about spread. Squaring makes every deviation positive and penalises large deviations more than small ones, which is exactly what a measure of spread should capture. This way, values far from the mean have a bigger impact on the variance.
Does variance have units?
Yes — variance is in squared units: squared dollars, squared centimetres, and so on. That awkwardness is exactly why standard deviation is quoted more often in reports, since it returns to the original units. Variance remains useful for formulas and comparisons, but its units make it harder to interpret directly.