Statistics · 5 min read
How to Calculate Standard Deviation
Spread around the mean — and why n−1 is not the same as n
Standard deviation measures how spread out values are around the mean. This tutorial walks through the sample (n−1) and population (n) formulas, a 1, 2, 2, 3, 4, 5 worked example, and a tiny dataset playground that plots the spread. It is a teaching sketch, not a full statistics package.
Written by the My Calculator Stack editorial team. About our methods
Sample versus population is a modeling choice, not a diagnosis of the data. This playground is a teaching sketch. Fees, weights, and missing values are omitted.
1.What standard deviation is
Standard deviation is a typical distance from the mean. If every value were identical, the deviation would be zero. If values fan out, the number grows. It is not the range (max − min), not the mean itself, and not a claim that the data are “good” or “bad.” Variance is the square of this measure; we take the square root so the result sits in the same units as the original numbers.
2.The formula
Find the mean, subtract it from each value, square those gaps, then average and take a square root. Sample form divides by n−1 (Bessel’s correction) when the data are a sample from a larger population. Population form divides by n when the list is the whole group you care about. The n−1 divisor is slightly larger in spread for the same numbers; that is the whole difference.
\[ \begin{aligned}s &= \sqrt{\frac{1}{n-1}\sum (x_i-\bar{x})^2} \\\sigma &= \sqrt{\frac{1}{n}\sum (x_i-\mu)^2}\end{aligned} \]
3.Worked example
Take 1, 2, 2, 3, 4, 5 — the same defaults as the standard deviation calculator. The sum is 17 and n = 6, so the mean is 17/6 ≈ 2.833. Squared deviations from that mean add to 65/6 ≈ 10.833. Sample (n−1 = 5): √(10.833 / 5) ≈ 1.472. Population (n = 6): √(10.833 / 6) ≈ 1.344. Same points, two divisors, two spreads.
\[ s=\sqrt{10.833/5}\approx 1.472 \]
4.See the spread
Edit the six values and toggle sample (n−1) versus population (n). The plot places each point on a number line, marks the mean, and shades ±1 standard deviation. Watch the band widen or shrink when the divisor changes. This is a teaching widget — no comma-separated paste box, no full calculator chrome. Open the standard deviation calculator when you want the standalone tool.
Inline playground
Tiny dataset
Sample s
1.472
Mean 2.833 · n = 6 · divisor n−1 = 5
√(10.833 / 5) ≈ 1.472
Teaching sketch only — sample (n−1) versus population (n) is a modeling choice, not a diagnosis of the list.
Open the full standard deviation calculator →5.Open the full calculator
The standard deviation calculator uses the same sample and population formulas and the same 1, 2, 2, 3, 4, 5 example, with How it works and related statistics tools on one page. Browse other statistics calculators if you need a z-score, an average, or mean–median–mode next.
Try it yourself
Open the related calculator and put these formulas to work.