Quick answer: The variance measures how spread out a set of numbers is around its mean, in squared units. Find the mean, subtract it from every value, square those differences, and average the squares — dividing by n for a whole population, or by n minus 1 for a sample. Paste your numbers above and this calculator does every step for you, shows the working line by line, and reports both variances plus both standard deviations.

How to use this variance calculator

Step 1 — Paste your data. Type or paste your numbers into the box, separated by commas, spaces or new lines. A column copied from a spreadsheet works as-is, because each line break is treated as a separator. Anything that is not a number is ignored, so a stray label in a pasted column does not break the calculation, though you should still scan the count in the results to be sure every value you intended was read.

Step 2 — Read both variances. The headline figure is the population variance, written sigma squared. Directly beneath it sit the sample variance, the mean and the count, and below those the sum and both standard deviations. Nothing needs configuring: both versions are calculated on every run, because choosing between them is a judgement about your data, not a setting. If the square-root figures are the ones your course or report actually asks for, the companion Standard Deviation Calculator headlines those instead, with the same step-by-step table.

Step 3 — Check the working. The table lists every value, its deviation from the mean, and its squared deviation. If you are answering a textbook question, this is the layout to copy: it is the presentation examiners expect, and it makes slips easy to spot, because the deviations column must add up to zero (within rounding) and the squared column ends in the sum of squared deviations both variances are built from.

Step 4 — Save your result. Download, copy or email the summary, which records your data set alongside every statistic, so the numbers can be reproduced later. Your data stays on your device: the calculation runs entirely in your browser, and nothing is uploaded or stored.

Population vs sample variance

In short: if your numbers are the entire group you are describing, divide by n — that is the population variance. If your numbers are a sample used to estimate a larger group, divide by n minus 1 — that is the sample variance, and it is always the larger of the two.

The distinction is about what the numbers represent, not about size. The marks of every student in one class, used to describe that class, are a population — all 30 of them are present, nothing is being estimated. The marks of 30 students sampled from a whole school, used to talk about the school, are a sample: the other students exist but were not measured, and the statistic is an estimate of the variance the full school would show.

Why does the sample version divide by one less? Because a sample almost always hugs its own mean a little more tightly than the true population mean — the sample mean is calculated from the same values, so it sits as close to them as any point can. Measured against that fitted mean, the spread comes out slightly too small, systematically. Dividing the squared deviations by n minus 1 instead of n inflates the result just enough to correct that bias on average. The fix is called Bessel’s correction, and it matters most for small samples: with n equal to 8 it changes the divisor from 8 to 7, lifting the variance from exactly 4 to about 4.571, while with n equal to 800 the difference is barely visible.

Exam questions usually tell you which one they want: “the variance of these marks” for a complete listed set means population; “estimate the variance” from sampled data means sample. Software makes the same distinction — Excel and Google Sheets offer VAR.P and VAR.S — mapped to this page in the software section below.

How to calculate variance, step by step

The four steps: (1) add up the values and divide by the count to get the mean; (2) subtract the mean from every value to get its deviation; (3) square every deviation; (4) average the squared deviations — dividing by n for a population or n minus 1 for a sample. That average is the variance. A fifth, optional step — taking the square root — turns it into the standard deviation.

Each step exists for a reason. Deviations are squared for two reasons at once: squaring makes every deviation positive, so values above and below the mean stop cancelling each other out — the raw deviations of any data set always sum to exactly zero — and squaring gives larger deviations more than proportional weight, so a value far from the mean counts heavily, which is what a spread measure should do. Averaging those squares makes the result a per-value measure of spread rather than a total that grows with the size of the data set.

In symbols, the population variance is sigma squared equals the sum of (x minus the mean) squared, divided by n. The sample version, written s squared, is identical except the divisor is n minus 1. This calculator follows exactly that definition — no shortcut computational formula, no rounding of intermediate steps — which is why its results match a careful hand calculation to the last digit, as the worked example shows.

A note on rounding: carry full precision through the steps and round only the final answer, as this page does. Rounding the mean to one decimal before computing deviations is the single most common cause of a hand calculation disagreeing with a calculator in the second decimal place.

Worked example: the data set with a variance of exactly 4

The data set 2, 4, 4, 4, 5, 5, 7, 9 is the classic textbook example — it is the pre-filled data in the calculator above, and it is worth working once by hand, because its population variance comes out at exactly 4.

Value (x)Deviation (x − mean)Squared deviation
2−39
4−11
4−11
4−11
500
500
724
9416
Sum = 40Sum = 0Sum = 32

The mean is 40 divided by 8, which is 5. The deviations sum to zero, as they must — that is your first check. The squared deviations sum to 32. For the population: variance is 32 divided by 8, which is exactly 4, and the standard deviation is the square root of 4, exactly 2. For the sample: variance is 32 divided by 7, which is 4.5714 to four decimal places, and the standard deviation is the square root of that, 2.1381 to four decimal places. Type the data set into the calculator and you will see count 8, sum 40, mean 5, population variance 4 and sample variance 4.5714 — tool and hand calculation agree completely.

In plain words: the typical squared distance from the mean is 4 square units, or, taking the root, a typical value sits about 2 units from the mean of 5. The 9 does noticeable work — its squared deviation of 16 is half the entire sum of squares — previewing a key property: variance is sensitive to outliers, because squaring amplifies distant values.

How to read a variance: squared units and the square root

A variance is only useful compared with something: the mean, another data set, or a requirement. Its awkward feature is its units: data in centimetres gives a variance in square centimetres, and data in dollars gives one in square dollars, a unit nobody can picture. That is why the standard deviation — the square root, back in the original units — is the figure most people quote, while the variance is the figure most formulas are written in.

