Statistics & Probability Averages, Variance & Dispersion Descriptive statistics (Bessel-corrected sample standard deviation)

Standard Deviation Calculator

This calculator returns both standard deviations from the same data: the sample value s, which divides the sum of squared deviations by n - 1, and the population value sigma, which divides by n. It shows the mean, the deviation of every observation, each squared deviation and the total, so you can check a homework answer line by line rather than trusting a single number. Choose the sample basis unless your list really is the entire group you want to describe.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Data valuesSeparate numbers with commas, spaces or line breaks. Paste a spreadsheet column directly if you like.2, 4, 4, 4, 5, 5, 7, 9
BasisChoose sample when your data are a subset drawn from a larger group, population when they are the whole group.Sample (n - 1)

It returns

  • Standard deviation (chosen basis) — The square root of the average squared distance from the mean.
  • Sample standard deviation s
  • Population standard deviation sigma
  • Mean
  • Sum of squared deviations
  • Coefficient of variation
  • Count n

The formula

s=i=1n(xix¯)2n1
CV=100|s||x¯|

In plain text: s = sqrt( sum (x - x-bar)^2 / (n - 1) ); sigma = sqrt( sum (x - mu)^2 / N )

  • sSample standard deviation (same as the data)
  • sigmaPopulation standard deviation (same as the data)
  • x-barSample mean (same as the data)
  • nNumber of observations in the sample (count)
  • NNumber of members of the population (count)

The n - 1 divisor is Bessel's correction. It makes the sample variance an unbiased estimator of the population variance; the sample standard deviation remains slightly biased because the square root is a non-linear function.

Updated Category Averages, Variance & Dispersion Verified against published test cases Reading time 10 min

What a standard deviation measures

The standard deviation is the typical distance between an observation and the mean, expressed in the same units as the data. If a set of parts has a mean diameter of 25.0 mm and a standard deviation of 0.2 mm, then a part 0.2 mm from nominal is unremarkable and one 1.0 mm off is five typical distances away.

The construction is deliberate. Take each observation's deviation from the mean, square it, average the squares, then take the square root to return to the original units. The squaring step does two things: it removes the signs, so that deviations above and below the mean do not cancel to zero (they always would, exactly), and it gives large deviations disproportionate weight. That second effect is why the standard deviation is sensitive to outliers in a way the interquartile range is not.

A standard deviation is meaningless on its own. It has to be read against the mean, which is what the coefficient of variation on this page does: it expresses the standard deviation as a percentage of the mean, so that spread can be compared across quantities measured in different units. A standard deviation of 0.2 mm is tight on a 25 mm shaft and enormous on a 0.5 mm wire.

Why the sample formula divides by n - 1

Both formulas start identically. Compute the mean, subtract it from every observation, square each difference, and add them up. That total is the sum of squared deviations, written SS, and it is where all the work is. The two formulas differ only in what they divide SS by.

The population formula divides by N, the size of the whole group. Use it when your list genuinely is everything: all 32 machines on the floor, all 12 months of last year, every student who sat the exam.

The sample formula divides by n - 1. The reason is that you did not subtract the true population mean, because you do not know it - you subtracted the sample mean, which is calculated from the very same data. The sample mean is, by construction, the value that makes SS as small as it can possibly be for this data set. Any other centre gives a larger total. So SS is systematically too small as an estimate of the population's spread, and dividing by n - 1 instead of n scales it back up by exactly the right amount, on average.

The quantity n - 1 is the degrees of freedom. Once the mean is fixed, only n - 1 of the deviations can be chosen freely; the last is forced, because the deviations must add to zero. That is the same count, arrived at from the other direction, and it is why the deviation table on this page always has a zero in its third column total.

The correction matters most when n is small. With n = 2, dividing by 1 instead of 2 doubles the variance; with n = 100, the two divisors differ by 1%. If you want the variance rather than its square root, the variance calculator shows the same quantities without the final square root.

Worked example: 2, 4, 4, 4, 5, 5, 7, 9

