Formula
Sample: s = √( Σ(x − x̄)² ÷ (n − 1) )Population: σ = √( Σ(x − μ)² ÷ n )
- x̄, μ
- mean of the values
- n
- number of values
How it works
The mean is found first. Each value’s distance from the mean is squared, so negative and positive deviations do not cancel, and the squares are added. Dividing that sum by n gives the population variance; dividing by n − 1 gives the sample variance. The standard deviation is the square root of the variance, which puts it back in the original units.
Arithmetic is done in exact decimal steps rather than binary floating point, so results for values like 0.1 and 0.2 do not pick up rounding noise before the final six-decimal display.
Worked examples
Six sample measurements
Mean 10.333, sum of squares 55.333, sample variance 11.067, s = 3.32666.
- Data
- 6, 8, 9, 11, 13, 15
- Standard deviation
- 3.32666
Classic population example
The mean is 5 and the squared deviations add to 32; 32 ÷ 8 = 4, so σ = 2.
- Data
- 2, 4, 4, 4, 5, 5, 7, 9
- Data is a
- Whole population (divide by n)
- Standard deviation
- 2
Sample or population?
Use sample when your numbers are a subset used to describe something larger: survey answers, lab replicates, a month of daily sales. The n − 1 (Bessel’s correction) compensates for the sample mean being fitted to the same data. Use population only when you have every member of the group you care about, such as the scores of every student in one class.
The difference matters for small data sets and fades as n grows: with 6 values the sample SD is about 9.5% larger; with 100 values, about 0.5%.
Reading the result
- For roughly bell-shaped data, about 68% of values fall within one SD of the mean and 95% within two.
- The coefficient of variation (SD ÷ mean) compares spread between data sets with different units or scales.
- The standard error (s ÷ √n) describes how precisely the mean is estimated, not the spread of the data.
Related calculators
- Average CalculatorPaste a list of numbers to get the mean, median, mode, and range in one step.
- Z-Score CalculatorTurn a raw score into a z-score and percentile, look up the normal probability for any z, or find the z-score for a percentile.
- Weighted Grade CalculatorCombine category scores and their weights from your syllabus into one course grade, with each category’s contribution shown.
- Percent Error CalculatorMeasure how far an experimental or estimated value is from the accepted true value.
Last reviewed: