Sample and Population Variance Calculator
Calculate variance from raw observations or an exact value-frequency table. Compare population and sample formulas, then review the mean, sum of squared deviations and substitution steps.
Last Updated: July 27, 2026
Online Variance Calculator
Enter up to 500 values or value-frequency rows. Core calculations use exact rational numbers, so large offsets and small spreads are not lost to floating-point cancellation.
Your exact variance, decimal approximation and formula details will appear here.
Exact moment table
| Value (x) | Frequency (f) | f × x | f × x² |
|---|---|---|---|
| — | — | — | Calculate a data set |
Duplicate exact values are combined before calculation.
Calculation steps
- Enter numerical data and select Calculate Variance.
Recent calculations
- Your last six results will appear here.
How to Use This Variance Calculator
- Choose Raw observations when every measurement is listed. Choose Values and frequencies when a value repeats a known whole-number count.
- Select Population variance when the entered data is the complete group you want to describe. Select Sample variance when the observations are a sample used to estimate variability in a larger population.
- Enter numerical values. You may use signed integers, decimals, fractions, mixed numbers or scientific notation.
- In frequency mode, enter one count for every value. The lists must contain the same number of entries.
- Choose the displayed decimal precision, then select Calculate Variance. Review both variance results, the exact mean, M2, divisor and steps.
A comma separates observations, so enter 1200 instead of 1,200. Blank separators are ignored. The calculator groups exactly equivalent numbers before calculating. For example, 0.5, 1/2, 2/4 and 5e-1 represent the same rational value.
What Is Variance?
Variance measures how far numerical observations spread around their arithmetic mean. It first finds each deviation from the mean, squares that deviation, adds the squared deviations and divides by the appropriate count. A data set with values close to its mean has a small variance. Values spread farther away create a larger variance.
Squared-deviation sum: M2 = Σ(x - mean)²
Variance = M2 ÷ selected divisor
Squaring serves two purposes. Positive and negative deviations no longer cancel each other, and larger deviations receive more influence. This also means variance is never negative. It equals zero only when every positive-frequency observation has the same value.
Population Variance Versus Sample Variance
The key choice is the denominator. Population variance divides by the complete number of observations, written N. Sample variance divides by n - 1. The sample adjustment is commonly called Bessel's correction. It corrects the downward bias that appears when the sample mean is estimated from the same sample.
| Result | Formula | Divisor | Use when |
|---|---|---|---|
| Population variance | σ² = Σ(x - μ)² / N | N | The data includes the complete population of interest. |
| Sample variance | s² = Σ(x - x̄)² / (n - 1) | n - 1 | The data is a sample used to estimate population variance. |
For the same data with more than one observation and positive variance, sample variance is larger by the factor n/(n - 1). When every value is equal, both variances are zero. A one-value population has variance zero, but a one-value sample has no defined sample variance because its divisor would be zero.
Variance Formulas Used by the Calculator
For raw data, every observation has frequency 1. For a frequency table, f represents how many times value x occurs and N is the total of all positive frequencies. The weighted mean used here is therefore an expanded-data mean, not a general-purpose weighted estimator.
Mean = Σ(f × x) / N
M2 = Σ[f × (x - mean)²]
Population variance = M2 / N
Sample variance = M2 / (N - 1)
The calculator updates the mean and M2 with an exact frequency-aware recurrence. It never expands a frequency of one million into one million browser entries. It also avoids the floating-point subtraction of two nearly equal large quantities, a common source of cancellation error in shortcuts based on sums of squares.
Worked Variance Example
Consider 2, 4, 4, 4, 5, 5, 7 and 9. There are 8 observations. Their sum is 40, so the mean is 40/8 = 5. Subtract 5 from every value, square each deviation and add the results.
Population variance = 32 / 8 = 4
Sample variance = 32 / 7 ≈ 4.5714
If these eight values are the complete population, report 4. If they are a sample representing a larger group, report 32/7 or its appropriately rounded decimal. The data does not change. Only the statistical purpose changes the denominator.
Using Value and Frequency Data
Frequency mode shortens repeated discrete data. Instead of entering 1, 1, 2 and 3, enter values 1, 2, 3 with frequencies 2, 1, 1. The calculator treats this as four observations, not three rows.
Duplicate exact value rows are merged. A zero frequency contributes no observation and is ignored. Frequencies must be whole-number counts. Decimal reliability weights, survey weights, probability masses and precision weights are outside this page because an unbiased weighted sample variance needs a denominator rule different from n - 1.
Do not enter grouped class intervals such as 10-20. A class interval hides the original observations. Variance estimated from class midpoints is an approximation and needs a separate grouped-data method.
Exact Fractions and Stable Arithmetic
Ordinary browser numbers store many decimals approximately. That is often sufficient for display, but it can fail when values share a huge offset and differ only slightly. For example, 10000000000000001, 10000000000000002 and 10000000000000003 have population variance 2/3. Converting those integers to ordinary floating-point numbers too early can erase their one-unit differences.
This tool parses valid numbers as reduced fractions backed by arbitrary-size integers. It calculates the mean, M2 and both variances with exact rational operations. The precision selector affects only the displayed approximation. It never changes the stored result or the equality of input values.
Exact arithmetic has a practical complexity limit. Unusually large collections of unrelated fractional denominators can create an enormous exact fraction. If the safe complexity limit is reached, reduce the number of unrelated denominators or use appropriate terminating decimal measurements. The calculator reports this condition instead of silently switching to lower-precision math.
Why Variance Uses Squared Units
If measurements use centimetres, deviations also use centimetres, but squared deviations use square centimetres. Therefore variance is expressed in cm². If values use dollars, variance uses dollars squared. The squared unit is mathematically correct but may be harder to interpret directly.
Standard deviation takes the square root of variance and returns to the original measurement unit. Use variance for formulas, model comparisons and decomposition of variability. Use standard deviation when you need spread expressed on the same scale as the original observations.
How to Interpret a Variance Result
Variance has no universal good or bad threshold. Its size depends on the measurement scale, units and context. A variance of 25 means something different for temperatures, delivery times and exam scores. Compare variances only when data uses the same units and a compatible population or sampling definition.
Scaling every observation by a factor a multiplies variance by a². Adding the same constant to every value does not change variance because all distances from the mean stay the same. A few extreme values may increase variance sharply because deviations are squared.
- Check whether the data represents a population or a sample before choosing the headline result.
- Compare results only after confirming matching units and data definitions.
- Review outliers and data-entry errors rather than removing them automatically.
- Report the denominator convention and rounding used in academic or professional work.
Variance Compared with Other Spread Measures
| Measure | Core idea | Units | Main sensitivity |
|---|---|---|---|
| Variance | Average or adjusted average of squared deviations. | Squared data units | Strongly affected by large deviations. |
| Standard deviation | Square root of variance. | Original data units | Strongly affected by large deviations. |
| Range | Maximum minus minimum. | Original data units | Uses only the two endpoints. |
| Mean absolute deviation | Average absolute distance from a selected center. | Original data units | Less emphasis on extreme distances than squaring. |
Practical Uses for Variance
Variance appears in quality control, experimental research, finance, forecasting, education and machine learning. A production team may compare the variation in part dimensions across two processes. A teacher may examine how widely scores differ around a class mean. A researcher may use sample variance as an input to a standard error, confidence interval or statistical test.
The number alone does not identify the cause of variation. Before comparing groups, check collection methods, missing observations, measurement resolution and whether both groups use the same units. A lower variance may indicate more consistency, but it does not prove better quality or a more representative sample. The desired spread depends on the decision being made.
Input Rules and Limits
- Enter from 1 through 500 raw observations or paired frequency rows.
- Numerical parts may contain up to 50 digits. Scientific exponents may range from -100 through 100.
- Use a period as the decimal mark. Do not add currency symbols, percentage signs, units or arithmetic expressions.
- Fractions require a nonzero denominator. A finite decimal is not automatically treated as a nearby fraction.
- Frequency counts must be whole numbers from 0 through 1,000,000,000,000.
- Blank entries are ignored. The value and frequency lists must still produce matching entry counts.
- Missing values, infinity, NaN, class intervals and nonnumeric categories are not accepted.
Common Variance Mistakes
- Choosing the wrong divisor: decide whether the observations are a complete population or a sample.
- Forgetting to square deviations: unsquared positive and negative deviations add to zero around the mean.
- Rounding the mean too early: keep the exact or unrounded mean through the final division.
- Dividing by the number of distinct values: frequency data divides by total observations, not table rows.
- Treating arbitrary weights as counts: different weighting systems require different variance estimators.
- Reporting original units: variance uses squared units.
Related Calculators
Frequently Asked Questions
How do I calculate variance?
Find the arithmetic mean, subtract it from every observation, square each deviation, add the squared deviations and divide by N for population variance or n minus 1 for sample variance.
What is the difference between sample and population variance?
Population variance describes the complete population and divides by N. Sample variance estimates population variability from a sample and normally divides by n minus 1.
Why does sample variance divide by n minus 1?
Using the sample mean consumes one degree of freedom. Dividing by n minus 1 applies Bessel's correction and removes the usual downward bias in the variance estimate.
Can variance be negative?
No. Variance adds squared deviations, and each squared deviation is nonnegative. Exact variance is zero only when all positive-frequency observations are equal.
What is the variance of one value?
A one-value population has variance zero. Sample variance is undefined for one observation because the sample divisor n minus 1 equals zero.
Does variance use the same units as the data?
No. Variance uses squared units. Values measured in centimetres produce variance in square centimetres, while standard deviation returns to centimetres.
Can I enter fractions and scientific notation?
Yes. The calculator accepts integers, decimals, fractions, mixed numbers and scientific notation, then reduces valid inputs to exact rational values.
Are 0.5 and 1/2 treated as the same value?
Yes. Both inputs reduce to the exact fraction 1/2. The same applies to equivalent forms such as 2/4 and 5e-1.
How does frequency mode calculate variance?
Each frequency repeats its matching value that many times. The calculator uses total frequency as N, merges duplicate exact values and does not expand large counts into individual entries.
Can I use decimal weights instead of frequencies?
No. This page accepts whole-number observation counts. Survey, reliability, probability and precision weights require specialized variance formulas and denominator corrections.
Why might my variance answer differ from another calculator?
Common causes include choosing sample instead of population variance, rounding the mean early, entering grouped estimates, using different weights or omitting observations.
How is variance different from standard deviation?
Variance is the squared spread measure. Standard deviation is its nonnegative square root, so standard deviation uses the same units as the original data.
This calculator is an educational numerical tool. Confirm the population or sample definition, units, data quality, weighting method and rounding rules required by your course, research plan or organization before relying on a result.