Xerobit

Variance Calculator: Population and Sample Variance

Enter a list of numbers to calculate the population variance, sample variance, standard deviation, and mean. This variance calculator processes everything locally in your browser so no data is uploaded to any server.

Separate values with commas, spaces, or newlines.

Result

  • Count (n)
    8
  • Mean (μ)
    5
  • Population variance (σ²)
    4
  • Sample variance (s²)
    4.57142857143
  • Population std dev (σ)
    2
  • Sample std dev (s)
    2.1380899353

How to use the variance calculator

  1. Enter your numbers into the text area, separated by commas, spaces, or newlines.
  2. The variance calculator updates automatically as you type.
  3. Read the population variance if your data includes every member of the group.
  4. Read the sample variance if your data is a subset drawn from a larger group.

How variance is calculated

Variance measures how far each number in a set is from the mean. The first step is finding the arithmetic mean (the sum of all values divided by the count). Next, subtract the mean from each value and square the result. Finally, average those squared differences.

For population variance (σ²), divide the sum of squared differences by n, the total number of values:

σ² = Σ(xᵢ - μ)² / n

For sample variance (s²), divide by n - 1 instead. This adjustment, called Bessel's correction, corrects the bias that occurs when estimating a population parameter from a limited sample:

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

Consider the dataset 2, 4, 4, 4, 5, 5, 7, 9. The mean is 40 / 8 = 5. The squared deviations are 9, 1, 1, 1, 0, 0, 4, 16, which sum to 32. Population variance is 32 / 8 = 4. Sample variance is 32 / 7, approximately 4.571.

Population vs. sample variance

Choosing between population variance and sample variance depends on what your data represents. If you have measured every single item in the group you care about, use population variance. For example, if a teacher calculates the variance of exam scores for every student in a single class, that class is the entire population.

If your data is a random subset used to estimate the spread of a much larger group, use sample variance. A quality control engineer testing 50 widgets from a production run of 10,000 would use sample variance because the 50 items represent only a fraction of the whole.

The difference between the two shrinks as the sample size grows. With 1,000 observations, dividing by 1,000 versus 999 produces nearly identical results. With only 5 observations, however, the distinction matters significantly.

Reference table of common datasets

The table below shows pre-computed results for several small datasets. You can verify these against the variance calculator above.

DatasetnMeanPop. variance (σ²)Sample variance (s²)
1, 2, 3320.66671
10, 20, 3032066.6667100
2, 4, 4, 4, 5, 5, 7, 98544.5714
-5, 0, 53016.666725
7, 7, 7, 74700

Relationship to standard deviation

Standard deviation is simply the square root of variance. While variance is expressed in squared units (for instance, square meters if the original data is in meters), standard deviation returns to the original unit, making it easier to interpret alongside the raw data.

Population standard deviation is denoted σ and equals √σ². Sample standard deviation is denoted s and equals √s². Both metrics describe spread, but standard deviation is more commonly reported in scientific papers and dashboards because its scale matches the data directly.

This variance calculator displays both standard deviations alongside the variances so you do not need to compute the square root separately.

Common mistakes to avoid

A frequent error is forgetting to square the deviations before summing them. Without squaring, positive and negative deviations cancel out, yielding zero regardless of the actual spread.

Another mistake is using the sample formula when the data actually constitutes the full population, or vice versa. Dividing by n - 1 when you already have every data point artificially inflates the variance.

Finally, be careful with input formatting. Mixing commas and periods as decimal separators can cause parsing errors. This tool expects standard decimal points and accepts commas, spaces, tabs, or line breaks as delimiters between numbers.

Worked examples

Each result below was produced by the same code the tool runs, so you can check your own numbers against them.

ExampleInputResult
Test scoresNumbers: 85, 90, 78, 92, 88Count (n): 5; Mean (μ): 86.6; Population variance (σ²): 23.84; Sample variance (s²): 29.8; Population std dev (σ): 4.88262224629; Sample std dev (s): 5.45893762558
Daily temperaturesNumbers: 72, 75, 68, 70, 74, 71Count (n): 6; Mean (μ): 71.6666666667; Population variance (σ²): 5.55555555556; Sample variance (s²): 6.66666666667; Population std dev (σ): 2.35702260396; Sample std dev (s): 2.58198889747
Two identical valuesNumbers: 5, 5Count (n): 2; Mean (μ): 5; Population variance (σ²): 0; Sample variance (s²): 0; Population std dev (σ): 0; Sample std dev (s): 0
Single valueNumbers: 42Count (n): 1; Mean (μ): 42; Population variance (σ²): 0; Sample variance (s²): N/A; Population std dev (σ): 0; Sample std dev (s): N/A

FAQ

What does a variance of zero mean?

A variance of zero means every value in the dataset is identical. There is no spread at all.

Why does sample variance divide by n minus 1?

Dividing by n minus 1 applies Bessel's correction, which compensates for the tendency of a small sample to underestimate the true population spread.

Can variance be negative?

No. Because each deviation is squared before averaging, variance is always zero or positive.

Is this variance calculator processed locally?

Yes. All calculations happen in your browser. No numbers are sent to a server.

What is the difference between variance and standard deviation?

Standard deviation is the square root of variance. Variance is in squared units while standard deviation uses the same units as the original data.

How many numbers do I need to calculate sample variance?

You need at least two numbers. With only one value, the denominator n minus 1 becomes zero, making sample variance undefined.