Variance Calculator

Enter your numbers to calculate population variance (σ²), sample variance (s²), standard deviation and mean — with full step-by-step working shown. Ideal for GCSE, A-Level and university statistics.

What is Variance?

Variance is a measure of statistical dispersion—it quantifies how spread out a set of numbers is around their mean. Specifically, variance is the average of the squared deviations from the mean. A high variance means the data points are spread far from the mean; a low variance means they are clustered close to it.

Variance was formalised by Ronald Fisher in the early 20th century and is now one of the most fundamental concepts in statistics, used in everything from quality control and finance to machine learning and experimental design.

The Variance Formula

There are two versions, depending on whether you are working with a complete population or a sample:

Population Variance (σ²)

σ² = Σ(xᵢ − μ)² / N

Where: Σ = sum of, xᵢ = each data point, μ = population mean, N = total number of data points in the population.

Use this when you have all values in the population (e.g. exam scores for an entire class, not a sample of students).

Sample Variance (s²)

s² = Σ(xᵢ − x̄)² / (n − 1)

Where: x̄ = sample mean, n = sample size. The denominator is n−1 rather than n — this is called Bessel's correction, and it corrects for the bias that arises when estimating a population variance from a sample.

Use this when your data is a sample taken from a larger population, which is the case in virtually all real-world statistical analysis.

How to Calculate Variance: Step-by-Step

Let us work through an example with the data set: 2, 4, 4, 4, 5, 5, 7, 9

Step 1: Find the mean
x̄ = (2+4+4+4+5+5+7+9) / 8 = 40 / 8 = 5
Step 2: Find each deviation from the mean (xᵢ − x̄)
2−5=−3, 4−5=−1, 4−5=−1, 4−5=−1, 5−5=0, 5−5=0, 7−5=2, 9−5=4
Step 3: Square each deviation
9, 1, 1, 1, 0, 0, 4, 16
Step 4: Sum the squared deviations
Σ = 9+1+1+1+0+0+4+16 = 32
Step 5a: Population variance = 32 / 8 = 4.000
Step 5b: Sample variance = 32 / (8−1) = 32/7 ≈ 4.571
Step 6: Standard deviation = √variance
Population SD = √4 = 2.000  |  Sample SD = √4.571 ≈ 2.138

Why n−1? Understanding Bessel's Correction

When we calculate the mean from a sample, the sample mean x̄ is already the "closest" value to each observation—there is a built-in bias towards the centre. This means that Σ(xᵢ−x̄)² tends to underestimate Σ(xᵢ−μ)². Dividing by n−1 instead of n corrects for this, making the sample variance an unbiased estimator of the population variance.

The practical consequence: sample variance is always slightly larger than population variance calculated on the same data. With large samples (n > 30), the difference becomes negligible; with small samples (n < 10), the correction can be substantial.

Variance vs Standard Deviation: What is the Difference?

PropertyVariance (σ² / s²)Standard Deviation (σ / s)
DefinitionAverage squared deviationSquare root of variance
UnitsUnits squared (e.g. cm², kg²)Same units as data (e.g. cm, kg)
InterpretabilityLess intuitiveDirectly interpretable
Mathematical useAdditive for independent varsUseful for z-scores, normal distribution
Sensitivity to outliersHigh (squaring amplifies)High (via variance)

Standard deviation is the more intuitive measure for everyday communication (e.g. "heights vary by ±10 cm from the mean"). Variance is preferred in mathematical derivations because the variances of independent random variables can simply be added (the standard deviations cannot). For example, if X and Y are independent, Var(X+Y) = Var(X) + Var(Y).

When is Variance Used?

Statistics and data science: Variance underpins ANOVA (analysis of variance), regression analysis, principal component analysis (PCA), and virtually all parametric statistical tests. The t-test and F-test both use variance estimates in their denominators.

Finance and investment: Portfolio theory uses variance (and standard deviation) to measure the risk (volatility) of asset returns. The variance of a portfolio of assets depends on the individual variances and the covariances between assets. A higher variance means more unpredictable returns.

Quality control and manufacturing: Six Sigma and other quality frameworks use variance to monitor process consistency. Reducing variance in production processes decreases the rate of defects.

Physics and engineering: Signal noise is characterised by variance. Mean squared error (MSE), widely used in machine learning, is the variance of prediction errors plus the squared bias.

GCSE and A-Level mathematics/statistics: Variance and standard deviation appear explicitly in statistics syllabi. Students must be able to calculate both from raw data and frequency tables, and understand when to use population vs sample formulas.

Alternative Variance Equations and Forms

The variance formula can be rearranged to a computationally convenient form that avoids calculating the mean separately:

σ² = (Σxᵢ² / N) − μ²    (equivalent to the standard formula)

This computational form sums the squares of all values, divides by N, and subtracts the square of the mean. It is useful for hand calculations because you only need two running totals: Σx and Σx².

For a two-variable extension, covariance measures how two variables vary together:

Cov(X,Y) = Σ(xᵢ−μₓ)(yᵢ−μᵜ) / N

When X = Y, covariance reduces to variance. The normalised form of covariance is the correlation coefficient r = Cov(X,Y) / (σₓ × σᵜ).

Frequently Asked Questions

What is the variance formula?

Population variance: σ² = Σ(xᵢ − μ)² / N. Sample variance: s² = Σ(xᵢ − x̄)² / (n−1). The only difference is the denominator: N for population, n−1 for sample. Always use sample variance when working with a subset of a larger population.

How do you calculate variance step by step?

1. Calculate the mean (add all values, divide by n). 2. Subtract the mean from each value (deviation). 3. Square each deviation. 4. Sum all squared deviations. 5. Divide by N (population) or n−1 (sample). 6. Take the square root for standard deviation.

What is the difference between variance and standard deviation?

Variance is the average squared deviation, measured in units squared. Standard deviation is the square root of variance, expressed in the same units as the original data. Both measure spread, but standard deviation is more directly interpretable. Variance has useful mathematical properties, particularly that the variances of independent variables can be added together.

When do you use population variance vs sample variance?

Use population variance (σ², divide by N) when you have every value in the population. Use sample variance (s², divide by n−1) when your data is a sample from a larger population. In practice, sample variance is almost always correct because you rarely have access to the entire population.

What is the variance equation for the normal distribution?

For a normal distribution N(μ, σ²), the parameter σ² is the variance and σ is the standard deviation. Approximately 68% of values fall within ±1σ of the mean, 95% within ±2σ, and 99.7% within ±3σ (the empirical rule).

Mustafa Bilgic
Calculator author — UK Calculator. About the author