How to Calculate Standard Deviation (Step by Step)
Learn to calculate standard deviation and variance for populations and samples. Covers formulas, z-scores, normal distribution, and real-world interpretation with worked examples.
Standard deviation measures how spread out a set of numbers is around their average. A small standard deviation means values cluster near the mean; a large one means they scatter widely. This single number tells you more about your data than the average alone ever could.
This guide walks through the calculation process, explains when to use population versus sample formulas, connects standard deviation to the normal distribution and z-scores, and shows how to interpret the results in real-world contexts. For instant results, use our Standard Deviation Calculator.
What Standard Deviation Actually Measures
Consider two classes that both scored a mean of 80 on a test:
- Class A scores: 78, 79, 80, 81, 82
- Class B scores: 55, 70, 80, 90, 105
Both classes have the same average, but they look nothing alike. Class A’s scores are tightly grouped — every student performed similarly. Class B’s scores are all over the map. Standard deviation captures this difference numerically. Class A’s standard deviation is about 1.4; Class B’s is about 17.9.
The Formula: Step by Step
Population Standard Deviation
Use this when your data represents the entire group you care about (every student in a class, every product in a batch, every game in a season).
Where:
- sigma is the population standard deviation
- x_i is each individual value
- mu is the population mean
- N is the total number of values
Sample Standard Deviation
Use this when your data is a subset of a larger population (a survey of 500 people representing 330 million, a sample of 30 bolts from a production run of 10,000).
The only difference is dividing by n - 1 instead of N. This adjustment, called Bessel’s correction, compensates for the fact that a sample tends to underestimate the true population variability. Dividing by n - 1 produces a slightly larger (and more accurate) estimate.
Worked Example
Dataset: 6, 8, 10, 12, 14 (treating this as a sample)
Step 1: Calculate the mean.
Step 2: Subtract the mean from each value and square the result.
| Value (x) | x - mean | (x - mean)^2 |
|---|---|---|
| 6 | -4 | 16 |
| 8 | -2 | 4 |
| 10 | 0 | 0 |
| 12 | 2 | 4 |
| 14 | 4 | 16 |
Step 3: Sum the squared differences.
16 + 4 + 0 + 4 + 16 = 40
Step 4: Divide by n - 1 (for a sample).
40 / (5 - 1) = 40 / 4 = 10
This intermediate result (10) is the variance.
Step 5: Take the square root.
The sample standard deviation is 3.16. Since the original data is in plain numbers, the standard deviation is also in the same units.
Variance: The Close Relative
Variance is the square of the standard deviation (or equivalently, standard deviation is the square root of variance). In the example above, variance = 10 and standard deviation = 3.16.
Why both exist:
- Variance is easier to work with mathematically. Variances of independent variables add together, which is useful in probability theory and regression analysis.
- Standard deviation is easier to interpret because it shares the same units as the original data. If you’re measuring heights in centimeters, standard deviation is in centimeters. Variance would be in “square centimeters,” which isn’t intuitive for describing height.
In practice, you will see standard deviation used far more often in reports and dashboards because readers can immediately relate it to the data.
The Normal Distribution and the 68-95-99.7 Rule
When data follows a normal (bell curve) distribution — and a surprising amount of real-world data does — standard deviation tells you exactly how the values spread out:
- 68% of values fall within 1 standard deviation of the mean (mean +/- 1 SD)
- 95% of values fall within 2 standard deviations (mean +/- 2 SD)
- 99.7% of values fall within 3 standard deviations (mean +/- 3 SD)
Example: Adult male height in the US has a mean of about 69.1 inches with a standard deviation of 2.9 inches.
- 68% of men are between 66.2 and 72.0 inches (5’6” to 6’0”)
- 95% of men are between 63.3 and 74.9 inches (5’3” to 6’3”)
- 99.7% of men are between 60.4 and 77.8 inches (5’0” to 6’6”)
A man who is 6’5” (77 inches) is about 2.7 standard deviations above the mean. That tells you he is taller than roughly 99.6% of the male population without needing to look at the actual height distribution.
Z-Scores: Standardizing Data
A z-score tells you how many standard deviations a particular value is from the mean.
Example: An exam has a mean score of 72 and a standard deviation of 8. You scored 88.
Your score is 2.0 standard deviations above the mean. Using the normal distribution, a z-score of 2.0 means you scored higher than approximately 97.7% of test-takers.
Why Z-Scores Matter
Z-scores let you compare values from entirely different scales. A student scored 720 on the SAT (mean 1050, SD 200) and 28 on the ACT (mean 21, SD 5). Which is better relative to other test-takers?
- SAT z-score: (720 - 1050) / 200 = -1.65
- ACT z-score: (28 - 21) / 5 = 1.40
The ACT score is 1.40 standard deviations above the mean; the SAT score is 1.65 standard deviations below it. The ACT performance is clearly stronger, even though the raw numbers aren’t directly comparable.
Population vs. Sample: How to Decide
| Situation | Type | Divide by |
|---|---|---|
| Scores of every student in your class | Population | N |
| Survey of 1,000 randomly selected voters | Sample | n - 1 |
| Every transaction at your store last month | Population | N |
| 50 items pulled from a warehouse for quality check | Sample | n - 1 |
| All games played by a team this season | Population | N |
Rule of thumb: If you measured everything you care about, it’s a population. If you measured a portion and want to generalize to a larger group, it’s a sample. When in doubt, use the sample formula — it’s the more conservative choice.
Real-World Interpretation
Finance: Volatility
In investing, standard deviation of returns equals volatility. A stock with an average annual return of 10% and a standard deviation of 25% experienced wide swings. In about two-thirds of years, the return was between -15% and +35%. A bond fund averaging 4% with a standard deviation of 3% is far more predictable. Investors use this to match investments to their risk tolerance.
Manufacturing: Quality Control
A factory producing bolts with a target diameter of 10.00 mm and a standard deviation of 0.02 mm can expect 99.7% of bolts to fall between 9.94 mm and 10.06 mm. Any bolt outside 3 standard deviations triggers an investigation. Six Sigma methodology targets a process standard deviation so small that defects are below 3.4 per million — the “six sigma” refers to fitting six standard deviations between the process mean and the nearest specification limit.
Education: Grading on a Curve
Curving exam grades typically uses standard deviation. A common approach: A for scores above mean + 1.5 SD, B for mean + 0.5 SD to mean + 1.5 SD, C for mean - 0.5 SD to mean + 0.5 SD, and so on. This guarantees a fixed distribution of grades regardless of exam difficulty.
Weather: Climate Variability
A city with a mean July temperature of 85F and a standard deviation of 3F has predictable summers. A city with the same mean but a standard deviation of 10F experiences wild temperature swings. The standard deviation tells you how much to trust the average as a predictor of any given day.
Coefficient of Variation
When comparing variability across datasets with different means or different units, raw standard deviation is misleading. The coefficient of variation (CV) expresses standard deviation as a percentage of the mean:
Example: Machine A produces bolts with a mean diameter of 10 mm (SD = 0.5 mm). Machine B produces pipes with a mean diameter of 200 mm (SD = 4 mm). Which is more consistent?
- CV for Machine A: (0.5 / 10) x 100 = 5%
- CV for Machine B: (4 / 200) x 100 = 2%
Machine B is more consistent despite having a larger absolute standard deviation.
Compute standard deviation, variance, and more with our Standard Deviation Calculator.
Frequently Asked Questions
What is a “good” standard deviation?
There’s no universal good or bad value — it depends entirely on context. A standard deviation of 5 is huge if you’re measuring the length of mass-produced screws (suggesting poor quality control) but trivial if you’re measuring daily website visitors that average 100,000. Compare the standard deviation to the mean using the coefficient of variation, or compare it against an industry benchmark or specification tolerance.
Why do we square the differences instead of using absolute values?
Squaring accomplishes three things: it makes all differences positive (like absolute values would), it penalizes large deviations more than small ones, and it produces a formula that is mathematically tractable for calculus-based derivations in statistics. The alternative using absolute values is called Mean Absolute Deviation (MAD) and is used in some applications, but standard deviation remains dominant because of its connection to the normal distribution and variance.
Can standard deviation be zero?
Yes, but only when every value in the dataset is identical. If all five test scores are 80, the mean is 80, every deviation is zero, and the standard deviation is zero. In practice, a standard deviation of zero means there’s no variability at all — every observation gave the same result.
What is the relationship between standard deviation and standard error?
Standard deviation describes the spread of individual data points. Standard error of the mean (SEM) describes how much the sample mean itself would vary if you repeated the study many times. SEM = standard deviation / sqrt(n). As your sample size grows, SEM shrinks (your estimate of the mean gets more precise), but the standard deviation of the underlying data stays roughly the same.
Should I report standard deviation or variance?
Report standard deviation in most contexts because it uses the same units as your data and is easier for readers to interpret. Report variance when doing mathematical operations that require it (like combining variabilities of independent variables) or when writing for a statistical audience that expects it. Many publications report both: “mean = 42.3, SD = 5.1 (variance = 26.0).”
Related Calculators
Related Articles
- How to Calculate Days Between Two Dates
Step-by-step guide to calculating the exact number of days between any two dates. Covers leap years, business days, month lengths, and worked examples.
- How to Calculate Discounts and Sale Prices
Learn the discount formula, how stacking coupons actually works (20%+10% isn't 30%), and how to compare deals after tax. Includes real Black Friday examples.
- How to Calculate Your Exact Age in Days
Learn how to calculate your exact age in days, hours, and seconds. Covers leap year math, fun age milestones, zodiac date ranges, and legal age thresholds.
- How to Calculate Your GPA (4.0 Scale Guide)
Learn the exact formula to calculate your semester and cumulative GPA on a 4.0 scale. Includes a worked example with 5 courses and tips to raise a low GPA.
Share this article
Have suggestions for this article?