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.

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