The same number reads very differently at different scales. A variance of 4 means an SD of 2: tight clustering when the mean is 200, wide scatter when the mean is 5, as in the worked example, where the SD is 40 percent of the mean. Always report the mean alongside the variance, and compare variances whose means differ only after comparing their SDs relative to those means.

There is no universal “good” variance. Low is better when consistency is the goal — a machine filling bottles. Low is not better when the spread is the information: a class where everyone scores identically may have sat too easy a test, and income data naturally carries a large variance because the underlying reality is unequal. The statistic describes; it does not grade.

For roughly bell-shaped data, the variance also connects to the empirical rule through its square root: about 68 percent of values fall within one standard deviation of the mean, about 95 percent within two, and about 99.7 percent within three. For skewed data — incomes, waiting times, city sizes — those percentages differ, sometimes sharply. The calculation on this page is correct for any data set; the rules of thumb are the part that depends on shape.

Variance and standard deviation: the square-root relationship

Variance and standard deviation are the same measurement at two stages of the same calculation: the variance is the average squared deviation, and the standard deviation is its square root. Every figure in the results above comes in both forms for exactly this reason — sigma squared beside sigma, s squared beside s. If you arrived here needing the root figures headlined, with the 68–95–99.7 rule worked through in full, use the Standard Deviation Calculator; the two pages share the same engine, the same worked example and the same step-by-step table, and differ only in which stage of the calculation they put first.

Statisticians often prefer to calculate with variance, because variances of independent quantities add together neatly, which makes theory and further formulas — analysis of variance, portfolio risk, error propagation — simpler. Everyone else usually prefers the standard deviation, because it is expressed in the original units of the data and can be drawn on a chart as a distance from the mean. Neither is more correct; they answer the same question in different units, and converting is one square root or one squaring.

Variance also sits in a family of spread measures worth knowing. The range — largest minus smallest — is the crudest and uses only two values. The interquartile range uses the middle half of the data and resists outliers. The mean absolute deviation averages the unsigned deviations without squaring, which many students find more intuitive, but it lacks the variance’s convenient mathematical properties, which is why the squared version won. Knowing which measure a question wants is half the marks; the calculation is the easy half.

Spreadsheets and code: VAR.P, VAR.S and ddof

If you cross-check this page against software, the names differ but the two versions are always there. In Excel and Google Sheets, VAR.P divides by n and matches the population variance here; VAR.S divides by n minus 1 and matches the sample variance. The older VAR function, still accepted for compatibility, is the sample version, and the root counterparts are STDEV.P and STDEV.S. In Python, the statistics module offers pvariance and variance with the same split, while NumPy’s var exposes the choice as ddof: 0 gives the population result, 1 gives the sample result, and NumPy defaults to 0 — which surprises many people whose course taught the sample version as the default.

When two tools disagree about a variance, this naming maze is almost always why: one divided by n and the other by n minus 1. The disagreement is largest for tiny samples and shrinks as n grows — at n equal to 100 the two differ by about one percent. The fix is never to average the two answers; it is to decide, from what your data represents, which divisor your question intends, and use that figure consistently through the whole piece of work.

Common mistakes

Dividing by the wrong n. Using n for a sample or n minus 1 for a population is the classic error, and it changes the answer by a factor that matters at small sample sizes. Decide population or sample before you calculate, and write the decision into your working.

Reporting the variance in the wrong units. A variance of 4 square centimetres is not a spread of 4 centimetres. If the figure you quote carries squared units, you are quoting the variance; if it carries the data’s own units, you are quoting the standard deviation. Mixing the two is the most common reporting error with this pair of statistics.

Rounding the mean too early. A mean of 5.333 rounded to 5.3 before the deviations are computed shifts every deviation and compounds into the final figure. Carry full precision to the end and round once, as this calculator does.

Averaging variances or standard deviations. The variance of two combined groups is not the average of their variances, because the groups may also differ in their means. Combine the raw data and calculate once — paste both lists together here — rather than combining finished statistics.

Expecting the deviations to be the answer. The raw deviations always sum to zero; that is a property of the mean, not a result. If your deviations do not sum to zero (within rounding), your mean is wrong, and every later step inherits the error.

Honest limits: what this calculator does not do

This calculator computes the population and sample variance of a single list of numbers you provide — exactly, and with the working shown. Plainly stated: it does not calculate the variance of grouped or frequency-table data. There is no frequency column and no class-interval input. For a small frequency table you can list each value out as many times as its frequency says and paste the full list, and the result will be correct; for grouped data recorded only as class intervals, a weighted grouped-data method is required, which this tool does not do. It also does not draw histograms or test whether your data is normally distributed, and it does not compute z-scores, confidence intervals or hypothesis tests.

It also cannot tell you whether the population or sample version is the right one for your purpose — that judgement depends on what your data represents, and the guide above gives you the reasoning to make it. Use the population variance (divide by n) when your list is the whole group you are describing; use the sample variance (divide by n minus 1) when your list is a sample standing in for a larger group.

Two further cautions. The variance is sensitive to outliers by design, because deviations are squared: one extreme value can dominate the result, as the 9 does in the worked example, so for heavily skewed data a median-based spread may describe your data better. And a variance from two or three values is arithmetically correct but statistically fragile — treat it as a rough description, not a precise measurement. What it does promise: the textbook definition, at full precision, both versions side by side, every step visible — in your browser, free, with nothing uploaded.

Sources and References

Source note: every source above was checked before publication and returned a live page. A Penn State STAT 414 lesson page and a Statistics Canada spread page were considered for this list but did not return a successful response during verification, so the OpenStax Statistics chapter and the second MathWorld entry were used in their place.