Quick answer
Variance is s² = Σ(x − x̄)² ÷ (n − 1) for a sample and σ² = Σ(x − μ)² ÷ n for a population. A data set with a mean of 5 and population variance of 4 has a standard deviation of 2.
Enter the data and choose sample or population. The calculator returns the variance and the mean.
Related tools: Standard Deviation Calculator: Sample or population standard deviation with variance and mean. Z-Score Calculator: Standardize a value using a mean and standard deviation. Mean Median Mode Range Calculator: Mean, median, mode and range of a data set.
How to use the Variance Calculator
- Type data set, for example 4, 8, 15, 16, 23, 42.
- Choose data type: Sample (n − 1) and Population (n).
- Press Calculate to see the result, and use Reset to start again.
| Input | What to enter | Allowed values |
|---|---|---|
| Data set | Text, such as 4, 8, 15, 16, 23, 42 | — |
| Data type | Choose one: Sample (n − 1); Population (n) | Starts at Sample (n − 1) |
Formula and method
Formula
s² = Σ(x − x̄)² ÷ (n − 1); σ² = Σ(x − μ)² ÷ n
IEEE-754 double precision; shown to at most 6 decimal places.
Mean of squared deviations (Bessel-corrected for samples).
Worked examples
These examples are verified: each one is an automated test case that the live calculator must reproduce exactly.
Example 1
Inputs: Data set = 2, 4, 4, 4, 5, 5, 7, 9; Data type = Population (n).
| Result | Value |
|---|---|
| Population variance | 4 |
| Mean | 5 |
Example 2
Inputs: Data set = 1, 2, 3, 4, 5; Data type = Sample (n − 1).
| Result | Value |
|---|---|
| Sample variance | 2.5 |
| Mean | 3 |
Example 3
Inputs: Data set = 1, 2, 3, 4, 5; Data type = Population (n).
| Result | Value |
|---|---|
| Population variance | 2 |
| Mean | 3 |
The first line is the headline result (population variance). Below it the variance Calculator lists mean, which describe the same case from other angles. IEEE-754 double precision; shown to at most 6 decimal places.
Sample or population
Divide by n − 1 when the data are a sample (Bessel's correction, which removes bias) and by n when they are the whole population. The sample variance of a single value is undefined.
Units
Variance is in squared units. Take its square root for the standard deviation, in the original units. A variance of 4 corresponds to an SD of 2.
What happens with invalid input
These messages are produced by the calculator itself, so you know what to fix.
- Data set: entering "1" shows "A sample needs at least two values." beside that field and no result.
Choosing between the Variance Calculator and similar calculators
Each row shows what a related calculator on this site asks for and what it returns, so you can pick the one that matches your question.
| Calculator | You enter | It returns |
|---|---|---|
| [Standard Deviation Calculator](/statistics/standard-deviation-calculator/) | data set and data type | Population standard deviation (σ) |
| [Z-Score Calculator](/statistics/z-score-calculator/) | value, mean and standard deviation | Z-score |
| [Mean Median Mode Range Calculator](/statistics/mean-median-mode-range-calculator/) | data set | Mean |
| [Median Calculator](/statistics/median-calculator/) | data set | Median |
| [Relative Standard Deviation Calculator](/statistics/relative-standard-deviation-calculator/) | data set and data type | Relative standard deviation |
Background: descriptive statistics
Population statistics divide by n and sample statistics divide by n − 1 (Bessel's correction), because a sample tends to understate variability. Use the population version when your data is every value in the group, and the sample version when it is a subset.
Defaults differ between tools, and so do quartile conventions, which can give slightly different values for small data sets; this page states the method it uses.
Assumptions and limitations
- Sample needs at least two values
If a required value is empty, not a number, or outside its allowed range, the form marks that field with a message and shows no result instead of a misleading number. The automated checks deliberately try invalid entries for data set to confirm this.
Frequently asked questions
What is the variance of 1, 2, 3?
1 as a sample, 0.667 as a population.
Why n − 1?
Dividing by n − 1 corrects the bias from measuring deviations around the sample mean instead of the true mean.
Can variance be negative?
No. Variance averages squared deviations, so it is zero or positive.
What does the Variance Calculator calculate?
Sample or population variance. It returns Population variance and Mean.
What formula does the Variance Calculator use?
s² = Σ(x − x̄)² ÷ (n − 1); σ² = Σ(x − μ)² ÷ n. Mean of squared deviations (Bessel-corrected for samples).
What do I need to enter in the variance Calculator?
You enter Data set and Data type.
How is the result rounded or limited?
IEEE-754 double precision; shown to at most 6 decimal places. Sample needs at least two values.
What does the “Data type” option change?
It sets how the variance is worked out. The choices are Sample (n − 1) and Population (n).
What is an example of a variance result?
With data set 2, 4, 4, 4, 5, 5, 7, 9 and data type Population (n), the population variance is 4.
Related calculators
- Standard Deviation Calculator — Sample or population standard deviation with variance and mean.
- Z-Score Calculator — Standardize a value using a mean and standard deviation.
- Mean Median Mode Range Calculator — Mean, median, mode and range of a data set.
- Median Calculator — Median of a data set.
- Relative Standard Deviation Calculator — Relative standard deviation (RSD) as a percentage.
- Relative Frequency Calculator — Relative frequencies and percentages from counts.
Sources
- Standard statistics definition (e.g. NIST/SEMATECH e-Handbook of Statistical Methods)
Content last reviewed 2026-11-04. Formulas and worked examples are checked by automated tests against independently computed values.