ThisCalculator

Statistics

Standard Deviation: Formula and How to Calculate It

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Standard Deviation: Formula and How to Calculate It

Standard deviation measures how spread out a set of numbers is around its mean. Enter the values in a list to calculate either the sample standard deviation or the population standard deviation, along with the mean and number of values.

Formula

For population values, standard deviation is the square root of the average squared distance from the population mean. For a sample, it is the square root of the sum of squared distances divided by one less than the sample size:

  • Population: σ = √[Σ(xᵢ − μ)² / N]
  • Sample: s = √[Σ(xᵢ − x̄)² / (n − 1)]

Here, xᵢ is each data value, μ is the population mean, x̄ is the sample mean, N is the number of values in the full population, and n is the number of values in a sample. Σ means to add the terms for every value. The calculator’s first result uses the sample formula by default; choose Population when your values are the entire group you want to describe. Standard deviation has the same unit as the data, or no unit when the data are plain numbers.

Worked Example

The default list is 2, 4, 4, 4, 5, 5, 7, 9. It contains eight values, and the selected type is Sample.

  1. Find the mean: (2 + 4 + 4 + 4 + 5 + 5 + 7 + 9) / 8 = 40 / 8 = 5.
  2. Subtract the mean from each value and square the differences: 9, 1, 1, 1, 0, 0, 4, 16.
  3. Add the squared differences: 9 + 1 + 1 + 1 + 0 + 0 + 4 + 16 = 32.
  4. For a sample, divide by n − 1: 32 / 7 ≈ 4.5714.
  5. Take the square root: √4.5714 ≈ 2.14.

The calculator therefore returns a sample standard deviation of 2.14, a mean of 5.00, and 8 values. If the same eight values are treated as the entire population, divide 32 by 8 instead; the population standard deviation is √4 = 2.00.

Sample Versus Population

The choice of formula depends on what the data represent, not on how many values you happen to have. Use the population formula when the list includes every member of the group of interest. Use the sample formula when the list is a subset used to describe or estimate a larger group.

The sample formula divides by n − 1 rather than n. This adjustment, called Bessel’s correction, compensates for the fact that the sample mean is calculated from the same observations and tends to make their squared distances smaller than they would be around the unknown population mean. The sample standard deviation is commonly used as an estimate of population spread. It is not a guarantee that every sample-based estimate will match the population value.

How to Interpret the Result

Standard deviation describes typical distance from the mean, but it is not the maximum distance and does not say that every value lies within one standard deviation. A small standard deviation means values are clustered relatively close to the mean; a larger one means they are more dispersed. Whether a particular result is small or large depends on the scale and context of the data.

Because the calculation squares deviations, values far from the mean have a strong effect. Standard deviation is most straightforward to interpret for data with a roughly symmetric, single-peaked distribution. For strongly skewed data or data with extreme outliers, the mean and standard deviation may not represent a typical value and spread well; the median and interquartile range can be useful complementary summaries.

When to Use It and Common Mistakes

Use standard deviation to summarize variation in measurements or scores that share a meaningful scale, or to compare the spread of groups measured in the same units. It is also a building block in statistical methods, but a standard deviation by itself does not establish a cause, prove a difference, or describe uncertainty in a mean.

  • Mixing the two formulas: Dividing by n gives population variance; dividing by n − 1 gives sample variance. Choose based on whether the values are a full population or a sample.
  • Confusing variance and standard deviation: Variance is the squared spread (4.57 in the sample example); standard deviation is its square root (2.14).
  • Rounding too early: Keep full precision while finding the mean and squared deviations, then round the final result. Early rounding can slightly change the answer.
  • Combining unlike units: Do not calculate one standard deviation from values recorded in inconsistent units. Convert them to one common unit first. The result will use that same unit.
  • Using too few observations: A sample standard deviation requires at least two values. With one value, the sample formula divides by zero and cannot produce a result.

Frequently Asked Questions

How do I calculate standard deviation by hand?
Find the mean, subtract it from each value, square each difference, add the squares, divide by N for a population or n − 1 for a sample, and take the square root.

Why is sample standard deviation divided by n − 1?
The sample mean is estimated from the sample itself. Dividing by n − 1 corrects the tendency of the sample’s squared deviations to underestimate population variance.

Can standard deviation be negative?
No. Squared deviations are nonnegative, so their average and square root are nonnegative. A standard deviation of zero means every value is identical.

What is the difference between standard deviation and standard error?
Standard deviation describes variation among individual data values. Standard error describes the estimated variability of a statistic, such as a sample mean, across repeated samples; for a mean under common assumptions, it is often calculated as s / √n.

Does standard deviation change if I convert units?
Yes, it changes by the same scale factor as the data. For example, converting measurements from meters to centimeters multiplies both the mean and standard deviation by 100.

Related

Formula used
list data | Data values | 2, 4, 4, 4, 5, 5, 7, 9
sel type | Data type | Sample=1, Population=2
out sd | Standard deviation | - | sqrt(sum((data-mean(data))^2)/(count(data)-1)) | 2
out avg | Mean | - | mean(data) | 2
out n | Number of values | - | count(data) | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.