Variance Calculator
Compute population or sample variance from the sum of squared deviations and the sample size. The fundamental measure of how spread out a dataset is around its mean, and the building block of standard deviation, ANOVA, and most parametric inference.
Last updated: May 2026
Compare with similar
About this calculator
Variance measures the average squared deviation from the mean. The formulas are: population variance σ² = Σ(xᵢ − μ)² / N, and sample variance s² = Σ(xᵢ − x̄)² / (n − 1), where Σ(xᵢ − μ)² is the sum of squared deviations (the ‘sum_squares’ input), N or n is the count of observations, and μ or x̄ is the mean. The denominator differs: population variance divides by N, while sample variance divides by (n − 1) — Bessel’s correction. Bessel’s correction is needed because using the sample mean (rather than the true population mean) to compute deviations slightly underestimates the true spread; dividing by (n − 1) instead of n compensates exactly, producing an unbiased estimator of the population variance. Variance has units of the data squared (kg² for kg, $² for dollars), which is why standard deviation — the square root of variance — is preferred for human-readable reporting in the original units. Edge cases: variance is always non-negative; equals zero only when every observation is identical. Sample size n = 1 makes sample variance undefined (divide by zero); n = 0 makes both formulas undefined. For very small samples (n < 10) variance estimates are noisy and confidence intervals around them are wide. Outliers inflate variance dramatically because deviations are squared — a single extreme observation can dominate the result, which is one reason robust statistics use median absolute deviation (MAD) instead in heavy-tailed data.
How to use
Example 1 — Sample variance of exam scores. Five students score 70, 80, 90, 85, 75. Mean = (70+80+90+85+75)/5 = 80. Squared deviations: (70−80)² = 100, (80−80)² = 0, (90−80)² = 100, (85−80)² = 25, (75−80)² = 25. Sum of squares = 250. Enter n = 5, sum_squares = 250, variance_type = sample. s² = 250/(5−1) = 62.5. ✓ The standard deviation is √62.5 ≈ 7.91, meaning typical scores lie about 7.9 points from the mean. Example 2 — Population variance, same data. If those five students are the entire population, use the population formula instead. σ² = 250/5 = 50. ✓ The result is smaller than the sample variance (62.5) — Bessel’s correction at work. As n grows the difference shrinks: at n = 30, sample and population variance differ by less than 4%, and at n = 100 by about 1%.
Frequently asked questions
What is the difference between sample variance and population variance?
Population variance σ² describes the spread of an entire population — if you have measurements for every member, divide by N. Sample variance s² describes the spread of a subset drawn from a larger population — divide by (n − 1) to correct for the fact that the sample mean is used in place of the unknown population mean. The n − 1 denominator (Bessel’s correction) makes the sample variance an unbiased estimator of the population variance; using n instead would systematically underestimate true spread. For small samples (n < 30) the difference matters; for large samples it is negligible. In practice, almost all real-world data is a sample from a larger population (you measure 100 customers, not the entire customer base), so the sample formula is the right default unless you genuinely have the whole population.
Why is variance always non-negative?
Because deviations are squared before summing, every term in the numerator is ≥ 0, so the sum (and hence the variance) cannot be negative. Variance equals exactly zero only in the degenerate case where every observation is identical — no spread, no variability. This non-negativity property is mathematically convenient and is what allows variance to be aggregated and decomposed cleanly in ANOVA and regression: total variance = explained variance + residual variance, with all three quantities non-negative. The squaring also has a downside: variance has units of the data squared (kg² for weights, $² for dollars), which is hard to interpret directly. That is why standard deviation — the square root of variance — is more often reported, since it has the same units as the original data.
Why does variance use squared deviations instead of absolute deviations?
Squaring has several mathematical advantages over taking absolute values. First, squared deviations are differentiable everywhere, which makes optimisation easy (the mean minimises the sum of squared deviations exactly, while the median minimises the sum of absolute deviations). Second, the sum of squares decomposes naturally into orthogonal components in ANOVA and regression, leading to elegant analyses. Third, sums of squared deviations follow chi-squared distributions under normality, enabling F-tests and confidence intervals. Mean absolute deviation (MAD) is an alternative that is more robust to outliers and easier to interpret, but lacks the clean mathematical properties that make variance so central to inferential statistics. In modern robust statistics, MAD is preferred when outliers are a concern; in classical parametric statistics, variance dominates because the math works out.
What are the most common mistakes people make computing variance?
The first is using n instead of (n − 1) for sample variance — slightly underestimates true spread, especially for small samples. The second is computing variance directly from the data list when you only have summary statistics; this calculator wants the sum of squared deviations, which you compute by first finding the mean, then subtracting it from each value, squaring, and summing. The third is confusing variance with standard deviation: variance is in squared units (m² for metres of measurement), standard deviation is in original units (m). The fourth is computing the sum of squares using xᵢ² instead of (xᵢ − x̄)² — the raw sum-of-squares formula is Σxᵢ² − (Σxᵢ)²/n, but plugging Σxᵢ² directly into a (n−1) divisor gives a wildly wrong answer. The fifth is treating variance as if it had meaning at very small n (n = 2 or 3); variance estimates are highly unstable for tiny samples and need confidence intervals to be honest.
When should I not use this calculator?
Skip it if you only have the raw data, not the sum of squared deviations — use a mean+standard-deviation calculator that handles the deviation arithmetic for you, or paste the data into a spreadsheet’s VAR.S / VAR.P. Avoid it for highly skewed or heavy-tailed data where squared deviations are dominated by outliers; report median absolute deviation (MAD), interquartile range, or robust scale estimates instead. It is the wrong tool for categorical data where the concept of variance doesn’t apply. Do not use it for time series with autocorrelation, where the basic variance formula underestimates true spread because consecutive observations are not independent. And for very small samples (n ≤ 3) the variance estimate is so noisy it carries little information; collect more data before trying to summarise spread.