Written & reviewed by Dackohn; last reviewed October 2026.

To calculate standard deviation: (1) find the mean, (2) subtract the mean from each value and square the result, (3) add up those squared differences, (4) divide by n−1 for a sample (or n for a whole population) to get the variance, and (5) take the square root. For 4, 8, 15, 16, 23, 42 the sample standard deviation is ≈ 13.49. Use n−1 when your data is a sample (the usual case).

The formula

Sample standard deviation: s = √( Σ(xi − x̄)² / (n − 1) ). Population: divide by N instead of n−1 and call it σ.

Step by step

  1. Find the mean x̄ — add all values and divide by how many there are.
  2. Find each deviation — subtract the mean from every value.
  3. Square each deviation.
  4. Sum the squared deviations.
  5. Divide by n−1 (sample) or N (population) — this is the variance.
  6. Take the square root of the variance.

Worked example

Data: 4, 8, 15, 16, 23, 42 (n = 6).

  1. Mean = 108/6 = 18.
  2. Deviations: −14, −10, −3, −2, 5, 24.
  3. Squared: 196, 100, 9, 4, 25, 576.
  4. Sum = 910.
  5. Sample variance = 910 / 5 = 182.
  6. s = √182 ≈ 13.49. (Population: 910/6 ≈ 151.67, σ ≈ 12.31.)

In Excel or Google Sheets

Sample vs population — why n−1?

When your data is a sample, dividing by n−1 (Bessel’s correction) corrects a bias that would otherwise make the estimate too small. Use N only when your data is the entire population. Most real analyses use the sample version.

What the number tells you

Standard deviation is the typical distance of a value from the mean, in the same units as the data. For data that are roughly bell-shaped, the 68–95–99.7 rule applies: about 68% of values lie within one SD of the mean, 95% within two, and 99.7% within three. If exam scores have mean 70 and SD 10, about two-thirds of students scored between 60 and 80.

Standard deviation is sensitive to outliers

In the worked example, the single value 42 has a large effect. Without it, the data 4, 8, 15, 16, 23 have mean 13.2 and a sample standard deviation of 7.40, roughly half of 13.49. Because deviations are squared, one far-away value can dominate the result. When data are skewed or contain outliers, report the median and interquartile range alongside, or instead of, the mean and standard deviation.

Variance or standard deviation?

The variance (182 in the example) is the standard deviation squared. It is what statistical methods such as ANOVA work with internally, because variances from independent sources add up. For describing data to a reader, use the standard deviation: it is in the original units, so “scores vary by about 13 points” makes sense, whereas a variance of 182 “squared points” does not.

Common mistakes

Skip the arithmetic: paste your numbers into the descriptive statistics calculator for the SD, variance, mean, and quartiles instantly.

Related

Descriptive StatsCalculate a z-scoreCalculate a CI