These eight numbers are the standard teaching example, chosen because everything comes out whole.

  1. Find the mean. 2 + 4 + 4 + 4 + 5 + 5 + 7 + 9 = 40, and 40 / 8 = 5.
  2. Subtract the mean from each value. The deviations are -3, -1, -1, -1, 0, 0, 2, 4. Add them: -3 - 1 - 1 - 1 + 0 + 0 + 2 + 4 = 0, as they must.
  3. Square each deviation. 9, 1, 1, 1, 0, 0, 4, 16.
  4. Add the squares. 9 + 1 + 1 + 1 + 0 + 0 + 4 + 16 = 32. That is SS.
  5. Divide. On the population basis, 32 / 8 = 4. On the sample basis, 32 / 7 = 4.571429.
  6. Take the square root. sigma = sqrt(4) = 2.000000. s = sqrt(4.571429) = 2.138090.

The two answers differ by 6.9% here because n is only 8. The coefficient of variation on the population basis is 100 x 2 / 5 = 40%, which is a wide spread: a typical observation sits four tenths of the mean away from it.

Notice the effect of the 9. Its squared deviation of 16 is half of the entire SS of 32, so this one observation out of eight determines half the answer. Change that 9 to a 5 and the whole calculation shifts: the sum becomes 36, the mean 4.5, the squared deviations 6.25, 0.25, 0.25, 0.25, 0.25, 0.25, 6.25, 0.25, and SS falls from 32 to 14. The population standard deviation drops from 2.000000 to sqrt(14/8) = 1.322876. That leverage is the property to keep in mind whenever a data set contains a value you are not sure about.

How to read the number you get

Start with the units. The standard deviation carries the units of the data, so a value of 2 means two units, not two of anything else. If the mean is 5 and the standard deviation is 2, an observation of 11 is three standard deviations above the mean, which is the calculation a z-score formalises.

For data that follow a normal distribution, the standard deviation converts directly into probabilities: about 68% of observations fall within one standard deviation of the mean, about 95% within two, and about 99.7% within three. Those are properties of the normal curve, not of the standard deviation, and they do not transfer to skewed data. The normal distribution calculator gives the exact figures - the familiar 68-95-99.7 shorthand rounds 68.27%, 95.45% and 99.73%.

For any distribution at all, Chebyshev's inequality guarantees that at least 1 - 1/k2 of the data lie within k standard deviations of the mean: at least 75% within two, at least 88.9% within three. That bound is weak precisely because it assumes nothing, but it is always true, which the 68-95-99.7 rule is not.

What counts as a large standard deviation depends entirely on the field. Manufacturing tolerances are quoted in fractions of a standard deviation and a coefficient of variation above a few per cent is a problem; biological measurements routinely show coefficients of variation of 20% or more without anything being wrong. Compare against your own historical data or a published specification, never against an abstract threshold.

How much the n - 1 correction changes the answer

Ratio of the sample standard deviation to the population standard deviation for the same data, which is sqrt(n / (n - 1)) regardless of the values.
ns / sigmas is larger by
21.41421441.4%
31.22474522.5%
51.11803411.8%
81.0690456.9%
101.0540935.4%
201.0259782.6%
301.0170951.7%
501.0101531.0%
1001.0050380.5%
10001.0005000.05%

Each ratio is sqrt(n/(n-1)) evaluated at that n, so it does not depend on the data at all. Below about n = 20 the choice of basis is visible in the answer; above n = 100 it rarely matters to a reported figure.

