Variance Calculator
Type or paste numbers and get the variance. The sum of squares and the division are shown with your numbers.
https://flxcode.com/variance-calculator/
Paste a column or row from Excel, Google Sheets or a CSV file, or type numbers separated by spaces, commas or new lines. A header word is ignored.
Example Variance
Sample variance (s²)
Read 7 numbers.
| Count (n) | 7 |
|---|---|
| Sum | 99 |
| Mean (x̄) | 14.1429 |
| Sample standard deviation (s) | 2.4103 |
| Population standard deviation (σ) | 2.2315 |
| Sample variance (s²) | 5.80952 |
| Population variance (σ²) | 4.97959 |
| Standard error of the mean (s / √n) | 0.911006 |
The steps, with your numbers
Mean: x̄ = Σx / n = 99 / 7 = 14.1429
Squared distances from the mean: Σ(x − x̄)² = (12 − 14.1429)² + (15 − 14.1429)² + (11 − 14.1429)² + … + (13 − 14.1429)² + (16 − 14.1429)² = 34.8571
Sample variance: s² = Σ(x − x̄)² / (n − 1) = 34.8571 / 6 = 5.80952
Sample standard deviation: s = √s² = √5.80952 = 2.4103
No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it.
Problem or idea? Email us
Quick start
- Enter the numbers in the box. One per line from a spreadsheet works fine.
- Choose sample variance (s²) or population variance (σ²).
- The big number is the variance. The table below it also lists the standard deviation, the mean and the count.
Variance formulas
| Kind | Formula | Spreadsheet |
|---|---|---|
| Sample variance | s² = Σ(x − x̄)² / (n − 1) | =VAR.S(A1:A10) |
| Population variance | σ² = Σ(x − μ)² / N | =VAR.P(A1:A10) |
| Shortcut form | σ² = Σx² / N − μ² | Gives the same answer, but loses digits with big numbers |
Worked examples
| Numbers | Mean | Sum of squares | σ² | s² | Note |
|---|---|---|---|---|---|
| 12 15 11 14 18 13 16 | 14.1429 | 34.8571 | 4.97959 | 5.80952 | The default set in the tool above. |
| 4 8 6 5 3 7 | 5.5 | 17.5 | 2.91667 | 3.5 | Six small numbers. |
| 100 102 98 101 99 | 100 | 10 | 2 | 2.5 | Tight around 100. |
| 60 140 20 180 100 | 100 | 16,000 | 3,200 | 4,000 | Same mean, far more spread. |
The last two rows have the same mean, 100, and very different variances. That is the point of the number: the mean hides how spread out the data are.
Why variance squares the distances
Distances from the mean add up to exactly zero, so they cannot be averaged as they are. Squaring removes the signs, and it also counts a far away value much more than a near one. A value 10 away adds 100, a value 1 away adds 1. That is why one outlier can double a variance.
For several independent variables the variance of a sum is the sum of the variances. Standard deviations do not add this way, which is why statistics uses variance in the formulas and standard deviation for reporting. For the root of it, see the standard deviation calculator.
Numbers this uses
Every constant the tool uses is listed here with its source. Where a number varies, you can edit it in the tool.
- Maximum size is 100,000 numbers. A limit for speed in the browser.
- Sum of squares is Σ(x − x̄)² with the mean taken first. The two-pass method, which stays accurate for large numbers such as 1,000,000 and up.
- Units is the square of your unit. A variance of cm² cannot be compared with a mean in cm.
Common mistakes
- Mixing up s² and σ². Check whether your data are a sample or the whole group.
- Quoting a variance with the unit of the data. It is in squared units.
- Averaging two variances to get a combined variance. Combine the sums of squares and counts instead.
Nothing you type or paste is uploaded. We count events without cookies (details).
FAQ
What is variance?
Variance is the average squared distance of the numbers from their mean. The default numbers above have a mean of 14.1429 and a sample variance of 5.80952. Squaring makes every distance positive, so highs and lows do not cancel out.
How is variance different from standard deviation?
Standard deviation is the square root of variance. Variance is in squared units (cm² if the data are in cm), which makes it hard to picture. Standard deviation goes back to the original unit. Variance is easier to work with in formulas, because variances of independent things add up.
Do I divide by n or n − 1?
Divide by n when the numbers are the whole population, and by n − 1 when they are a sample. For 4, 8, 6, 5, 3, 7 the population variance is 2.91667 and the sample variance is 3.5. Pick the switch above to see either one.
What are the Excel and Google Sheets formulas?
VAR.S for a sample and VAR.P for a population, for example =VAR.S(A1:A10). The older VAR is the same as VAR.S. Both programs also have VARA and VARPA, which count text and TRUE or FALSE as numbers.
Can variance be negative?
No. It is a sum of squares divided by a count, so it is 0 or more. It is 0 only when all the numbers are equal. If a formula gives a negative variance, there is a mistake, usually from the shortcut formula with rounded numbers.
What is the sum of squares?
It is Σ(x − x̄)², the top half of the variance formula. For the default set it is 34.8571. The steps block shows it with your own numbers. Divide it by n − 1 for the sample variance.
How do I compare the spread of two groups?
Compare their variances or standard deviations, in the same unit. 100, 102, 98, 101, 99 and 60, 140, 20, 180, 100 both have a mean of 100, but the variances are 2.5 and 4,000.
Is my data sent anywhere?
No. The numbers stay in your browser. They are not put in the address bar, not stored and not counted. We only count which mode you used.
More from FLXCode
Standard Deviation CalculatorNew
Paste your numbers and get the sample and population standard deviation, with the steps shown.
Mean, Median, Mode CalculatorNew
Mean, median, mode and range of a list of numbers, with the working shown.
Correlation Coefficient CalculatorNew
Pearson r, r squared, Spearman rho and p-value from two pasted columns, with a scatter plot.
Average CalculatorNew
Average (mean) of pasted numbers, or a weighted average for grades and prices, with the steps.