Variance Calculator: Sample, Population, Grouped & F-Test

Two basketball players both average 20 points over their last 10 games. Player A scored 19, 21, 20, 22, 18, 20, 21, 19, 20 and 20. Player B scored 8, 34, 15, 29, 12, 31, 18, 25, 10 and 18. The averages match, but the sample variance of Player A’s scores is 1.33, while Player B’s is 84.89, about 64 times larger. Variance is the number that tells these two players apart.

This calculator finds the sample or population variance of a list, with the standard deviation, a confidence interval for the true variance, and a working table. Other tabs handle frequency tables and grouped classes, combine the variances of several groups from their summaries, and compare two variances with an F-test. It opens with Player B’s 10 games.

Variance Calculator

Separate values with commas, spaces or new lines. Fractions such as 3/4 work. Leave out thousands commas.

Variance –
Squared deviations
Step by step
    Working table

    Variance in Four Steps, Worked on Player B

    Variance is the average squared distance from the mean. For a sample, “average” means dividing by n − 1 instead of n, for reasons covered in the next section.

    1. Find the mean. The 10 scores add up to 200, so the mean is 200 ÷ 10 = 20.
    2. Subtract the mean from each value. The deviations are −12, 14, −5, 9, −8, 11, −2, 5, −10 and −2. They always add up to zero, which is why they can’t simply be averaged.
    3. Square each deviation and add them up. 144 + 196 + 25 + 81 + 64 + 121 + 4 + 25 + 100 + 4 = 764. This total is the sum of squares (SS).
    4. Divide. For a sample, s² = 764 ÷ 9 = 84.89 (exactly 764/9). For a population, σ² = 764 ÷ 10 = 76.4.

    The standard deviation is the square root: s = √84.89 = 9.21 points. For Player A the same four steps give a sum of squares of 12, a variance of 12 ÷ 9 = 1.33 and a standard deviation of 1.15 points.

    The calculator’s working table shows every deviation and square, so you can match it line by line against homework. Its chart draws each deviation as an actual square on the number line: the side of each square is the distance from the mean, so its area is the squared deviation. Player B’s chart is full of large squares, and the variance is simply their average size.

    A shortcut gives the same sum of squares without listing deviations: SS = Σx² − (Σx)² ÷ n. For Player B, Σx² = 4,764 and (Σx)² ÷ n = 200² ÷ 10 = 4,000, so SS = 764. The step list prints this check under the main calculation.

    Sample or Population: Why Divide by n − 1

    Use the population formula (÷ n) when your list holds every value you care about: all 10 games of a season that is over, every employee in a company of 10. Use the sample formula (÷ n − 1) when the list is a sample used to estimate a larger group: 10 games picked to judge a player’s typical spread, 30 bags tested out of a day’s production.

    The reason is that a sample’s own mean sits closer to its values than the true mean does, so deviations from it come out a little too small. Dividing by n − 1 instead of n corrects for that on average. This correction is called Bessel’s correction.

    A small example shows it exactly. Take a population of three values, 2, 4 and 6. Its variance is σ² = (4 + 0 + 4) ÷ 3 = 8/3 ≈ 2.67. Now list all 9 possible samples of two values drawn with replacement, from (2, 2) to (6, 6), and compute each sample’s variance both ways:

    • Dividing by n − 1 = 1, the 9 sample variances average 8/3, exactly the population variance.
    • Dividing by n = 2, they average 4/3, half of it.

    So s² with n − 1 is an unbiased estimate of σ². The square root does not keep that property: s still comes out slightly low on average, a gap that shrinks as n grows. With 10 values the two variances differ by a factor of 10/9, about 11%; with 100 values the gap is about 1%.

    The calculator shows both versions. The hero result uses the type you pick, and the facts list the other one, labelled.

    Why Square the Deviations?

    The deviations from the mean always add up to zero, because the positives and negatives cancel. Squaring makes every term positive. An alternative is the mean absolute deviation, the average of the distances without signs. For Player B it is 7.8 points.

    Squares won out for three reasons:

    • Variances add. For independent quantities, Var(X + Y) = Var(X) + Var(Y). If Player A’s and Player B’s scores in a game are independent, their combined points have a variance of 4/3 + 764/9 = 776/9 ≈ 86.22, so a standard deviation of 9.29. Absolute deviations have no rule like this.
    • The mean minimizes it. The sum of squared deviations is smallest when measured from the mean, so the mean and the variance belong together. The sum of absolute deviations is smallest when measured from the median.
    • It fits the normal distribution. The bell curve is defined by a mean and a variance, and many standard tests build on it. The normal distribution calculator uses the standard deviation directly.

    The cost of squaring is that large deviations count far more than small ones. A value 10 units from the mean adds 100 to the sum of squares; one 2 units away adds only 4.

    Reading the Number: Squared Units and Relative Size

    Because the deviations are squared, the variance carries squared units. Player B’s variance is 84.89 points², which has no everyday meaning. The standard deviation, 9.21 points, is in the original units, so it is the number to quote when describing the spread. The variance is the number to use inside formulas: adding variances, comparing them with an F-test, or splitting them into parts. When the standard deviation of a list is all you need, the standard deviation calculator reports it with the standard error.

    To compare spreads of things measured on different scales, divide the standard deviation by the mean. This coefficient of variation is 5.8% for Player A (1.15 ÷ 20) and 46.1% for Player B (9.21 ÷ 20). It works only for data measured from a true zero with no negative values, which is why the calculator hides it for data that can be negative.

    How One Value Pulls the Variance

    Squaring makes the variance sensitive to a single far-out value. Suppose Player A’s last game had been 40 points instead of 20. The mean moves only from 20 to 22, but the sample variance jumps from 1.33 to 41.33, and the standard deviation from 1.15 to 6.43. That single game supplies 324 of the new sum of squares, 372, or 87%.

    The calculator flags this: when one value supplies 40% or more of the sum of squares, a tip names it and suggests checking for a typo. If the value is real, report the variance with it and consider a measure that resists outliers as well, such as the interquartile range, which the mean, median and mode calculator finds.

    Variance From a Frequency Table or Grouped Classes

    Data in a frequency table don’t need to be typed out one value at a time. A café timed how long 60 customers waited and grouped the results:

    Wait (minutes)0–55–1010–1515–2020–25
    Customers f81720105
    Midpoint m2.57.512.517.522.5

    Each class is represented by its midpoint. The mean is Σf·m ÷ N = 685 ÷ 60 = 11.42 minutes. The sum of squares is Σf·(m − mean)² = 1,904.58, so the sample variance is 1,904.58 ÷ 59 = 32.28 minutes² and the standard deviation is 5.68 minutes.

    The result is an estimate, because each customer is counted as if they waited exactly the class midpoint. When all classes have the same width h, Sheppard’s correction subtracts h² ÷ 12 to allow for that grouping: 32.28 − 25 ÷ 12 = 30.20. The correction is meant for data that taper off smoothly at both ends; for lumpy or one-sided tables, report the uncorrected value. The calculator shows both.

    The Frequency table tab also takes single values with counts, and then gives an exact variance, since no grouping is involved. A survey of 29 homes counting cars per household (0, 1, 2 and 3 cars, with frequencies 5, 11, 9 and 4) has a mean of 1.41 cars and a sample variance of 0.894, the same as typing all 29 answers into the Data list tab.

    Combining the Variances of Several Groups

    Three classes report their heights only as summaries:

    ClassnMean (cm)SD (cm)
    A28150.26.1
    B31153.87.4
    C25148.55.2

    The variance of all 84 students together is not the average of the three variances (39.67). It has two parts:

    • Within groups: Σ (n − 1) × SD² = 27 × 37.21 + 30 × 54.76 + 24 × 27.04 = 3,296.43.
    • Between groups: Σ n × (group mean − overall mean)². The overall mean is 151.02 cm, and this part comes to 417.17.

    The total sum of squares is 3,713.60, so the combined sample variance is 3,713.60 ÷ 83 = 44.74 cm², a standard deviation of 6.69 cm. The gaps between the class means supply 11.2% of the total spread. That share is why the combined figure is larger than the plain average of the variances.

    The Combine groups tab does this for up to 50 groups, typed one per line as n, mean, SD. It also gives the pooled within-group variance, 3,296.43 ÷ (84 − 3) = 40.70, which leaves out the gaps between means. That pooled figure is the one used in a pooled t-test or an ANOVA, while the combined figure describes all the values as one group. The split into within and between parts is the same one that a one-way ANOVA tests.

    Comparing Two Variances With the F-Test

    The F-test asks whether two samples could come from populations with the same variance. Its statistic is the ratio of the sample variances:

    F = s₁² ÷ s₂², with n₁ − 1 and n₂ − 1 degrees of freedom.

    For the two players, F = 84.89 ÷ 1.33 = 63.67 with 9 and 9 degrees of freedom. The two-tailed p-value is 9.0 × 10⁻⁷, so the difference in consistency is far beyond chance. The 95% interval for the ratio of true variances runs from 15.8 to 256.3, which excludes 1.

    A closer call: two filling machines are each tested on 16 items. Their standard deviations are 2.1 g and 1.6 g. F = 2.1² ÷ 1.6² = 1.72, and the two-tailed p-value is 0.30. With 15 and 15 degrees of freedom, the larger variance would need to be about 2.86 times the smaller one to be significant at the 5% level. Small samples can’t tell variances apart unless the gap is large.

    Two cautions come with the test. It assumes both populations are normal, and it reacts strongly to skew and outliers. Levene’s test or the Brown–Forsythe test is less sensitive to that, and the calculator says so in its tip. Also, failing to reject equal variances does not show that they are equal; with small samples the test has little power. By convention, printed F tables list only values above 1, so people put the larger variance on top and, for a two-tailed test, read the α/2 column. The calculator doesn’t need that: it accepts either order and computes both tails. The F-test’s p-value comes from the same distribution as the F option on the p-value calculator.

    A Confidence Interval for the True Variance

    A sample variance is an estimate, and the chi-square distribution puts a range around it when the data are normal:

    (n − 1)s² ÷ χ²(upper) to (n − 1)s² ÷ χ²(lower)

    For Player B, (n − 1)s² is just the sum of squares, 764. With 9 degrees of freedom the 95% chi-square cut-offs are 19.02 and 2.70, so the interval for σ² runs from 764 ÷ 19.02 = 40.16 to 764 ÷ 2.70 = 282.92. Taking square roots, the true standard deviation lies between 6.34 and 16.82 points.

    The interval is lopsided, stretching much further above the estimate than below, because the chi-square distribution is skewed for small df. It is also wide: ten games pin down a variance poorly. With 40 games and the same sample variance, the interval narrows to 56.96 to 139.96. Unlike intervals for a mean, this one does not become safe for non-normal data as n grows, so check the shape of the data first. The calculator offers 90%, 95% and 99% levels.

    How Many Values Make a Stable Variance?

    The interval above answers a planning question too: how precise is a variance from n values? Multiply your sample variance by these factors to get the 95% interval for the true variance (normal data):

    nLower factorUpper factorFor the SD
    50.368.260.60 to 2.87 × s
    100.473.330.69 to 1.83 × s
    200.582.130.76 to 1.46 × s
    400.671.650.82 to 1.28 × s
    1000.771.350.88 to 1.16 × s
    4000.881.160.94 to 1.08 × s

    With 5 values the true variance could plausibly be anywhere from about a third of the estimate to eight times it. Even with 100 values the standard deviation is only known to within about ±15%. Halving the width takes roughly four times as many values. If a decision rests on a spread, such as a tolerance or a safety margin, collect more data than you would for a mean.

    Variance of a Probability Distribution

    The same idea applies when you have outcomes with probabilities instead of data. The variance is the probability-weighted average squared distance from the mean: Var(X) = Σ p × (x − μ)², or E(X²) − μ².

    Take a game that pays $10 with probability 0.2 and nothing otherwise. Its mean is μ = 0.2 × 10 = $2. Its variance is 0.2 × (10 − 2)² + 0.8 × (0 − 2)² = 12.8 + 3.2 = 16, so the standard deviation is $4. No division by n − 1 appears, because the probabilities describe the whole population of outcomes rather than a sample of them. The expected value calculator works out the mean, variance and standard deviation of any table like this.

    Shifting, Scaling and Adding

    These rules let you find a new variance without recalculating from the data:

    ChangeMeanVarianceSD
    Add a constant b to every value+ bunchangedunchanged
    Multiply every value by a× a× a²× |a|
    Add two independent quantitiesadd the meansadd the variances√(sum of variances)
    Subtract two independent quantitiessubtract the meansadd the variances√(sum of variances)

    Two examples show the rules at work. Recording prices in cents instead of dollars multiplies every value by 100, so the variance grows 10,000 times and the standard deviation 100 times. Giving every player 5 bonus points changes no variance at all.

    The last row is easy to get wrong. The difference between two independent quantities is more variable than either one, because errors on both sides add up. If the quantities are not independent, a covariance term enters: Var(X + Y) = Var(X) + Var(Y) + 2·Cov(X, Y). For the strength of that link in paired data, see the correlation coefficient calculator.

    Variance in Excel, Google Sheets and on a Calculator

    ToolSample (÷ n − 1)Population (÷ n)
    Excel=VAR.S(range) (older VAR)=VAR.P(range) (older VARP)
    Google Sheets=VAR.S(range) or =VAR(range)=VAR.P(range) or =VARP(range)
    Scientific / graphing calculatorsquare the sₓ valuesquare the σₓ value

    Microsoft’s own example uses the breaking strength of 10 tools: 1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303 and 1299. VAR.S gives 754.27 and VAR.P gives 678.84; the calculator returns the same pair. VAR.S skips text and blank cells in a range. VARA counts text as 0 and TRUE as 1, which can quietly change the result if a column holds a label such as “n/a”.

    Calculators show only the standard deviations, as sₓ (sample) and σₓ (population). Square the right one, and avoid rounding it first: 9.21² = 84.82, while the exact variance is 84.89.

    What Values a Variance Can Take

    A variance is never negative, because it is built from squares. It is zero only when every value is identical, as in a list of ten 20s. A negative result from a hand calculation or a spreadsheet always means an arithmetic slip, for example from the shortcut formula covered in the mistakes list below.

    There is no upper limit, and the variance can be far larger than the mean. Player B’s variance, 84.89, is more than four times his mean of 20 points, which says nothing wrong about the data; the units are different (points² against points). Comparing a variance with a mean is a units mismatch. Compare the standard deviation with the mean instead, as the coefficient of variation does.

    Adding more data does not push the variance up or down in any fixed direction. A new value close to the mean lowers it slightly; a new value far from the mean raises it. The sample variance settles toward the true variance as n grows, at the pace the table above shows.

    Mistakes That Change the Answer

    • Dividing by n for a sample, or by n − 1 for a full population. With 10 values the two answers differ by 11%.
    • Averaging variances of groups of different sizes or different means. Use the Combine groups tab instead.
    • Averaging standard deviations. SDs don’t add or average; variances do. Combine the variances, then take the square root.
    • Squaring a rounded SD. Keep full precision, or work from the sum of squares.
    • Reporting variance in the wrong units. It is in squared units. Quote the standard deviation when describing spread to readers.
    • Forgetting the grouping. A variance from class midpoints is an estimate. Say so, and use the raw data when you have it.
    • Using the F-test on skewed data. Check the shape first, or use Levene’s test, which is less sensitive to outliers.
    • Using the shortcut formula on large, close values. Σx² − (Σx)² ÷ n can lose precision when the values are large and close together, such as 1,000,001 and 1,000,003. The calculator works with exact fractions, but a spreadsheet using the shortcut by hand can return a slightly wrong or even negative variance. Subtracting the mean first avoids it.