Variance Calculator

Separate numbers with commas, spaces, or line breaks.

Calculation process

Step 1: Calculate the mean

Step 2: Subtract the mean from each value and square the result

Step 3: Divide the sum of squared deviations by the divisor


What is the variance?

The variance measures how spread out a set of values is around its mean. It is the average of the squared deviations from the mean: each value’s distance from the mean is squared (so positive and negative distances do not cancel out), and those squares are averaged. A variance of zero means every value is identical; the larger the variance, the more dispersed the data.

Because the deviations are squared, the variance is expressed in squared units (hours², dollars², points²). That makes it hard to read directly, which is why the standard deviation, its square root, is usually reported alongside it. Variance is nonetheless the quantity that most statistical methods actually work with: ANOVA, regression, and the t-test all partition or compare variances.

Two versions exist, and the calculator above lets you switch between them:

  • Sample variance (s²) — use when your data are a sample from a larger population. The sum of squared deviations is divided by n − 1.
  • Population variance (σ²) — use when your data are the entire population of interest. The sum of squared deviations is divided by N.

Dividing by n − 1 (Bessel’s correction) corrects for the fact that a sample’s values sit closer to their own mean than to the true population mean, which would otherwise make the variance estimate too small. Most software defaults to the sample formula: R’s var(), Excel’s VAR.S, and SPSS all divide by n − 1.

Variance formula

Sample variance

s² = Σ(xi − x̄)²n − 1
  • — sample variance
  • xi — each individual value
  • — sample mean
  • n — number of values in the sample

Population variance

σ² = Σ(xi − μ)²N
  • σ² — population variance
  • μ — population mean
  • N — number of values in the population

How to calculate variance by hand

Both versions follow the same three steps; only the divisor in step 3 changes.

Example 1: sample variance

Six students report the number of hours they studied for an exam: 12, 15, 9, 20, 14, 18. Treat this as a sample.

Step 1 — Find the mean. n = 6    x̄ = (12 + 15 + 9 + 20 + 14 + 18) / 6 = 88 / 6 = 14.6667
Step 2 — Subtract the mean from each value, square the result, and add up the squares.
xixi − x̄(xi − x̄)²
1212 − 14.6667 = −2.66677.1111
1515 − 14.6667 = 0.33330.1111
99 − 14.6667 = −5.666732.1111
2020 − 14.6667 = 5.333328.4444
1414 − 14.6667 = −0.66670.4444
1818 − 14.6667 = 3.333311.1111
Sum079.3333

The deviations always sum to zero, which is a quick check on the mean. Σ(xi − x̄)² = 79.3333 is called the sum of squares.

Step 3 — Divide the sum of squares by n − 1. s² = 79.3333 / (6 − 1) = 79.3333 / 5 = 15.8667
Sample variance s² = 15.8667

Paste the same six numbers into the calculator above with “Sample” selected to confirm.

Example 2: population variance

Now suppose those six students are the entire class (the whole population of interest), so we use the population formula on the same data.

Steps 1–2 are identical: μ = 14.6667 and Σ(xi − μ)² = 79.3333.
Step 3 — Divide by N (not N − 1). σ² = 79.3333 / 6 = 13.2222
Population variance σ² = 13.2222

The population variance is smaller than the sample variance (13.2222 vs 15.8667) because the divisor is larger. The gap shrinks as the number of observations grows; with hundreds of values the two are nearly identical.

Which one should I report?

  • Survey responses, experimental measurements, or any data meant to generalize beyond the cases you collected → sample (s²).
  • Every unit you care about is in the data set — all employees in a department, all exam scores in one class you are only describing → population (σ²).

Related Tutorials

Calculate Population Variance in Excel

Population Variance Formula and Calculation by Hand

Calculate Sample Variance in Excel

Sample Variance Formula and Calculation by Hand

Difference between Population Variance and Sample Variance

Test Homogeneity of Variance in R

Leave a Comment

Your email address will not be published. Required fields are marked *