Find the mean, subtract it from each value, square the differences, add them up, divide by n − 1 for a sample (or n for a whole population) and take the square root: s = √[Σ(x − x̄)² ÷ (n − 1)].
Example with 4, 8, 15, 16, 23 and 42: the mean is 108 ÷ 6 = 18. The squared differences are 196, 100, 9, 4, 25 and 576, totaling 910. Sample variance = 910 ÷ 5 = 182, so the sample standard deviation is √182 = 13.4907. Treated as a full population, the variance is 910 ÷ 6 = 151.6667 and the standard deviation 12.3153.
Sample or population?
Use sample when your numbers are a subset used to estimate a larger group — survey answers, test batches, a few months of returns. Use population only when you have every member of the group, such as the scores of all students in one class. When in doubt, sample is the safer choice and is the standard in most statistics software.
Reading the other results
Variance is the standard deviation squared, in squared units. The coefficient of variation is the standard deviation as a percentage of the mean, useful for comparing spread between data sets on different scales (75% in the example — a very spread-out set). The standard error (s ÷ √n) estimates how much the sample mean itself would vary between samples.
The 68–95–99.7 rule
For data that is roughly bell-shaped, about 68% of values fall within one standard deviation of the mean, 95% within two and 99.7% within three. It does not apply to skewed data, such as incomes or the example above, where one large value (42) stretches the spread.