DigitHelm
Statistics

How to Calculate Standard Deviation: A Step-by-Step Guide

Standard deviation tells you how spread out your data is. This guide explains what it measures, walks through the population and sample formulas step by step, and shows when each version should be used.

DigitHelm TeamFebruary 3, 202511 min read

What Does Standard Deviation Measure?

Standard deviation (SD) measures how much individual values in a dataset differ from the mean. A low standard deviation means values cluster tightly around the mean. A high standard deviation means they are spread far apart.

Consider two sets of exam scores, both with a mean of 70:

Set A: 68, 69, 70, 71, 72 → SD ≈ 1.6 (tightly clustered) Set B: 40, 55, 70, 85, 100 → SD ≈ 22.4 (widely spread)

The mean alone tells you the average. The standard deviation tells you whether that average is representative of most values, or whether the data is chaotic and the mean hides extreme variation.

Population vs Sample Standard Deviation

There are two versions of the formula, and using the wrong one is a common mistake:

Population Standard Deviation (σ)

Use this when your data is the entire population, every member of the group you care about. For example: the exact heights of all 30 students in a single classroom, or the price of every item in a vending machine.

σ = √[ Σ(xᵢ − μ)² / N ] Where: μ = population mean N = total number of values xᵢ = each individual value Σ = sum of all terms

Sample Standard Deviation (s)

Use this when your data is a sample drawn from a larger population, which is most real-world research. The denominator is N−1 instead of N. This is called Bessel's correction, and it compensates for the fact that a sample tends to underestimate the true spread of the full population.

s = √[ Σ(xᵢ − x̄)² / (N−1) ] Where: x̄ = sample mean N−1 = degrees of freedom (Bessel's correction)
Which to use? If you measured every item in the group: use σ (population). If you measured some items and want to describe the group they came from: use s (sample). When in doubt, use the sample formula, it is the more conservative, safer choice.

Step-by-Step Calculation: Worked Example

Dataset: test scores for a sample of 6 students.

Values: 72, 85, 90, 68, 79, 95

Step 1, Calculate the mean

x̄ = (72 + 85 + 90 + 68 + 79 + 95) / 6 = 489 / 6 = 81.5

Step 2, Find each deviation from the mean

72 − 81.5 = −9.5 85 − 81.5 = 3.5 90 − 81.5 = 8.5 68 − 81.5 = −13.5 79 − 81.5 = −2.5 95 − 81.5 = 13.5

Step 3, Square each deviation

(−9.5)² = 90.25 ( 3.5)² = 12.25 ( 8.5)² = 72.25 (−13.5)² = 182.25 (−2.5)² = 6.25 ( 13.5)² = 182.25

Step 4, Sum the squared deviations

Σ(xᵢ − x̄)² = 90.25 + 12.25 + 72.25 + 182.25 + 6.25 + 182.25 = 545.5

Step 5, Divide by N−1 (sample variance)

s² (variance) = 545.5 / (6 − 1) = 545.5 / 5 = 109.1

Step 6, Take the square root (standard deviation)

s = √109.1 ≈ 10.44 The sample standard deviation of these six test scores is approximately 10.4.

This means most scores fall within roughly 10 points of the mean of 81.5, between about 71 and 92, which matches the dataset well.

What Standard Deviation Tells You

For data that follows a normal (bell-shaped) distribution, standard deviation has a precise meaning through the 68-95-99.7 rule(also called the empirical rule):

68% of values fall within 1 SD of the mean (μ ± σ) 95% of values fall within 2 SD of the mean (μ ± 2σ) 99.7% of values fall within 3 SD of the mean (μ ± 3σ)

For the test score example (mean = 81.5, s = 10.4):

1 SD range: 81.5 ± 10.4 = [71.1, 91.9] → expect ~68% of scores here 2 SD range: 81.5 ± 20.8 = [60.7, 102.3] → expect ~95% of scores here

Common Real-World Applications

  • Finance, volatility: The standard deviation of daily stock returns is a direct measure of price volatility. A stock with SD = 2% moves much more unpredictably than one with SD = 0.3%.
  • Quality control: Manufacturers use SD to monitor production consistency. If the SD of component dimensions exceeds a threshold, the process may be out of control.
  • Medicine, clinical trials: SD is reported alongside the mean in clinical studies to show how consistent the treatment response was across patients.
  • Education: Standardised test scores (SAT, IQ) are designed so the SD equals a specific value (e.g. IQ: mean = 100, SD = 15), allowing direct comparison across test-takers.
  • Weather forecasting: A temperature forecast with low SD means high confidence; high SD means greater uncertainty.

Standard Deviation vs Variance

Variance is simply the square of the standard deviation (s²). Both measure spread, but they have different units. If your data is in centimetres, the variance is in cm², an awkward unit. Standard deviation is in the same unit as your original data, making it much easier to interpret in real-world contexts.

Variance is commonly used in mathematical derivations and statistical tests (like ANOVA) because variances add nicely when combining independent datasets. For communication and interpretation, standard deviation is almost always preferred.

Z-Scores: Standard Deviation in Action

A z-score tells you how many standard deviations a particular value sits above or below the mean:

z = (x − μ) / σ Example: score of 95, mean = 81.5, SD = 10.4 z = (95 − 81.5) / 10.4 = 13.5 / 10.4 ≈ 1.30 This score is 1.30 standard deviations above the mean.

Z-scores allow you to compare values from different distributions on a common scale. A z-score of +1.30 corresponds to approximately the 90th percentile of a normal distribution , meaning the student scored better than about 90% of their peers.

Use our free Standard Deviation Calculator to compute both population and sample SD, variance, mean, median, mode, and a complete data summary for any dataset, no manual steps required.

Try These Free Calculators