To calculate standard deviation by hand, find the mean, subtract it from each value, square those differences, add them up, divide by n − 1 (for a sample) or n (for a population), and take the square root. For five commute times of 22, 25, 19, 30 and 24 minutes, the mean is 24, the squared deviations add to 66, and the sample standard deviation is √(66 ÷ 4) = 4.06 minutes.
Standard deviation measures how far values typically sit from the mean. A small value means the data clusters tightly; a large one means it is spread out. Working through it by hand once makes it much easier to understand what software is reporting.
The formulas
Sample standard deviation, used when your data is a sample from a larger group:
Population standard deviation, used when your data is the entire group:
Here x̄ (or μ) is the mean, n (or N) is the number of values, and Σ means “add up over every value.” The quantity inside the square root is the variance.
Step-by-step example
Data: one commuter’s travel times over five days, in minutes: 22, 25, 19, 30, 24.
Step 1: Find the mean
x̄ = (22 + 25 + 19 + 30 + 24) ÷ 5 = 120 ÷ 5 = 24
Steps 2 and 3: Find each deviation and square it
| Value x | Deviation x − x̄ | Squared (x − x̄)² |
|---|---|---|
| 22 | −2 | 4 |
| 25 | 1 | 1 |
| 19 | −5 | 25 |
| 30 | 6 | 36 |
| 24 | 0 | 0 |
| Sum | 0 | 66 |
The deviations always add to zero, which is a handy check on your mean. Squaring removes the signs so that values above and below the mean do not cancel out.
Step 4: Divide to get the variance
These five days are a sample of the commuter’s typical trips, so divide by n − 1 = 4:
s² = 66 ÷ 4 = 16.5 square minutes
Step 5: Take the square root
s = √16.5 ≈ 4.06 minutes
If these five trips were the only ones you cared about, the population version would be σ² = 66 ÷ 5 = 13.2 and σ = √13.2 ≈ 3.63 minutes. The standard deviation calculator shows both, along with this same deviation table.
Sample vs population: which to use
| Use | Formula divides by | Spreadsheet function | TI-84 output |
|---|---|---|---|
| Sample (a subset describing a larger group) | n − 1 | STDEV.S | Sx |
| Population (every member of the group) | N | STDEV.P | σx |
Most real data is a sample. A survey of 500 voters, 20 parts pulled from a production run, or a month of commute times all describe something bigger than the data itself. Dividing by n − 1, called Bessel’s correction, compensates for the fact that a sample sits slightly closer to its own mean than to the true mean. The difference between the two formulas shrinks as n grows: with 5 values it is about 12%, with 100 values about 0.5%.
The shortcut (computational) formula
Calculating every deviation is tedious when the mean is an awkward decimal. This equivalent form uses only the sum and the sum of squares:
Σx² = 22² + 25² + 19² + 30² + 24² = 484 + 625 + 361 + 900 + 576 = 2,946
(Σx)² ÷ n = 120² ÷ 5 = 2,880
Σ(x − x̄)² = 2,946 − 2,880 = 66 ✓
From there, divide and take the square root as before. This version is faster on paper, but with very large numbers it can lose precision on calculators, which is why software uses more careful algorithms.
Grouped data (frequency tables)
When values repeat, multiply each squared term by its frequency f. Here a survey counted the children in 20 households:
| Children x | Households f | f × x | f × x² |
|---|---|---|---|
| 0 | 4 | 0 | 0 |
| 1 | 7 | 7 | 7 |
| 2 | 6 | 12 | 24 |
| 3 | 2 | 6 | 18 |
| 4 | 1 | 4 | 16 |
| Total | 20 | 29 | 65 |
Mean = 29 ÷ 20 = 1.45 children
Σ(x − x̄)² = 65 − 29² ÷ 20 = 65 − 42.05 = 22.95
s = √(22.95 ÷ 19) = √1.208 ≈ 1.10 children
Note that n is the total frequency, 20, not the number of rows.
How to interpret the result
Same units as the data. The commute standard deviation is 4.06 minutes, so a typical day lands within about 4 minutes of the 24-minute average. The variance, 16.5 “square minutes,” is harder to interpret, which is why standard deviation is usually reported.
The empirical rule. For roughly bell-shaped data, about 68% of values fall within 1 standard deviation of the mean, about 95% within 2, and about 99.7% within 3. If the commutes were normally distributed, about two-thirds would fall between 19.9 and 28.1 minutes.
Relative spread. To compare variability between data sets with different scales, divide the standard deviation by the mean. The commute’s coefficient of variation is 4.06 ÷ 24 ≈ 17%. The coefficient of variation calculator does this for you.
How unusual is one value? Divide a value’s deviation by the standard deviation to get its z-score. A 30-minute commute is (30 − 24) ÷ 4.06 ≈ 1.5 standard deviations above average. See how to calculate a z-score.
Common mistakes
- Forgetting the square root, which reports the variance instead of the standard deviation.
- Dividing by the wrong count, n when the data is a sample or n − 1 when it is a population.
- Rounding the mean too early. If the mean is 23.666…, keep several decimals through the squaring step.
- Using n as the number of rows in a frequency table instead of the total count.
For a complete summary with the mean, median, quartiles and standard deviation together, use the descriptive statistics calculator. If you only need the variance, the variance calculator shows the same table. Standard deviation is most meaningful alongside a measure of center, compared in mean vs median vs mode.
Frequently asked questions
What are the steps to calculate standard deviation?
Find the mean, subtract the mean from each value, square each difference, add the squares, divide by n − 1 for a sample (or n for a population), and take the square root. The number before the square root is the variance.
Why do you divide by n − 1 for a sample?
A sample's values are closer to their own mean than to the true population mean, so the sum of squared deviations comes out slightly too small. Dividing by n − 1 instead of n, known as Bessel's correction, makes the sample variance an unbiased estimate of the population variance.
Should I use sample or population standard deviation?
Use the population formula only when your data includes every member of the group you care about, such as all 30 students in one class. Use the sample formula when the data is a subset used to describe a larger group, which is the usual case in research and quality control.
What is a good standard deviation?
There is no universal good value; it depends on the scale and purpose. Compare it to the mean with the coefficient of variation (SD ÷ mean), or judge it against a tolerance. A 4-minute standard deviation is small for a 60-minute commute but large for a 5-minute one.
Can standard deviation be negative?
No. It is the square root of an average of squared numbers, so it is always zero or positive. It is zero only when every value in the data set is identical.