Sample Variance Calculator
Solve the classic sample variance relation s² = Σ(xᵢ − x̄)² / (n − 1) for any of its three unknowns — sample variance, sum of squared deviations, or sample size — with step-by-step math, a live deviation schematic, and a full dataset analyzer that computes variance, standard deviation, standard error, and confidence intervals from pasted data.
Why divide by n − 1 and not n?
Using n − 1 instead of n corrects a systematic bias. The sample mean x̄ is itself computed from the data, so the deviations xᵢ − x̄ are slightly smaller than the deviations from the true (unknown) population mean μ. Squaring and summing them underestimates the population variance. Dividing by n − 1 inflates the estimate by just the right amount to make it unbiased: E[s²] = σ². This is called Bessel's correction. Dividing by n gives the population variance σ² (used when your data are the entire population, not a sample from it).
Variance has squared units
Because each term (xᵢ − x̄)² is squared, the sample variance is measured in squared units of the original data. If your data are in metres, the variance is in m². If in dollars, then dollars². This makes variance awkward to compare directly with the mean. The sample standard deviation s = √s² fixes this by restoring the original units, and for that reason s is almost always reported alongside or instead of s². The variance, however, is more mathematically tractable — it adds linearly for independent variables, which is why it appears throughout statistical theory.
Larger samples give more stable estimates
The sample variance s² is itself a random variable: different samples of the same size n from the same population give different values of s². The sampling variability of s² depends on the underlying distribution; for normal data, Var(s²) = 2σ⁴/(n − 1), so the standard error of s² falls as 1/√(n − 1). This is why small samples give unstable variance estimates — the value of s² could easily be twice or half the true σ². As n grows, s² concentrates around σ², and for n ≥ 30 it is usually reliable enough for most practical work.
Sensitive to outliers
Because each deviation is squared before being summed, a single data point far from the mean contributes enormously to SS and hence to s². A point at 10 standard deviations from the mean contributes 100 to the sum of squares — a hundred times more than a point at 1 standard deviation. This makes the sample variance (and the standard deviation) highly sensitive to outliers. For skewed data or data with suspected outliers, robust alternatives such as the interquartile range, median absolute deviation, or the M-estimators of scale are preferable.
How to Use This Calculator
The sample variance formula links three quantities: s², SS and n. Pick which one you want the tool to solve, then fill in the other two. The optional mean x̄ unlocks the coefficient of variation and related statistics.
1. Choose what to solve for
Pick s², SS or n from the toggle. The calculator rearranges s² = SS/(n − 1) for whichever quantity you select, using direct algebra in every case.
2. Use realistic presets
Variance presets span 0.01 to 10,000 units². Sum-of-squares presets span 1 to 1,000,000. Sample-size presets run from 2 to 1,000. The mean preset defaults to 100 but can be set to any value.
3. Match units carefully
s² and SS are in squared units of the data (m², dollars², etc.). n is a dimensionless integer count. x̄ is in the data's original units. All sliders use logarithmic mapping for the large-range quantities and linear for n and x̄.
4. Read the result and verdict
The result card shows the solved value plus its square root s, the population variance σ² = SS/n, the standard error s/√n, and a color-coded verdict classifying the spread from negligible to extreme.
5. Check the schematic and chart
The schematic shows illustrative data points around the mean, with arrows for each positive deviation and a shaded band for ±1 standard deviation. The result-card chart plots sample data on a number line with the mean and ±1σ band overlaid.
6. Analyse a dataset
Scroll to the dataset analyzer, paste any comma- or space-separated numbers, and the tool computes count, mean, sum of squares, sample variance, sample standard deviation, standard error, and a 95 % confidence interval in one step.
What This Tool Offers
Built around the classic sample variance formula, the foundation of descriptive statistics and inferential testing.
Three-way solving
Solve for sample variance, sum of squared deviations, or sample size. All rearrangements are direct algebra — no numerical methods needed.
Live deviation schematic
A scatter of illustrative data points around the mean, with deviation arrows colored by sign and a shaded ±1σ band showing where most data lie.
Spread-class verdict
Each result is classified from negligible (s² < 1) through moderate and large to extreme (s² > 10,000), with a colored badge.
Two comparison charts
A number-line chart of illustrative sample data with mean and ±1σ band, plus an advanced bar chart of squared deviations per observation.
Full dataset analyzer
Paste any list of numbers and the tool computes n, mean, SS, s², s, σ², σ, standard error, and 95 % CI in a single step.
Reference tables
A dynamic variance lookup grid, typical variance values by domain, and a full variable reference table with degrees-of-freedom notes.
Dataset Analyzer & Reference Tables
Paste a list of numbers to compute sample variance, or use the lookup grid to see how s² varies with SS and n.
Quick dataset analyzer — sample variance from pasted data
Enter any comma-, space-, or newline-separated numbers. The tool returns count, mean, SS, s², s, σ², σ, standard error, and a 95 % confidence interval. Non-numeric tokens are ignored.
Sample variance lookup — s² = SS / (n − 1)
Rows are sum of squares SS, columns are sample size n. Values in squared units.
| SS \ n | n = 2 | n = 5 | n = 10 | n = 30 | n = 100 | n = 1000 |
|---|
Typical Sample Variances by Domain
Representative examples to help calibrate the magnitude of s² for your data.
| Context | s (units) | s² (units²) | Notes |
|---|---|---|---|
| Precision machining (length) | 0.005 mm | 2.5×10⁻⁵ mm² | Very tight tolerance |
| Sensor noise (voltage) | 0.02 V | 4×10⁻⁴ V² | Peak-to-peak ≈ 6σ |
| Daily temperature (temperate) | 4 °C | 16 °C² | Across a month |
| Exam scores (single class) | 10 pts | 100 pts² | Typical for 30 students |
| Adult human height | 0.07 m | 0.0049 m² | Very narrow distribution |
| Blood pressure (systolic, adults) | 15 mmHg | 225 mmHg² | Population spread |
| Household income (US) | $40,000 | $1.6×10⁹ | Right-skewed; huge variance |
| Daily stock return (S&P 500) | 1.1 % | 1.21 %² | Annualised volatility ≈ 17 % |
| Reaction yield (batch) | 3 % | 9 %² | Process control |
| Batch weight (food packaging) | 5 g | 25 g² | Regulatory tolerance |
| Latency (network, ms) | 45 ms | 2,025 ms² | Heavy-tailed distribution |
| Particle size (powder) | 15 µm | 225 µm² | Laser diffraction |
Variable Reference
| Symbol | Meaning | Typical range | Units |
|---|---|---|---|
| s² | Sample variance | 0 – 10⁹ | data units² |
| s | Sample standard deviation = √s² | 0 – 10⁴ | data units |
| SS | Sum of squared deviations | 0 – 10¹² | data units² |
| n | Sample size | 2 – 10⁶ | integer count |
| n − 1 | Degrees of freedom | 1 – 10⁶ | dimensionless |
| x̄ | Sample mean | any real | data units |
| σ² | Population variance = SS/n | 0 – 10⁹ | data units² |
| SE | Standard error of the mean = s/√n | 0 – 10⁴ | data units |
| CV | Coefficient of variation = s/|x̄| | 0 – 10 | dimensionless |
| CI₉₅ | 95 % confidence interval half-width ≈ 1.96·SE | 0 – 10⁴ | data units |
What Does s² = Σ(xᵢ − x̄)² / (n − 1) Measure?
The sample variance is the fundamental measure of how spread out a set of observations is around its mean. It answers the question: on average, how far is a typical observation from the center? Unlike the range, which looks only at the two extremes, the variance uses every observation in the sample. It is the square of the standard deviation, and it appears in nearly every formula in inferential statistics — t-tests, ANOVAs, confidence intervals, regression standard errors, and the sampling distribution of the mean all depend on it.
Sample Variance Formula
The defining relationship is:
where the sum runs over every observation xᵢ, and x̄ is the sample mean. The quantity Σ(xᵢ − x̄)² is often abbreviated SS (sum of squares), so the formula can be written compactly as:
Rearranged to solve for the other two unknowns:
n = SS / s² + 1
Two related quantities appear throughout statistics. The population variance σ² divides by n instead of n − 1 and is used when your data are the entire population:
The standard deviation s = √s² restores the original units, and the standard error of the mean SE = s/√n measures the precision of the sample mean as an estimate of the population mean.
Sample Variance Variables
| Symbol | Meaning | Notes |
|---|---|---|
| s² | Sample variance | Unbiased estimator of σ²; units are data units squared |
| s | Sample standard deviation | √s²; same units as the data |
| SS | Sum of squared deviations | Σ(xᵢ − x̄)²; the numerator of s² |
| n | Sample size | Integer ≥ 2; number of observations |
| n − 1 | Degrees of freedom | Bessel's correction; makes s² unbiased |
| x̄ | Sample mean | Center of the deviations; not needed for s² alone |
| σ² | Population variance | SS/n; used when data are the entire population |
| SE | Standard error of the mean | s/√n; measures precision of x̄ |
| CV | Coefficient of variation | s/|x̄|; dimensionless relative spread |
How Each Variable Affects the Sample Variance
The formula is a ratio: s² = SS/(n − 1). The numerator SS measures total squared deviation, so larger scatter around the mean directly increases s². The denominator n − 1 measures how many independent pieces of information went into estimating the mean; larger samples divide the same total scatter across more degrees of freedom, so s² shrinks for a given amount of scatter. In practical terms, adding more data points usually increases SS (because each new point adds its own squared deviation) but at the same time increases n − 1. Which effect dominates depends on the new point's distance from the mean: a point near x̄ adds little to SS and slightly reduces s², while a point far from x̄ adds a lot to SS and increases s².
The variance is not linear in any individual data value, because it depends on the mean, which itself is a function of all the data. This is why robust statistics prefers the median absolute deviation or the IQR — those measures respond to outliers more gently. But the variance's non-linearity is exactly what makes it mathematically powerful: variances of independent random variables add, which is why the sample variance is the foundation of the analysis of variance (ANOVA) and the sampling distribution of the mean.
Sample Variance Calculation Examples
n = 10, x̄ = 87.6
SS = Σ(xᵢ − x̄)² = 336.4
s² = 336.4 / 9 = 37.38
s² = 900 / 9 = 100.00
SS = 100 × 9 = 900.00
n = 900 / 100 + 1 = 10
n = 10, x̄ = 20.5 °C, SS = 74.5 °C²
s² = 74.5 / 9 = 8.28 °C², s = 2.88 °C
n = 5, x̄ = 10.00 mm, SS = 1.0×10⁻³ mm²
s² = 1.0×10⁻³ / 4 = 2.5×10⁻⁴ mm², s = 0.016 mm
Frequently Asked Questions
Dividing by n − 1 corrects a systematic bias. The sample mean x̄ is computed from the same data, so the deviations xᵢ − x̄ tend to be slightly smaller than the true deviations from the unknown population mean μ. Summing their squares and dividing by n consistently underestimates σ². Dividing by n − 1 inflates the estimate by just the right amount to make it unbiased: E[s²] = σ². This correction is named after Friedrich Bessel and is known as Bessel's correction. Dividing by n gives the population variance σ², appropriate only when your data are the entire population.
The sample variance s² = SS/(n − 1) is used when your data are a subset of a larger population, and you want to estimate that population's variance. The population variance σ² = SS/n is used when your data include every member of the population. The two differ only in the denominator: n − 1 versus n. For large samples the difference is negligible — for n = 1,000, dividing by 999 instead of 1,000 changes the result by 0.1 %. But for small samples the difference matters: for n = 5, s² is 25 % larger than σ². In statistical inference the sample variance is almost always what you want, because you rarely have the entire population.
Because each deviation is squared before being summed. A point at 2 standard deviations from the mean contributes 4 to SS; a point at 10 standard deviations contributes 100 — 25 times more. This squaring amplifies the effect of extreme values disproportionately, which is a feature in some applications (variance is the natural measure of squared error) and a bug in others. If your dataset may contain outliers or heavy tails, use robust alternatives: the interquartile range (IQR = Q₃ − Q₁), the median absolute deviation (MAD), or a trimmed variance that removes the highest and lowest k percent of the data before computing SS.
Because the deviations (xᵢ − x̄) are themselves measured in the data's original units, and squaring them produces squared units. If x is in metres, then (xᵢ − x̄)² is in m². If x is in dollars, then s² is in dollars². This is why the standard deviation s = √s² is more intuitive — it restores the original units and can be compared directly to the mean. But the variance is mathematically cleaner: it is additive for independent variables, it appears naturally in the central limit theorem, and it is the parameter that characterises the normal distribution. In practice, both s² and s are reported, and the choice depends on the application.
There is no sharp threshold, but rules of thumb exist. For exploratory work, n ≥ 10 gives a rough estimate. For routine analysis, n ≥ 30 is common. For precise estimation of σ², n ≥ 100 is preferred, especially when the underlying distribution is not normal. The relative standard error of s² is approximately √(2/(n − 1)) for normal data: for n = 10 it is 47 %, for n = 30 it is 26 %, for n = 100 it is 14 %, and for n = 1,000 it is 4.5 %. So with n = 10, your sample variance could easily be off by half or double from the true population variance. With n = 100 the estimate is usually within about 15 % of the truth.
The standard error of the mean SE = s/√n measures how precisely the sample mean estimates the population mean μ. It is directly related to the sample standard deviation through the factor 1/√n. A larger sample gives a smaller standard error — the sample mean becomes a more precise estimate. For the sample variance itself, the standard error (for normal data) is SE(s²) = s²·√(2/(n − 1)). The 95 % confidence interval for the mean is approximately x̄ ± 1.96·SE for large n, or x̄ ± t_{0.025,n−1}·SE using the t-distribution for smaller samples. All of these depend on s², which is why the sample variance is such a central quantity in statistics.
Five steps. (1) Compute the mean x̄ = (Σxᵢ)/n. (2) For each value, subtract the mean to get the deviation dᵢ = xᵢ − x̄. (3) Square each deviation: dᵢ². (4) Sum the squares: SS = Σdᵢ². (5) Divide by n − 1: s² = SS/(n − 1). For example, given the dataset {4, 7, 8, 10, 11}: mean = 8; deviations = {−4, −1, 0, 2, 3}; squares = {16, 1, 0, 4, 9}; SS = 30; s² = 30/4 = 7.5. The dataset analyzer above performs all five steps automatically for arbitrary datasets — just paste your numbers and click Analyze.
Variables
| Symbol | Quantity | Unit |
|---|---|---|
| s² | Sample variance | |
| xᵢ | Each data value | |
| x̄ | Sample mean | |
| n | Sample size |
What it means
Sample variance (s²) is the sum of squared deviations from the sample mean, divided by n−1 instead of n. This correction (Bessel’s correction) makes the sample variance an unbiased estimator of the population variance, because using n would underestimate the variance, especially for small samples. The sample variance is the basis for the t‑statistic, confidence intervals, and ANOVA. It is the standard measure of dispersion in sample data. Understanding the distinction between population and sample variance is crucial for correct statistical inference and for avoiding bias in estimates.
Worked example
Sample Variance – Two Examples
Real‑World| Parameter | Value |
|---|---|
| Data | 2,4,6,8,10 |
| x̄ | 6 |
| n | 5 |
| Parameter | Value |
|---|---|
| Data | 5,5,5,5 |
| x̄ | 5 |
| n | 4 |
Common mistakes
- Sample variance: Uses n−1 (degrees of freedom) in the denominator – do not use n.
- Mean x̄: The sample mean – not the population mean.
- Units: Variance is in squared units of the data.
- Unbiased estimator: s² is an unbiased estimator of σ².
- N‑1 vs. N: Using N would bias the estimate downwards.
Applications
Sample variance (s²) estimates the population variance from a sample, using (n−1) in the denominator to provide an unbiased estimate. This correction is crucial in inferential statistics. Engineers use sample variance to estimate process variability from limited data, to construct confidence intervals, and to perform hypothesis tests. In research, it measures how well the sample represents the population. In quality control, it helps set control limits. By using sample variance, professionals can make reliable inferences about the population without measuring every unit. This formula is a cornerstone of statistical analysis, enabling decision‑making under uncertainty and ensuring that conclusions are based on sound principles.
- Estimation of population variability from sample data
- Confidence interval construction for means and variances
- Hypothesis testing (t‑tests, F‑tests)
- Quality control – sample‑based process monitoring
- Research and experimental data analysis
Related calculators · Descriptive Statistics
Recently updated formulas
Suggest an improvement
Found a mistake? Have a better example? Let us know.
You may send up to 3 suggestions per 24 hours.