📐 Standard Deviation & Variance Calculator
Enter your numbers, get sample & population SD/variance — with every squared deviation step shown.
How to Calculate Standard Deviation and Variance — A Step-by-Step Guide
Imagine you have two students. Student A scores 70, 71, 69, 70, 70 in five tests. Student B scores 40, 90, 55, 85, 80. Both average out to exactly 70 — but clearly their performance is wildly different. Standard deviation and variance are the tools that capture this difference. They measure spread: how far the individual data points in a set tend to stray from the mean.
In this guide you will learn the exact arithmetic behind both formulas, understand the crucial difference between the sample and population version, and walk through a concrete worked example from raw numbers all the way to a final answer.
What Does Standard Deviation Actually Mean?
Standard deviation (SD) is expressed in the same units as your original data. If you measured heights in centimetres, your SD is also in centimetres. It answers the intuitive question: "On average, how far do individual values sit from the mean?" A small SD means the data clusters tightly around the average. A large SD signals that the values are more scattered.
Variance is simply the standard deviation squared. It is mathematically convenient (variances can be added across independent variables, SDs cannot), but because it is in squared units it is less intuitive to interpret directly.
Population vs. Sample — The Most Common Point of Confusion
Before diving into arithmetic, you must decide which version of the formula to use.
Population standard deviation (σ) is used when your dataset is the entire group you care about. For example: the exact ages of everyone in a single school class, or the complete production output of one machine over one day.
Sample standard deviation (s) is used when your dataset is a subset drawn from a larger population and you want to estimate the spread of that larger population. This is the case for almost all real-world surveys and experiments. The sample formula divides by n − 1 instead of n. This adjustment (called Bessel's correction) compensates for the fact that a sample tends to underestimate the true spread — the sample mean is itself estimated from the same data, pulling the deviations slightly inward.
When in doubt, use the sample formula. Most scientific papers, spreadsheets, and calculators default to it for good reason.
The Formulas
Let your data values be x₁, x₂, … xₙ and their mean be x̄.
- Population variance: σ² = Σ(xᵢ − μ)² / n
- Population SD: σ = √σ²
- Sample variance: s² = Σ(xᵢ − x̄)² / (n − 1)
- Sample SD: s = √s²
The symbol Σ means "sum over all values." The term (xᵢ − x̄)² is called a squared deviation. Squaring serves two purposes: it makes all deviations positive (so positive and negative deviations do not cancel), and it penalises larger deviations more heavily.
Worked Example: Five Numbers from Scratch
Let's use the dataset: 4, 8, 6, 5, 3
Step 1 — Count and sum.
n = 5 | Sum = 4 + 8 + 6 + 5 + 3 = 26
Step 2 — Find the mean.
x̄ = 26 ÷ 5 = 5.2
Step 3 — Find each deviation (xᵢ − x̄).
- 4 − 5.2 = −1.2
- 8 − 5.2 = 2.8
- 6 − 5.2 = 0.8
- 5 − 5.2 = −0.2
- 3 − 5.2 = −2.2
Notice these deviations always sum to zero (−1.2 + 2.8 + 0.8 − 0.2 − 2.2 = 0). This is a useful sanity check.
Step 4 — Square each deviation.
- (−1.2)² = 1.44
- (2.8)² = 7.84
- (0.8)² = 0.64
- (−0.2)² = 0.04
- (−2.2)² = 4.84
Step 5 — Sum the squared deviations.
Σ(xᵢ − x̄)² = 1.44 + 7.84 + 0.64 + 0.04 + 4.84 = 14.8
Step 6 — Divide to get variance.
- Population variance: 14.8 ÷ 5 = 2.96
- Sample variance: 14.8 ÷ 4 = 3.7
Step 7 — Take the square root to get standard deviation.
- Population SD (σ): √2.96 ≈ 1.7205
- Sample SD (s): √3.7 ≈ 1.9235
So in plain language: if this dataset is our entire population, values typically deviate from the mean by about 1.72 units. If this is a sample from a larger group, our best estimate of the population spread is about 1.92 units.
Interpreting the Results
Standard deviation by itself is only meaningful when you compare it to something. Here are the most common interpretations:
Relative to the mean (Coefficient of Variation): Divide SD by the mean and multiply by 100 to get a percentage. A CV of 5% means data is tightly clustered; 50% signals high variability. This is especially useful when comparing datasets measured in different units.
The 68-95-99.7 Rule (for normally distributed data): If your data follows a bell curve, roughly 68% of values fall within one SD of the mean, 95% within two SDs, and 99.7% within three. This rule is the backbone of quality control charts, IQ scoring, grading on a curve, and clinical reference ranges.
Comparing two groups: A dataset with SD = 2 and mean = 50 is far more consistent than one with SD = 15 and mean = 50, even though both center on the same point.
Common Mistakes to Avoid
Using the population formula when you should use sample: If you collected 30 survey responses out of a city of a million people, dividing by n instead of n−1 will underestimate variability and can cause false confidence in your conclusions.
Forgetting to square root at the end: Variance and standard deviation are related but different. Always take the square root before reporting standard deviation.
Outliers inflate SD dramatically: Because deviations are squared, one extreme value can dominate the entire calculation. Always scan your raw data for typos or genuine outliers before interpreting the SD.
Where These Statistics Show Up in Real Life
Finance uses standard deviation as the primary measure of investment risk — a stock with high SD has volatile returns. Manufacturing uses it for process control: if the SD of bolt diameters drifts above a threshold, the machine needs calibration. In education, standardised test scores are scaled so the population has a known mean and SD, letting colleges compare students across different exams. Weather forecasters report temperature "uncertainty bands" that are essentially ± one or two standard deviations of ensemble model outputs.
Understanding how to compute and read these numbers puts you in command of one of the most universally used concepts in quantitative thinking — and our calculator above does the heavy lifting, showing every squared deviation so you can verify each step yourself.