Use σ (divide by n) when your data is the whole population you care about, and s (divide by n − 1) when it is a sample used to estimate a larger population. For 2, 4, 4, 4, 5, 5, 7, 9, σ = 2 and s ≈ 2.138.
The two formulas
Standard deviation measures how spread out data is around its mean. Both versions square each deviation from the mean and add them up; they differ only in what you divide by.
- Population SD σ = √( Σ(x − x̄)² ÷ n )
- Sample SD s = √( Σ(x − x̄)² ÷ (n − 1) )
Calculators usually label them σx and sx. In Excel, STDEV.P is σ and STDEV.S (formerly STDEV) is s.
Worked example
The data 2, 4, 4, 4, 5, 5, 7, 9 has n = 8 and mean 40 ÷ 8 = 5.
| x | x − 5 | (x − 5)² |
|---|---|---|
| 2 | −3 | 9 |
| 4 (three times) | −1 | 1 × 3 = 3 |
| 5 (twice) | 0 | 0 |
| 7 | 2 | 4 |
| 9 | 4 | 16 |
| Total | 32 | |
- σ² = 32 ÷ 8 = 4, so σ = 2
- s² = 32 ÷ 7 ≈ 4.571428571, so s = √(32/7) ≈ 2.138089935
Open this data on the statistics screen ▸
Why divide by n − 1?
A sample’s mean x̄ is, by construction, the value closest to that sample, so the sum of squared deviations around it tends to come out a little smaller than it would around the true population mean. Dividing by the slightly smaller n − 1 corrects for that and gives an unbiased estimate of the population variance. This is called Bessel’s correction.
Which one should you use?
- σ: you have every member of the group you care about, such as all 30 test scores in a class or 12 months of this year’s sales.
- s: you measured part of a larger group to learn about the whole, such as 10 items pulled from a production line or a survey of 1,000 people.
- Textbook exercises often want σ; lab reports and statistical tests almost always use s. If the question says “sample”, use s.
The gap shrinks as n grows. With n = 100, s is √(100/99) ≈ 1.005 times σ, only about 0.5% larger.
Published 2026-10-06 · Updated 2026-10-06 · Lumen Lab