Errors that produce a wrong standard deviation

  • Choosing the wrong basis. Most real data are a sample, so n - 1 is the default in Excel's STDEV.S, R's sd() and almost every statistics course. Use N only when the list is genuinely the entire population.
  • Rounding the mean before subtracting. Rounding a mean of 5.333 to 5.3 shifts every deviation and inflates SS. Carry full precision through the deviations and round only the final answer.
  • Forgetting the square root. SS / (n - 1) is the variance, in squared units. The standard deviation is its square root. Reporting a variance as a standard deviation overstates the spread whenever the value exceeds 1 and understates it when it is below.
  • Including a value that is not a measurement. Blank cells read as zero, or a row total pasted along with the data, will both wreck the result. Check the reported count n against the number of observations you meant to enter.
  • Quoting a coefficient of variation on data that can be negative or that has a mean near zero. The CV divides by the mean, so it explodes as the mean approaches zero and its sign becomes meaningless when observations straddle zero. It is defined for ratio-scale data with a positive mean.
  • Comparing standard deviations across different units. A spread of 2 kg and a spread of 2 lb are not the same spread. Convert first, or compare coefficients of variation instead.

Where the standard deviation goes next

Almost every inferential method in statistics is built on this quantity. The standard error of a mean is s divided by the square root of n, and it is what turns a sample mean into a confidence interval or a t-statistic. Regression reports a residual standard error, which is the standard deviation of the vertical distances from the fitted line. Control charts in manufacturing set their limits at three standard deviations from the centre line.

Two related summaries answer the same question differently. The variance is this number squared, and it is the form that adds: the variance of a sum of independent quantities is the sum of their variances, which is not true of standard deviations. The interquartile range measures spread by position rather than by distance, so a single extreme value cannot move it, which makes it the right partner for a median.

To place one observation within a distribution, standardise it with the z-score calculator, or read it against the raw data using the percentile calculator. To turn a mean and a standard deviation into probabilities, use the normal distribution calculator - but check first that your data are roughly symmetric, because the normal model is an assumption you are making, not a fact the standard deviation supplies.

Frequently asked questions

Should I use n or n - 1?

Use n - 1 unless your data are the entire population. Almost all real data sets are samples: 40 measured parts out of a production run, 200 survey respondents out of a city. Excel's STDEV.S, Google Sheets' STDEV, R's sd() and NumPy's std(ddof=1) all use n - 1; NumPy's default std() uses n, which catches people out.

Why do the deviations always add to zero?

Because the mean is defined as the value that balances them. Summing (x - x-bar) over all observations gives the sum of x minus n times the mean, and n times the mean is the sum of x by definition, so the total is exactly zero. That is why the deviations must be squared before averaging, and it is a free check on the deviation table.

What is a good standard deviation?

There is no universal answer, because the number carries the units of the data. Judge it as a fraction of the mean using the coefficient of variation, or against a specification limit, or against your own past results. In machining a CV below 1% is routine; in field biology 20% to 30% is normal and says nothing is wrong.

Can the standard deviation be negative?

No. It is a square root of a sum of squares divided by a positive count, so it is zero or positive. It equals zero only when every observation is identical. A negative result always means an arithmetic slip, most often a squared deviation entered with its sign.

How does an outlier affect it?

Strongly, because deviations are squared. A value three times as far from the mean as another contributes nine times as much to the sum of squares. In the worked example on this page the single value of 9 accounts for 16 of the total SS of 32, so one observation out of eight drives half the result. If your data may contain errors or genuine extremes, report the interquartile range as well.

What is the difference between standard deviation and standard error?

The standard deviation describes the spread of individual observations. The standard error describes the spread of a sample mean across repeated samples, and equals s divided by the square root of n. Because it shrinks as n grows, a large sample can have a tiny standard error even when the underlying data are very spread out. Confidence intervals use the standard error, not the standard deviation.

Does the calculator handle negative numbers and decimals?

Yes. Negative values, decimals and scientific notation such as 1.2e-3 all parse. Separators can be commas, spaces, tabs or line breaks, so a column pasted from a spreadsheet works directly. Text that is not a number is skipped, so confirm the reported count n matches what you intended to enter.

Why can I not get a sample standard deviation from one value?

Because the denominator n - 1 is zero, and there is nothing to divide. One observation carries no information about spread: any value of sigma is equally consistent with it. The population formula returns zero for a single value, which is arithmetically correct and practically useless.

References