# What is the standard deviation?

Computes the sample or population standard deviation of a list of numbers, with the variance, mean, standard error of the mean, and coefficient of variation.

- Page: https://www.acalculator.org/statistics/standard-deviation-calculator
- JSON spec: https://www.acalculator.org/statistics/standard-deviation-calculator.json
- Version: 5ae197ec2205

## Default answer

Example with the default inputs (Your numbers [2, 4, 4, 4, 5, 5, 7, 9], Your numbers are a Sample): Sample standard deviation of 2, 4, 4, 4, 5, 5, 7, 9: 2.13809, with a mean of 5.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| data | Your numbers | The numbers, separated by commas, spaces, semicolons, or new lines. |
| type | Your numbers are a | A sample from a larger group (divide by n − 1) or the whole population (divide by n). Pick sample when unsure. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| sd | Standard deviation | The square root of the variance: how far the numbers typically are from their mean. |
| variance | Variance | The sum of squared differences from the mean, divided by n − 1 (sample) or n (population). |
| mean | Mean | The sum divided by the count. |
| count | Count (n) | How many numbers are in the list. |
| sum | Sum | All the numbers added up. |
| sumOfSquares | Sum of squares | The squared differences from the mean, added up: Σ(x − mean)². |
| sem | Standard error of the mean | The sample standard deviation divided by √n. Shown for a sample only. |
| cv | Coefficient of variation | The standard deviation as a percent of the mean. Shown only when the mean is above 0. |

## Method

Sample: s = √(Σ(x − mean)² ÷ (n − 1)); population: σ = √(Σ(x − mean)² ÷ n); standard error = s ÷ √n; coefficient of variation = SD ÷ mean × 100%.

## Assumptions

- A sample divides the sum of squares by n − 1 (Bessel’s correction) and needs at least 2 numbers. A population divides by n.
- The mean is found first, then the squared differences from it are added up (the two-pass method).
- The standard error of the mean is shown for a sample only. The coefficient of variation is shown only when the mean is above 0.

## Worked examples

1. data = 2 or 4, type = sample gives sd = 2.13809, variance = 4.571429, mean = 5, sumOfSquares = 32, sem = 0.755929, cv = 42.761799%. Source: hand calculation in content.mdx: SS = 32, 32 ÷ 7 = 4.5714, √4.5714 = 2.1381; Python statistics.stdev.
2. data = 2 or 4, type = population gives sd = 2, variance = 4, mean = 5, cv = 40%. Source: hand calculation in content.mdx: 32 ÷ 8 = 4, √4 = 2; Python statistics.pstdev.
3. data = 10,000,001 or 10,000,003, type = sample gives sd = 1, variance = 1, mean = 10,000,002, sem = 0.57735. Source: NIST StRD univariate dataset NumAcc1: certified sample standard deviation 1 (exact); SEM = 1 ÷ √3.
4. data = 2.0018 or 2.0017, type = sample gives sd = 0.000429, mean = 2.001856. Source: NIST StRD univariate dataset Mavro: certified sample standard deviation 0.000429123454003053 (15 digits; the data are stored as binary doubles, so the tolerance is 1e-12; Python statistics.stdev agrees to 7.5e-14).
5. data = 7 or undefined, type = population gives sd = 0, variance = 0, mean = 7. Source: hand calculation in content.mdx: the only difference from the mean is 0.

## FAQ

### How do I calculate the standard deviation by hand?

Find the mean. Subtract the mean from each number and square the result. Add the squares to get the sum of squares. Divide it by n − 1 for a sample, or by n for a whole population, to get the variance. The standard deviation is the square root of the variance.

### Should I use the sample or the population standard deviation?

Use the sample standard deviation (divide by n − 1) when your numbers are a sample from a larger group, such as 30 people from a city. Use the population standard deviation (divide by n) only when your numbers are the whole group you care about, such as every student in one class. When unsure, use the sample.

### Why does the sample standard deviation divide by n − 1?

The squared differences are measured from the sample mean, which sits closer to the sample than the true mean does. Dividing by n would make the variance too small on average. Dividing by n − 1 (Bessel’s correction) fixes this for the variance.

### What does a large or small standard deviation mean?

A small standard deviation means the numbers sit close to their mean. A large one means they are spread out. It is in the same units as your data, so a standard deviation of 2 kg on weights of about 70 kg is a small spread.

### What is the standard error of the mean?

It is the sample standard deviation divided by √n. It measures how much the sample mean would vary from sample to sample, so it shrinks as the sample grows. NIST uses it to build confidence limits for the mean: mean ± t × s ÷ √n.

### What is the coefficient of variation?

It is the standard deviation as a percent of the mean. It lets you compare the spread of data on different scales. It only makes sense for data with a true zero, such as weights or times, and not when the mean is near 0, so the calculator shows it only when the mean is above 0.

### Can the standard deviation be negative?

No. It is the square root of an average of squares, so it is 0 or more. It is 0 only when every number is the same.

### What is the difference between variance and standard deviation?

The variance is the average squared difference from the mean, so its units are squared (kg²). The standard deviation is its square root, back in the units of the data (kg), which makes it easier to read.

## Sources

- NIST/SEMATECH e-Handbook of Statistical Methods, section 1.3.5.6, Measures of Scale (variance and standard deviation). https://www.itl.nist.gov/div898/handbook/eda/section3/eda356.htm
- NIST/SEMATECH e-Handbook of Statistical Methods, section 1.3.5.2, Confidence Limits for the Mean (s ÷ √N). https://www.itl.nist.gov/div898/handbook/eda/section3/eda352.htm
- NIST Dataplot Reference Manual, Coefficient of Variation. https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/coefvari.htm
- NIST Statistical Reference Datasets, univariate summary statistics: NumAcc1 and Mavro, certified values. https://www.itl.nist.gov/div898/strd/univ/homepage.html
