Sample or population?
This is the choice that changes the answer, so it is worth getting right.
- Population (σ): your numbers are every member of the group you care about, such as the scores of every student in one class when you only care about that class. Divide by n.
- Sample (s): your numbers are a subset used to estimate a bigger group, such as 50 surveyed customers out of thousands. Divide by n − 1. This is the default in most statistics courses and in Excel's STDEV.S.
Dividing by n − 1 (Bessel's correction) makes the sample variance an unbiased estimate of the population variance. With large samples the two answers are almost the same.
The formulas
s = √( Σ(x − x̄)² ÷ (n − 1) ) σ = √( Σ(x − μ)² ÷ n )
Example
Data: 2, 4, 4, 4, 5, 5, 7, 9 (n = 8).
- Mean = 40 ÷ 8 = 5.
- Squared deviations: 9, 1, 1, 1, 0, 0, 4, 16. Their sum is 32.
- Population: 32 ÷ 8 = 4, so σ = √4 = 2.
- Sample: 32 ÷ 7 ≈ 4.5714, so s ≈ 2.1381.
What the number means
The standard deviation is the typical distance of a value from the mean, in the same units as your data. For roughly bell-shaped data, about 68% of values fall within one standard deviation of the mean and about 95% within two.
Variance is the standard deviation squared. It is useful inside formulas, but harder to read because its units are squared.
Related measures
- To measure how precisely you know the mean, use the standard error calculator.
- For a spread measure that is less sensitive to outliers, look at the range and median on the mean, median, mode calculator.
Frequently asked questions
How do you calculate standard deviation?
Find the mean, subtract it from each value, square the results, add them, divide by n − 1 for a sample (or n for a population), and take the square root.
When should I use n − 1?
Use n − 1 when your data is a sample from a larger group and you want to estimate that group's spread. Use n only when your data is the entire population.
What is the difference between variance and standard deviation?
Variance is the average squared distance from the mean. Standard deviation is its square root, which puts it back in the original units.
Does this match Excel?
Yes. Sample mode matches STDEV.S and VAR.S; population mode matches STDEV.P and VAR.P.
Last checked: 2026-12-03. How we test our calculators.