Interactive tool

Variance and Standard Deviation Calculator — Population vs Sample Formula

Variance measures the average squared distance of each value from the mean. Standard deviation is its square root — bringing the result back to the original unit. Population variance divides by n; sample variance divides by n − 1 (Bessel's correction). For dataset {4, 7, 13, 16, 20}: mean = 12, population variance = 34.8, population standard deviation = 5.90. This calculator returns both population and sample versions side by side.

Client-side

Enter 2 to 30 positive values separated by commas, spaces, or line breaks.

Result Ready
Comparison Ready
Count Ready
Note Ready

Spread & dispersion

Before you calculate

Variance measures the average squared distance of each value from the mean. Standard deviation is its square root — bringing the result back to the original unit. Population variance divides by n; sample variance divides by n − 1 (Bessel's correction). For dataset {4, 7, 13, 16, 20}: mean = 12, population variance = 34.8, population standard deviation = 5.90. This calculator returns both population and sample versions side by side.

Best forMeasuring how spread out a dataset is around its mean — essential for quality control, risk analysis, grading curves, and any analysis where consistency matters as much as the average. InputTwo to 30 numeric values (positive, negative, and zero are all valid). OutputMean, population variance, sample variance, population standard deviation, sample standard deviation — all shown together.

Three things SD tells you that the mean cannot

Standard deviation quantifies the uncertainty hiding inside an average. A mean without SD is an incomplete summary.

Consistency

Same mean, completely different datasets

Dataset A {10, 10, 10, 10, 10} and Dataset B {2, 6, 10, 14, 18} both have mean = 10. Dataset A has SD = 0 (perfectly consistent); Dataset B has SD = 5.66 (spread across a 16-point range). A quality-control engineer needs both numbers.

68-95-99.7 rule

SD maps to probability under normal distribution

For normally distributed data: 68% of values fall within ±1 SD of the mean, 95% within ±2 SD, 99.7% within ±3 SD. For {4, 7, 13, 16, 20}: mean = 12, σ = 5.90 → 68% of values expected between 6.10 and 17.90. Three of the five values (7, 13, 16) fall in this range.

Bessel’s correction

Why sample SD divides by n−1

A sample tends to underestimate the full population’s spread because extreme values are less likely to be sampled. Dividing by n−1 instead of n inflates the estimate slightly to correct for this bias. For n = 5: s² = 170/4 = 42.5 versus σ² = 170/5 = 34.8. The 22% increase accounts for the missing coverage at the tails.

When to use each spread formula

The choice of population or sample formula changes the numeric result. Each row shows a real situation and which formula is correct.

Situation Input Best next move Why
All scores from one class exam 30 scores; this is the complete group Population SD (÷ n) in Excel: =STDEV.P() No estimation involved — you have every value in the group.
Survey of 100 users from 10,000 100 satisfaction scores Sample SD (÷ n−1) in Excel: =STDEV.S() The 100 scores estimate the spread of all 10,000 users.
Two products with the same mean defect rate Product A: {1,1,1,1,1}, Product B: {0,0,1,2,2} Compare SD: A = 0, B = 0.89 Same mean (1.0) hides that Product B is inconsistent.
Investment return volatility Annual returns: 6%, 8%, −35%, 10%, 12% Pair sample SD with geometric mean (CAGR) SD = 18.0% captures risk; CAGR = −2.0%/yr captures the compound return.

Step-by-step: how to use this calculator correctly

01

Decide first: are these values the entire group (population) or a subset drawn from a larger group (sample)? This determines which formula applies.

02

Enter values separated by commas, spaces, or line breaks. At least 2 values are required; at least 3 values are needed for meaningful sample standard deviation.

03

Read the mean and standard deviation together. A mean of 12 with σ = 5.90 means roughly 68% of values fall between 6.10 and 17.90 (one standard deviation), assuming normal distribution.

04

If population σ and sample s differ significantly, your sample is small — consider collecting more data before drawing conclusions.

Dataset {4, 7, 13, 16, 20}: full spread calculation step by step

Given

Values: 4, 7, 13, 16, 20 | n = 5 | mean = (4+7+13+16+20)/5 = 60/5 = 12

Work

Squared deviations: (4−12)²=64, (7−12)²=25, (13−12)²=1, (16−12)²=16, (20−12)²=64. Sum = 170. Population variance = 170/5 = 34.8. Sample variance = 170/4 = 42.5.

Result

Population SD = √34.8 = 5.90 | Sample SD = √42.5 = 6.52. The sample SD is 10% larger — Bessel's correction assumes the full population is more spread than the sample suggests.

Takeaway

SD of 5.90 on a mean of 12 means a coefficient of variation of 49% — this dataset is widely spread relative to its center. Compare with a tight dataset like {10, 11, 12, 13, 14} where SD = 1.58 and CV = 13%.

Four spread and center metrics: which to pair with your data

Mean tells you where data is centered. Variance and standard deviation tell you how far values typically stray from that center. Use them together — one without the other is incomplete.

Method Best for Watch for Example
Population variance (σ²) When the dataset contains every member of the group you are describing. Divides by n. Underestimates spread for samples — use s² instead. All 30 students in one class: σ² = 34.8 for {4, 7, 13, 16, 20}.
Sample variance (s²) When the dataset is a subset used to estimate the spread of a larger group. Divides by n−1 (Bessel’s correction). s² is always larger than σ² for the same data. Same data as above: s² = 170/4 = 42.5, which is 22% larger than σ² = 34.8.
Standard deviation (σ or s) Reading spread in the original unit so it is directly comparable to the mean. Sensitive to extreme values, just like the mean. A single outlier inflates both. For {4, 7, 13, 16, 20}: mean = 12, σ = 5.90. Typical value is within 12 ± 5.90.
Mean (AM) Locating the center of the data distribution. Mean alone is misleading without SD. Mean = 10 for both {10,10,10} and {2,6,10,14,18}. {2, 6, 10, 14, 18}: mean = 10, SD = 5.66. {10, 10, 10, 10, 10}: mean = 10, SD = 0.

Dataset {4, 7, 13, 16, 20}: spread around mean = 12

Squared deviations: (4-12)²=64, (7-12)²=25, (13-12)²=1, (16-12)²=16, (20-12)²=64. Sum = 170. σ² = 34.8, σ = 5.90.

4
4
7
7
Mean
12
13
13
16
16
20
20

Standard deviation calculation: 5 steps for {4, 7, 13, 16, 20}

SD = √(Σ(xᵢ − μ)² / n). Every step shown with the actual numbers.

01 Mean

(4+7+13+16+20)/5 = 60/5 = 12.

02 Deviate

Differences from mean: −8, −5, +1, +4, +8.

03 Square

Squared: 64, 25, 1, 16, 64. Sum = 170.

04 Average

Population: 170/5 = 34.8. Sample: 170/4 = 42.5.

05 Root

σ = √34.8 = 5.90. s = √42.5 = 6.52.

Key facts before you calculate

Population formula (÷ n) versus sample formula (÷ n − 1): which to use

Use population standard deviation (σ, divides by n) when the dataset contains every member of the group you want to describe — all students in one class, all machines on one production line. Use sample standard deviation (s, divides by n − 1) when the dataset is a subset drawn to estimate the larger group — 100 survey respondents representing 10,000 users. Bessel's correction (n − 1) makes s slightly larger than σ because samples tend to underrepresent extreme values. For n = 5: dividing by 4 instead of 5 increases the estimate by 25%.

Why the mean alone is not enough — and how SD completes the picture

Two datasets can share the same arithmetic mean but have completely different distributions. Dataset A: {10, 10, 10, 10, 10} → mean = 10, SD = 0. Dataset B: {2, 6, 10, 14, 18} → mean = 10, SD = 5.66. Same center, completely different spread. A quality-control team watching a manufacturing process cares about both: a mean within spec but a high SD signals inconsistency that AM alone would hide.

Three variance and standard deviation errors that change the result

Each mistake below produces a different number — not just a different interpretation.

Watch for

Using population formula for a sample

For {4, 7, 13, 16, 20} as a sample: σ = 5.90 (wrong) vs s = 6.52 (correct). The 10% difference grows as the sample gets smaller. Use s² = Σ(xᵢ−x̄)² / (n−1) when estimating a larger group.

Watch for

Comparing standard deviations in different units

SD = 5.90 points for scores and SD = 2.1 kg for weights cannot be compared directly. Use coefficient of variation (CV = SD / mean × 100%) for unit-free comparison: CV = 5.90/12 × 100% = 49%.

Watch for

Removing outliers to reduce SD without cause

Removing the 20 from {4, 7, 13, 16, 20} drops σ from 5.90 to 4.44. That is a 25% reduction from a single deletion. Keep outliers unless you have a documented data-quality reason (sensor fault, entry error).

Keep going

Continue with the Statistics hub, compare this result against a related method, or open a guide that covers the same data pattern in more depth.

HubStatistics Calculators: Arithmetic, Weighted, Geometric, and Harmonic Mean

The three Pythagorean means — arithmetic, geometric, and harmonic — each answer a different averaging question. Arithmetic mean sums values; geometric mean multiplies them; harmonic mean uses reciprocals for rates. This hub links to each calculator, explains which one fits your data, and shows Excel equivalents for each formula.

Additive averageArithmetic Mean Calculator — Formula, Examples, and When to Use It

Arithmetic mean (AM) is the sum of all values divided by the count: AM = (x₁ + x₂ + ⋯ + xₙ) / n. It is the correct average when every value contributes equally to a total — such as test scores, temperatures, and counts. This calculator computes AM alongside geometric and harmonic mean so you can confirm which average best fits your data.

Unequal-importance averageWeighted Mean Calculator - Values, Weights, Formula, and Examples

Weighted mean is the correct average when each value does not count equally. Formula: weighted mean = sum(value x weight) / sum(weight). Use it for course grades with different credit weights, portfolio returns with different capital allocations, survey results with sample weights, and prices with different quantities. This calculator returns weighted mean, arithmetic mean, total weight, and weighted sum so you can see how much the weights changed the result.

Rate & reciprocal averageHarmonic Mean Calculator — Formula, Speed Examples, and Rate Averaging

Harmonic mean (HM) is n divided by the sum of reciprocals: HM = n / (1/x₁ + 1/x₂ + ⋯ + 1/xₙ). It is the correct average when each value is a rate applied over an equal distance, budget, or unit — such as speeds over equal distances or prices per equal spending. Classic example: traveling 100 km at 30 mph and 100 km at 60 mph — the true average speed is HM = 40 mph, not the arithmetic mean of 45 mph.

ComparisonGeometric Mean vs Arithmetic Mean: Which Average Is Correct?

Arithmetic mean (AM = sum/n) is correct for additive values. Geometric mean (GM = nth root of product) is correct when values multiply or compound. For scores 72, 80, 88, 96: AM = 84 (correct). For annual return factors 1.06, 0.92, 1.15: GM = 1.038 = 3.8%/yr (correct) — AM of 1.043 overstates by 0.5 pp and compounds to the wrong ending value.

ComparisonGeometric Mean vs Harmonic Mean: Factors vs Rates

Geometric mean (GM) is correct when values multiply: growth factors, fold changes, index relatives. Harmonic mean (HM) is correct when rates share an equal denominator: equal-distance speeds, equal-budget prices per unit. For 30 mph and 60 mph over equal distance: HM = 40 mph (correct travel time), GM = 42.43 mph (wrong), AM = 45 mph (wrong by 33 minutes per 200 km).

ComparisonMean, Median, Mode, and Range: When to Use Each

Mean is the arithmetic average (sum/n). Median is the middle value when sorted. Mode is the most frequent value. Range = max − min. For {30k, 34k, 35k, 38k, 200k}: mean = $67.4k (pulled up by outlier), median = $35k (representative of typical), mode = none, range = $170k. Reporting mean alone for skewed income data overstates the typical salary by 93%.

ComparisonWhich Average Should I Use? AM, GM, HM, Median, or Mode

Arithmetic mean (AM) is correct for additive values: scores 72+80+88+96 → AM = 84. Geometric mean (GM) is correct for multiplicative values: growth factors 1.06×0.65×1.10 → GM = 0.9144 = −8.56%/yr. Harmonic mean (HM) is correct for equal-denominator rates: 30 mph and 60 mph over equal distance → HM = 40 mph. Median is correct for skewed data: incomes {$30k,$34k,$35k,$38k,$200k} → median = $35k (mean = $67.4k is 93% too high). Mode is correct for categories: survey {A,B,B,C,B,A} → mode = B.

Frequently asked questions

Should I use population or sample standard deviation?

If your dataset contains every value in the group (all employees in a company, all items produced in a shift), use population SD (÷ n). If it is a sample (e.g., 50 employees randomly chosen from 1,000), use sample SD (÷ n − 1). In Excel: =STDEV.P() for population, =STDEV.S() for sample.

Why is standard deviation easier to read than variance?

Variance squares the deviations, so its unit is the square of the original (e.g., points² for test scores). Standard deviation takes the square root, returning the result to the original unit (points). For {4, 7, 13, 16, 20}: variance = 34.8 points², SD = 5.90 points — directly comparable to the mean of 12 points.

Why are deviations squared instead of just taking absolute values?

Squaring serves two purposes: (1) it prevents positive and negative deviations from canceling (|+8| and |−8| both contribute equally), and (2) it gives disproportionately more weight to large deviations — a value 8 units from the mean contributes 64 to the sum, while a value 4 units away contributes only 16. This is a deliberate feature that makes variance sensitive to large swings.

Can standard deviation be zero?

Yes, but only when every value is identical. {5, 5, 5, 5, 5}: mean = 5, all deviations = 0, σ = 0. A SD of zero means complete consistency — no variation in the data.

Is a high standard deviation always bad?

No. Context determines whether high spread is a problem. High SD in investment returns = more risk (bad for conservative investors). High SD in product test scores = wide customer talent range (neutral or good). Compare SD to the mean (CV) and to a relevant benchmark.

Should I remove outliers before calculating standard deviation?

Remove values only when you have a documented, non-statistical reason: sensor malfunction, data entry error, wrong unit. Removing outliers to get a 'cleaner' SD is statistical manipulation. Instead, report the SD both with and without the outlier, and note the reason.