Standard Deviation Explained — How to Calculate It Step by Step (With Examples)

Learn what standard deviation is, how to calculate it by hand or with a tool, and why it matters. Includes worked examples, the difference between population and sample, and common mistakes.

The Quick Answer

Standard deviation measures how spread out numbers are from their average. The formula for a sample is:

s = √[Σ(xᵢ − x̄)² / (n − 1)]

Where x̄ is the mean, n is the count, and Σ means "sum of."

A small standard deviation means values cluster tightly around the mean. A large one means values are widely scattered. You can calculate it instantly with our standard deviation calculator.

What Is Standard Deviation?

Standard deviation answers one question: how far do values typically fall from the average?

Suppose two classrooms both have a mean test score of 75. In Classroom A, every student scored between 70 and 80. In Classroom B, scores ranged from 40 to 100. Both means are identical, but the data tells very different stories. Standard deviation captures that difference.

  • Classroom A might have a standard deviation of 3 — tight clustering.
  • Classroom B might have a standard deviation of 18 — wide spread.

The mean alone never tells the full story. Standard deviation is the companion statistic that reveals how much variation exists in the data.

The Formula

There are two versions of the formula, depending on whether you have data for an entire population or just a sample.

Sample Standard Deviation (s)

Use this when your data is a subset of a larger group — which is almost always the case in practice.

s = √[Σ(xᵢ − x̄)² / (n − 1)]

The denominator is (n − 1), called Bessel's correction. It compensates for the fact that a sample tends to underestimate the true population spread.

Population Standard Deviation (σ)

Use this only when you have every single data point from the entire group.

σ = √[Σ(xᵢ − μ)² / n]

Here μ (mu) represents the population mean, and the denominator is simply n.

When to Use Which

Scenario Use Denominator
Survey of 200 customers out of 50,000 Sample (s) n − 1
All 30 students in a single class Population (σ) n
Clinical trial with 500 participants Sample (s) n − 1
Every transaction in your database for 2025 Population (σ) n

When in doubt, use sample (n − 1). It's the safer choice and the default in most statistical software.

Step-by-Step Calculation

Let's work through an example from scratch. Suppose you recorded the daily high temperatures (in °C) for one week:

Data: 18, 22, 19, 25, 20, 23, 21

Step 1: Find the mean

Add all values and divide by the count.

x̄ = (18 + 22 + 19 + 25 + 20 + 23 + 21) / 7 = 148 / 7 = 21.14

Step 2: Subtract the mean from each value

These differences are called deviations.

Value (x) Deviation (x − x̄)
18 −3.14
22 +0.86
19 −2.14
25 +3.86
20 −1.14
23 +1.86
21 −0.14

Notice: the deviations always sum to zero (or very close, due to rounding). That's why we can't just average the deviations — positives and negatives cancel out.

Step 3: Square each deviation

Squaring removes the sign and gives more weight to values far from the mean.

Value (x) Deviation Squared Deviation
18 −3.14 9.88
22 +0.86 0.73
19 −2.14 4.59
25 +3.86 14.88
20 −1.14 1.31
23 +1.86 3.45
21 −0.14 0.02

Step 4: Sum the squared deviations

Σ(x − x̄)² = 9.88 + 0.73 + 4.59 + 14.88 + 1.31 + 3.45 + 0.02 = 34.86

Step 5: Divide by (n − 1) for sample variance

Variance = 34.86 / (7 − 1) = 34.86 / 6 = 5.81

Step 6: Take the square root

s = √5.81 = 2.41 °C

Interpretation: Daily high temperatures varied by about 2.4 °C from the weekly average of 21.1 °C. That's a fairly consistent week.

Try entering these numbers into the standard deviation calculator to verify and see the full breakdown.

A Second Example: Comparing Two Datasets

Two pizza delivery drivers log their delivery times (in minutes):

Driver A: 25, 27, 26, 24, 28, 26, 25 Driver B: 15, 35, 20, 40, 22, 30, 18

Both drivers have a mean delivery time of approximately 25.9 minutes. But their consistency is vastly different.

  • Driver A: s ≈ 1.35 minutes — very consistent
  • Driver B: s ≈ 9.30 minutes — highly unpredictable

If you care about reliability, Driver A is the clear choice even though the averages are nearly identical. Standard deviation reveals what the mean hides.

Variance vs Standard Deviation

Variance is the square of standard deviation.

Variance = σ² (or s²)

Both measure spread, but standard deviation is in the same units as the original data, which makes it easier to interpret. If your data is in centimeters, the standard deviation is also in centimeters. Variance would be in "square centimeters," which is harder to contextualize.

Use variance when:

  • Doing further statistical calculations (it has nicer mathematical properties)
  • Comparing variability in formal statistical tests

Use standard deviation when:

  • Communicating results to people
  • Interpreting spread in the original data's units
  • Applying the empirical rule

The Empirical Rule (68-95-99.7)

For data that follows a roughly bell-shaped (normal) distribution:

  • ~68% of values fall within 1 standard deviation of the mean
  • ~95% of values fall within 2 standard deviations of the mean
  • ~99.7% of values fall within 3 standard deviations of the mean

Practical Example

