How to Calculate Standard Deviation

The standard deviation formula for samples and populations, then five steps by hand with a worked table: mean, deviations, squares, n - 1 or n, root.

How to Calculate Standard Deviation

The formula for standard deviation is the square root of the variance: s = √(Σ(xᵢ − x̄)² / (n − 1)) for a sample, and σ = √(Σ(xᵢ − μ)² / N) for a population. To learn how to calculate standard deviation, you only need the data, the mean, and the six steps below. OpenStax Introductory Statistics 2e, section 2.7, defines standard deviation as a measure of spread that is the square root of the variance, and the variance as the average of the squared deviations from the mean.

Standard Deviation Formula: Sample And Population

There are two formulas because the data set you have determines the denominator. If your data is a sample drawn to estimate a larger population, you use the sample standard deviation formula: s = √(Σ(xᵢ − x̄)² / (n − 1)). If your data is the entire population, you use the population formula: σ = √(Σ(xᵢ − μ)² / N). The difference is the switch from n − 1 (Bessel's correction) to N. Every symbol has a meaning: x̄ (x-bar) is the sample mean, μ (mu) is the population mean, n is the sample count, N is the population count, and Σ tells you to sum the squared deviations that follow. The sample variance s² is the part before the square root: s² = Σ(xᵢ − x̄)² / (n − 1). The population variance σ² uses N in the denominator.

How To Calculate Standard Deviation By Hand: Step-By-Step

Calculating standard deviation by hand follows six steps. Write the numbers in a column. Step one: calculate the mean (x̄). Add every value and divide by n. Step two: find each deviation from the mean. Subtract x̄ from every data point: xᵢ − x̄. Some results are negative, some positive. Step three: square each deviation. Multiply each deviation by itself: (xᵢ − x̄)². Squaring removes negative signs and gives more weight to larger distances. Step four: sum the squared deviations. Add every squared result: Σ(xᵢ − x̄)². Step five: divide to get the variance. For a sample, divide the sum by n − 1 to get s². For a population, divide by N to get σ². Step six: take the square root of the variance. The result is the standard deviation, in the same unit as the original data.

Sample Standard Deviation Worked Table
xᵢxᵢ − x̄(xᵢ − x̄)²
4−1.21.44
82.87.84
60.80.64
5−0.20.04
3−2.24.84

Standard Deviation Example: Sample Calculation

Use a standard deviation example to see the steps in action with real numbers. Data set: 4, 8, 6, 5, 3. n = 5. Mean: (4 + 8 + 6 + 5 + 3) / 5 = 26 / 5 = 5.2. Deviations: 4 − 5.2 = −1.2, 8 − 5.2 = 2.8, 6 − 5.2 = 0.8, 5 − 5.2 = −0.2, 3 − 5.2 = −2.2. Squared deviations: 1.44, 7.84, 0.64, 0.04, 4.84. Sum of squares: 1.44 + 7.84 + 0.64 + 0.04 + 4.84 = 14.8. Sample variance s²: 14.8 / (5 − 1) = 14.8 / 4 = 3.7. Sample standard deviation s: √3.7 ≈ 1.92. The values typically deviate from the mean by about 1.92 units.

Population Standard Deviation Example

Data set treated as a population: exam scores 78, 85, 93, 88, 76. N = 5. Mean μ: (78 + 85 + 93 + 88 + 76) / 5 = 420 / 5 = 84. Deviations: 78 − 84 = −6, 85 − 84 = 1, 93 − 84 = 9, 88 − 84 = 4, 76 − 84 = −8. Squared deviations: 36, 1, 81, 16, 64. Sum of squares: 36 + 1 + 81 + 16 + 64 = 198. Population variance σ²: 198 / 5 = 39.6. Population standard deviation σ: √39.6 ≈ 6.29. The spread is about 6.29 points.

The Shortcut (Computational) Formula For Standard Deviation

The shortcut (computational) formula for standard deviation avoids calculating each deviation. For a sample: s = √( (Σxᵢ² − (Σxᵢ)² / n) / (n − 1) ). For a population: σ = √( (Σxᵢ² − (Σxᵢ)² / N) / N ). The formula works by summing the raw squares (Σxᵢ²) and subtracting the squared sum divided by the count. This gives the sum of squared deviations without subtracting the mean from each data point. Use it for large data sets or when working with a calculator that does not store individual values. The result is identical to the step-by-step method. For the sample data 4, 8, 6, 5, 3: Σxᵢ = 26, Σxᵢ² = 16 + 64 + 36 + 25 + 9 = 150. (Σxᵢ)² / n = 676 / 5 = 135.2. Σxᵢ² − (Σxᵢ)² / n = 150 − 135.2 = 14.8. Divide by n − 1 = 4 gives 3.7. Square root is 1.92.

Common Mistakes In Standard Deviation Calculation

Pick The Right Denominator

Use n − 1 for a sample, not n. Using n on a sample gives a biased estimate that is too small and is known to be the most frequent introductory error. Forgetting to square the deviations is another error: the sum of the raw deviations (without squaring) always equals zero, so you cannot divide. Rounding too early in the steps inflates rounding error; keep at least three decimal places through the sum of squares and variance, then round the final standard deviation.

Know The Difference Between Variance And Standard Deviation

Confusing standard deviation with variance is a routine mix-up: variance is the squared value inside the square root, standard deviation is the root itself. Using the population formula on a sample underestimates the true variability of the population that the sample is meant to represent. OpenStax Introductory Statistics 2e, section 2.7, notes that the denominator n − 1 corrects for bias in the estimation of the population variance, not the standard deviation. The sample standard deviation s is biased low for the population SD, especially for n under 10.

Check Your Data Distribution First

Reporting the mean and SD for skewed data without checking the distribution is also a mistake; for skewed distributions, use the median and IQR as the appropriate measures of centre and spread.

Common Questions

What is the formula for sample standard deviation?

s = √(Σ(xᵢ − x̄)² / (n − 1)). x̄ is the sample mean, n is the sample size, and Σ means sum the squared deviations.

What is the formula for population standard deviation?

σ = √(Σ(xᵢ − μ)² / N). μ is the population mean, N is the population size, and the denominator is N, not n − 1.

Why is n − 1 used instead of n for sample standard deviation?

Using n − 1 (Bessel's correction) makes the sample variance an unbiased estimator of the population variance. Using n would make the variance too small on average.

When should I use the shortcut formula instead of the step-by-step method?

Use the shortcut formula when you have a calculator that can sum the raw squares but cannot store individual deviations. It avoids subtracting the mean from every data point.