Variance Calculator
Data Input
Enter data values to see results
Population Variance and Sample Variance Calculator
A variance calculator computes the spread of data points from the mean. It handles both whole population and sampled data — pick the type, enter numbers, get the variance value.
Population variance and sample variance differ in one place: the divisor. Population variance divides the sum of squared differences by n (total count). Sample variance divides by n − 1 — Bessel's correction — to produce an unbiased variance estimate from sampled data. This correction matters most with small samples. For large datasets, the difference shrinks.
- Uses every data point in the whole population
- Divides sum of squares by n
- Mean symbol: μ (mu) — the true population mean
- Used in census data, full datasets, quality control
- Uses a subset of sampled data from the population
- Divides sum of squares by n − 1 (degrees of freedom)
- Mean symbol: x̄ (x-bar) — estimated mean
- Used in surveys, experimental design, clinical trials
When to use each variance formula
How to Calculate Variance
Variance measures how far each number in a data set sits from the mean. These are the variance calculation steps.
To calculate variance, find the average of the squared differences from the mean. The process is the same for population variance and sample variance — the only difference is whether you divide by n or n − 1 at the end. This statistical variance calculation works for any data set, from survey analysis to machine learning feature selection.
Try it: Enter numbers and watch each step
Type 3–8 numbers separated by commas. The steps below will calculate variance with your data in real time.
Find the Mean (Average)
Add all values in the data set and divide by the count. For [4, 8, 6, 5, 3], the mean is (4+8+6+5+3) ÷ 5 = 5.2. This mean is the center point for every variance calculation.
Subtract Mean to Get Deviations
Subtract the mean from each number to find its deviation. Negative deviations mean the value is below the mean; positive values are above. The sum of deviations always equals 0.
Square Each Deviation
Square each deviation to make it positive. This ensures that deviations below and above the mean don't cancel each other out. Squaring also gives more weight to outliers.
Sum the Squared Deviations
Add all the squared deviations together. This sum is called the Sum of Squares (SS). For our data, it is 1.44 + 7.84 + 0.64 + 0.04 + 4.84 = 14.8.
Divide to Get Variance
Divide the Sum of Squares by N (for population) or n − 1 (for sample). For sample variance, we divide 14.8 by 4 to get 3.7. For population variance, we divide by 5 to get 2.96.
Variance Formula
Anatomy of the variance equations for sample and population data.
Understand the mathematics behind variance calculations.
Interactive: Hover over or tap any symbol in the formula to see what it represents.
Uses n − 1 (Bessel's correction) for an unbiased variance estimate from sampled data. This adjustment accounts for degrees of freedom when the true population mean is unknown.
Divides by n directly. No correction needed because the population mean (μ) is the true mean of the whole population.
How Data Flows Through the Formula
Step-by-Step Variance Example
Let's calculate the variance of a sample dataset: 4, 8, 6, 5, 3.
Consider the data set: 4, 8, 6, 5, 3, 7, 2, 9. We'll calculate both sample variance (s²) and population variance (σ²) for these 8 values. Watch the bar chart below — it shows each data point, the mean line, and the squared deviations as you scroll through each step.
The mean is the center of the data set — every deviation is measured from this point. In the bar chart above, the dashed line marks x̄ = 5.5.
| xᵢ | Deviation (x − x̄) | Squared Deviation (x − x̄)² |
|---|---|---|
| 4 | −1.5 | 2.25 |
| 8 | 2.5 | 6.25 |
| 6 | 0.5 | 0.25 |
| 5 | −0.5 | 0.25 |
| 3 | −2.5 | 6.25 |
| 7 | 1.5 | 2.25 |
| 2 | −3.5 | 12.25 |
| 9 | 3.5 | 12.25 |
Each row shows one data point, its deviation from the mean, and the squared deviation. Notice how values far from x̄ (like 2 and 9) produce much larger squared differences.
This sum of squares (42) represents the total squared distance of all data points from the mean. It's the numerator in both variance formulas.
How to Calculate Variance By Hand
Follow these checklist steps to calculate variance manually without a calculator.
Follow these checklist steps to calculate variance manually without a calculator.
Step 1 Write down your dataset
List all numbers clearly. Count how many values you have (n).
Step 2 Calculate the arithmetic mean
Add all the numbers and divide by n. Note this value.
Step 3 Subtract the mean from each number
Subtract the mean from each raw value. Some will be negative.
Step 4 Square each of the differences
Multiply each difference by itself. All values must be positive.
Step 5 Add all the squared values
Sum the squared differences. This is your Sum of Squares.
Step 6 Divide by n − 1 (sample) or n (population)
This final step gives you the variance.
Variables and Equations
Quick reference guide to symbols, names, and formulas used in variance statistics.
Interactive: Hover over or tap any symbol in the formula to see what it represents.
Click any symbol in the formula above to see its role in the variance equation.
Whole Population Variance Calculation
When the data set includes every member of the group, use population variance — divide by n, not n − 1.
Population variance applies when your data set includes every observation from the whole population — not a sample. Examples: all employees in a company, every test score in a class, all products in a batch during quality control. The formula uses μ (the true population mean) and divides by n (the full count). No Bessel's correction. No degrees of freedom adjustment.
Interactive: How Sample Size Affects Variance
Drag the slider to see how the difference between σ² and s² changes with population size. At small n, the gap is large. As n grows, sample variance converges toward population variance.
Convergence: s² approaches σ² as n grows
Frequently Asked Questions
Everything you need to know about variance.
What is the variance of 6 7 5 9 12 15?
The variance of 6, 7, 5, 9, 12, 15 is calculated as follows. Mean = (6+7+5+9+12+15) / 6 = 9. Squared deviations from the mean: (6−9)²=9, (7−9)²=4, (5−9)²=16, (9−9)²=0, (12−9)²=9, (15−9)²=36. Sum of squares = 74. Population variance (σ²) = 74 / 6 ≈ 12.33. Sample variance (s²) = 74 / 5 = 14.8. Use population variance if these 6 numbers are the whole data set. Use sample variance if they represent sampled data from a larger group.
How to calculate variance of 1, 2, 3, 4, 5?
To calculate variance of 1, 2, 3, 4, 5: Mean = (1+2+3+4+5) / 5 = 3. Deviations from the mean: −2, −1, 0, 1, 2. Squared deviations: 4, 1, 0, 1, 4. Sum of squares = 10. Population variance = 10 / 5 = 2. Sample variance = 10 / 4 = 2.5. Standard deviation is √2 ≈ 1.414 (population) or √2.5 ≈ 1.581 (sample). This data set has low variance because the values are evenly spaced — common in educational assessments and sensitivity analysis.
How to calculate variance in Excel?
To calculate variance in Excel, use VAR.S(range) for sample variance and VAR.P(range) for population variance. Example: =VAR.S(A1:A10) returns the sample variance for cells A1 through A10. Google Sheets uses the same function names. In R, var(x) returns sample variance by default. In Python with NumPy, use np.var(data, ddof=1) for sample variance. SPSS, Minitab, JMP, SAS, and StatCrunch also offer built-in variance functions. On a TI-84 calculator, go to STAT → CALC → 1-Var Stats to see both σ² and s².
How to calculate sample variance?
To calculate sample variance, use the formula s² = Σ(xᵢ − x̄)² / (n − 1). Steps: find the sample mean (x̄), subtract it from each data value, square each result, sum all squared deviations, then divide by n − 1 (not n). The n − 1 denominator is Bessel's correction — it adjusts for the lost degree of freedom when estimating the population mean from sampled data. Sample variance is used in surveys, clinical trials, experimental design, and machine learning feature selection — any situation where your data set is a subset of a larger population.
How to calculate percentage of variance?
To calculate variance as a percentage, use the coefficient of variation (CV): CV = (standard deviation / mean) × 100%. Example: if variance = 25, standard deviation = √25 = 5. If the mean is 50, then CV = (5 / 50) × 100% = 10%. The CV is useful for comparing spread across data sets with different scales — common in financial forecasting, portfolio risk analysis, and quality control. A lower CV means less relative variability.
What is variance in statistics?
Variance in statistics is a measure of how far numbers in a data set spread from the mean. It is the average of the squared differences from the mean. High variance means data points are far apart; low variance means they cluster near the mean. Variance is the foundation for standard deviation, which uses the same units as the original data. Both population variance and sample variance serve as inputs to hypothesis testing, regression analysis, and analysis of variance (ANOVA).
What is the difference between sample variance and population variance?
Sample variance (s²) divides the sum of squared deviations by n − 1 (Bessel's correction). Population variance (σ²) divides by n. Use sample variance when working with sampled data from a larger group — surveys, experiments, clinical trials. Use population variance when the data set covers the whole population — census data, full class test scores, complete batch measurements. The formulas are otherwise identical.
What is the variance formula?
The sample variance formula is s² = Σ(xᵢ − x̄)² / (n − 1). The population variance formula is σ² = Σ(xᵢ − μ)² / n. In both formulas, xᵢ represents each data value, x̄ or μ is the mean, Σ is the summation operator, and n is the count. The variance of a discrete random variable uses a weighted version: Var(X) = Σ[xᵢ² · P(xᵢ)] − μ².
What is the relationship between variance and standard deviation?
Standard deviation is the square root of variance. Variance gives the spread in squared units. Standard deviation converts it back to the original units. Population: σ = √σ². Sample: s = √s². Both variance and standard deviation measure data spread, but standard deviation is easier to interpret because it shares the same scale as the data. In financial forecasting, standard deviation of returns is called volatility.
Can variance be negative?
No, variance can never be negative. The formula squares every deviation from the mean, and squares are always zero or positive. A variance of 0 means all values in the data set are identical — there is no spread at all. Any non-zero data spread produces a positive variance value.
Why do we use n-1 instead of n for sample variance?
Dividing by n − 1 is called Bessel's correction. When you estimate variance from a sample, using n as the divisor systematically underestimates the true population variance. The n − 1 divisor corrects this bias and provides an unbiased variance estimate. The number n − 1 represents the degrees of freedom — you lose one degree of freedom because the sample mean constrains the data. This correction matters most for small samples and becomes negligible for large n.
How many data points do I need to calculate variance?
For population variance, you need at least 1 data point (the variance will be 0). For sample variance, you need at least 2 data points because n − 1 = 0 when n = 1, and division by zero is undefined. In practice, more data points produce a more reliable variance estimate — especially for skewed distributions or data with missing values after outlier removal.
What is the coefficient of variation?
The coefficient of variation (CV) equals (standard deviation / mean) × 100%. It measures relative variability — how large the spread is compared to the average. CV is useful when comparing variance across time series, weighted datasets, or data sets measured in different units. In quality control, a low CV signals consistent output. In portfolio risk analysis, CV helps compare investments with different expected returns.