A factory produces bolts with a mean length of 50 mm and a standard deviation of 0.5 mm.

  • 68% of bolts are between 49.5 mm and 50.5 mm
  • 95% are between 49.0 mm and 51.0 mm
  • 99.7% are between 48.5 mm and 51.5 mm

Any bolt outside the 3σ range (below 48.5 mm or above 51.5 mm) is a serious outlier — likely defective.

Important caveat: The empirical rule only applies to approximately normal distributions. For heavily skewed data, these percentages can be very different.

Coefficient of Variation (CV)

Standard deviation depends on the scale of the data. A standard deviation of 5 means something very different for data centered around 10 versus data centered around 10,000.

The coefficient of variation solves this:

CV = (s / x̄) × 100%

This expresses variability as a percentage of the mean, making it possible to compare datasets with different units or scales.

Dataset Mean Std Dev CV
Human height (cm) 170 10 5.9%
Annual salary (USD) 65,000 15,000 23.1%
Reaction time (ms) 250 40 16.0%

Even though salaries have a much larger standard deviation in absolute terms, the CV reveals that salaries vary more proportionally than heights but less than reaction times.

CV Benchmarks (General Guidance)

  • CV < 15%: Low variability — data is relatively consistent
  • CV 15–30%: Moderate variability
  • CV > 30%: High variability — considerable spread in the data

Standard Error vs Standard Deviation

These are frequently confused but measure different things.

  • Standard deviation describes the spread of individual data points around the mean.
  • Standard error (SE) describes how much the sample mean itself would vary if you repeated the sampling.

SE = s / √n

As sample size increases, the standard error decreases (you become more confident about the mean), but the standard deviation stays roughly the same (individual data points don't become less variable).

Common Mistakes

1. Using population formula for sample data

Dividing by n instead of (n − 1) when you have a sample underestimates the true variability. With small samples (n < 30), the difference is meaningful.

2. Ignoring the distribution shape

The empirical rule (68-95-99.7) assumes approximately normal data. Applying it blindly to skewed data like income distributions or response times produces incorrect conclusions.

3. Comparing standard deviations across different scales

A standard deviation of 5 cm and 5 kg are not the same "amount" of variability. Use the coefficient of variation when comparing datasets with different units.

4. Treating standard deviation as the range

Standard deviation is not the maximum distance from the mean. In normally distributed data, individual values can fall 3 or more standard deviations away. The range (max − min) is always larger than the standard deviation.

5. Computing standard deviation of non-numeric or categorical data

Standard deviation only applies to quantitative (numerical) data. You cannot calculate a meaningful standard deviation for categories like "red, blue, green."

Real-World Applications

Quality control

Manufacturing processes use standard deviation to set tolerance limits. If a process has tight standard deviation, the product is consistent. If it's too wide, something needs adjustment.

Finance and investing

Standard deviation of returns measures investment volatility. A stock with a 20% annual standard deviation is twice as volatile as one with 10%. Investors use this to assess risk.

Education

Test scores are compared using standard deviation. A student scoring 1.5 standard deviations above the mean is at approximately the 93rd percentile, regardless of whether the test was scored out of 50 or 500.

Science and research

Reporting results as "mean ± standard deviation" is standard practice. It tells readers both the central value and how much variation existed in the observations.

Sports analytics

Consistency matters. A basketball player averaging 20 points per game with a standard deviation of 2 is far more reliable than one averaging 20 with a standard deviation of 10.

Frequently Asked Questions

What is a "good" standard deviation?

There is no universally good or bad value. A "good" standard deviation depends entirely on context. In manufacturing, you want it as small as possible. In a diverse survey, a moderate standard deviation may be expected and healthy.

Can standard deviation be zero?

Yes — when all values in the dataset are identical. If every measurement is 42, the mean is 42, every deviation is 0, and the standard deviation is 0.

Can standard deviation be negative?

No. Because the formula squares every deviation and then takes a square root, the result is always zero or positive.

What is the difference between σ and s?

σ (sigma) is the population standard deviation, calculated by dividing by n. s is the sample standard deviation, calculated by dividing by (n − 1). In practice, most data is a sample, so s is more commonly used.

Why divide by (n − 1) instead of n for samples?

This is called Bessel's correction. A sample mean is itself estimated from the data, which "uses up" one degree of freedom. Dividing by (n − 1) produces an unbiased estimate of the population variance.

How does sample size affect standard deviation?

Adding more data points does not systematically increase or decrease the standard deviation. The standard deviation converges toward the true population value as the sample grows, but it does not shrink to zero.

Is standard deviation the same as variance?

No. Variance is the square of standard deviation. Standard deviation = √(variance). They measure the same concept (spread) but in different units.

How do outliers affect standard deviation?

Heavily. Because deviations are squared, a single extreme value can dramatically inflate the standard deviation. Consider reporting both the standard deviation and the interquartile range (IQR) if outliers are present.

When should I use standard deviation vs IQR?

Use standard deviation when data is roughly symmetric and has no extreme outliers. Use the interquartile range (IQR) when data is skewed or outlier-heavy — IQR is resistant to extreme values.

Can I calculate standard deviation in a spreadsheet?

Yes. In Excel or Google Sheets, use =STDEV.S() for sample standard deviation and =STDEV.P() for population standard deviation.

Related Tools

Related Tools