Sample Variance Calculator
A sample variance calculator computes s² — the unbiased estimate of population variance from sampled data. It uses Bessel's correction (dividing by n−1 instead of n) to account for the lost degree of freedom. Enter your sample data and get sample variance, sample standard deviation, mean, and complete step-by-step breakdowns.
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.
Find Each Deviation from the Mean
Subtract the mean from each value. For 4: (4 − 5.2) = −1.2. For 8: (8 − 5.2) = 2.8. Repeat for every data point. These mean deviations show how far each number sits from center.
Square Each Deviation
Squaring removes negative signs and weights larger deviations more heavily. (−1.2)² = 1.44. (2.8)² = 7.84. This step is why variance uses squared differences — it prevents positive and negative deviations from canceling out.
Sum the Squared Deviations
Add all squared deviations. This gives the total squared distance from the mean: 1.44 + 7.84 + 0.64 + 0.04 + 4.84 = 14.8. This sum of squares is the numerator in every variance equation.
Divide by Count
For population variance, divide by n (here: 14.8 ÷ 5 = 2.96). For sample variance, divide by n − 1 (here: 14.8 ÷ 4 = 3.7). The n − 1 divisor accounts for degrees of freedom in sampled data.
Variance Formula
The variance formula calculates the average of squared differences from the mean. Click any symbol below to see what it represents.
Two variance formulas exist because two situations exist. When you have the complete data set (every member of the group), use the population variance formula. When you only have sampled data (a portion of a larger group), use the sample variance formula with Bessel's correction. Both formulas share the same structure — the only change is the divisor.
Formula Anatomy — Click any symbol
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
Example Calculation
Walk through a complete variance calculation step by step with real numbers and an interactive bar chart.
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ᵢ | xᵢ − x̄ | (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
A step-by-step checklist to calculate variance manually — no software needed.
You don't need a variance calculator tool or statistical software to find variance. Pen, paper, and arithmetic work fine. This checklist applies to any data set — follow it from top to bottom and you'll have your variance value. The same variance calculation steps work whether you compute population variance or sample variance.
Step 1 Write down all values and count them
List every number in the data set. Count the total (n). This count determines whether you divide by n (population) or n − 1 (sample) when computing variance.
Step 2 Add all values and compute the mean
Sum = 3 + 7 + 5 + 9 + 1 = 25. Mean = 25 ÷ 5 = 5. Write this number down — you'll use it in every remaining step of the variance calculation.
Step 3 Subtract the mean from each value
Create a column of deviations. Some are negative, some positive. A quick accuracy check: add them all up — the result should be 0 (or close to it). This works because deviations from the mean always cancel out.
Step 4 Square each deviation and add them up
Multiply each deviation by itself. Then sum them: (−2)² + 2² + 0² + 4² + (−4)² = 4 + 4 + 0 + 16 + 16 = 40. This sum of squares is the basis for both the population and sample variance formulas.
Step 5 Divide by n (population) or n − 1 (sample)
Population variance: 40 ÷ 5 = 8. Sample variance: 40 ÷ 4 = 10. That's your variance value. For standard deviation, take the square root: σ = √8 ≈ 2.83, s = √10 ≈ 3.16.
Variance in common tools
=VAR.S(A1:A5) for sample, =VAR.P(A1:A5) for population
np.var(data, ddof=1) for sample, np.var(data) for population
var(x) returns sample variance by default
Summary of Variables and Equations
Every symbol used in variance formulas, in one place. Click any variable to see its definition and the equations it appears in.
Symbol Connection Map
Click a variable below. Connected equations will highlight, showing where that symbol fits in the variance equation.
Complete Equation Reference
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
At n = 3, sample variance is 50% larger than population variance. At n = 100, the difference is just 1%. This is why the choice between population and sample variance matters most for small data sets.
When you have the whole population
Frequently Asked Questions — Sample Variance Calculator
Everything you need to know about sample variance.
What is sample variance?
Sample variance (s²) measures how spread out values are in a sample taken from a larger population. The formula is s² = Σ(xᵢ − x̄)² / (n − 1). It divides by n−1 (not n) to provide an unbiased estimate of the true population variance. This correction — called Bessel's correction — compensates for using the sample mean instead of the true population mean.
How to calculate sample variance step by step?
To calculate sample variance: 1. Find the sample mean: x̄ = Σxᵢ / n. 2. Subtract the mean from each value: (xᵢ − x̄). 3. Square each deviation: (xᵢ − x̄)². 4. Sum all squared deviations: Σ(xᵢ − x̄)². 5. Divide by n − 1 (not n): s² = Σ(xᵢ − x̄)² / (n − 1). The n−1 is crucial — it's what makes this sample variance rather than population variance.
Why does sample variance divide by n−1 instead of n?
Dividing by n−1 is called Bessel's correction. When you calculate variance from a sample, the sample mean tends to be closer to the sample data points than the true population mean would be. This systematically underestimates variance. Dividing by n−1 corrects this bias, producing an unbiased estimator of the population variance. The number n−1 represents the degrees of freedom — you lose one degree because the mean constrains the data.
When should I use sample variance vs population variance?
Use sample variance (s²) when your data is a subset drawn from a larger population — this includes surveys, experiments, clinical trials, and most real-world scenarios. Use population variance (σ²) only when you have every single data point from the entire population — census data, a complete class of students, or every product in a batch. When in doubt, use sample variance.
What is the sample variance of 3, 7, 7, 19?
For the sample 3, 7, 7, 19: Mean = (3+7+7+19)/4 = 9. Deviations: −6, −2, −2, 10. Squared deviations: 36, 4, 4, 100. Sum of squares = 144. Sample variance (s²) = 144 / (4−1) = 144 / 3 = 48. Sample standard deviation = √48 ≈ 6.928. The high variance reflects the large gap between 19 and the other values.
How many data points do I need for sample variance?
You need at least 2 data points for sample variance. With only 1 data point, n−1 = 0 and division by zero is undefined. In practice, more data points yield a more reliable variance estimate. For normally distributed data, 30+ observations is a common threshold for the sample variance to stabilize.