HOME / MATHEMATICS & STATISTICS / STATISTICS / STANDARD DEVIATION CALCULATOR
Mathematics & Statistics / Statistics

Standard Deviation Calculator

Enter comma-separated numbers

Statistics

n

8

Mean (μ)

5.000

Median

4.500

Min / Max

2.00 / 9.00

σ (population)

2.0000

s (sample)

2.1381

Distribution

2.0
2.9
3.8
4.6
5.5
6.4
7.3
8.1
μ: 5.00±1σ: [2.86, 7.14]
Shareable URL

About the Standard Deviation Calculator

Standard deviation measures how far a set of values typically sits from its own mean. A small value means the data clusters tightly; a large one means it is spread out. It is expressed in the same units as the original data, which is precisely why it is preferred over variance in practice — a standard deviation of 2.4 cm is interpretable, whereas a variance of 5.76 cm² is not.

Its importance comes from what it enables downstream. Confidence intervals, hypothesis tests, z-scores, control charts, portfolio risk models and process capability indices are all built on it. Getting the standard deviation wrong — most often by choosing the wrong denominator — propagates a bias into every one of those.

The single decision that trips people up is whether to divide by n or by n − 1. The short answer: if your numbers are the entire group you care about, divide by n. If they are a sample drawn from a larger group you want to make claims about, divide by n − 1. Statistical software almost always defaults to n − 1, and spreadsheet functions are split, which is how mismatched results usually arise.

Formula

σ = √[ Σ(xᵢ − μ)² / N ] (population) | s = √[ Σ(xᵢ − x̄)² / (n − 1) ] (sample)

xᵢ
Each individual data value
μ / x̄
The mean — μ for a population, x̄ for a sample
N / n
Count of values — N for the full population, n for a sample
σ / s
Population standard deviation and sample standard deviation respectively

The procedure is the same in both cases. Find the mean, subtract it from every value to get deviations, square each deviation so positives and negatives stop cancelling, sum the squares, divide by the appropriate denominator to get variance, then take the square root to return to the original units.

The squaring step is not arbitrary. Deviations from the mean always sum to exactly zero, so any measure based on raw deviations is useless. Squaring solves that while also giving larger deviations disproportionate weight — which is a deliberate feature, since a single value far from the mean tells you more about spread than several values near it.

The n − 1 denominator is called Bessel's correction. A sample mean is, by construction, the point that minimises the sum of squared deviations for that sample — so squared deviations measured from it are systematically too small relative to deviations from the true population mean. Dividing by n − 1 rather than n inflates the result just enough to correct that bias on average.

Worked Examples

Full walkthrough on eight values

The dataset 2, 4, 4, 4, 5, 5, 7, 9 treated as a complete population — for instance, the scores of every member of an eight-person team.

Sum and mean(2+4+4+4+5+5+7+9) = 40; μ = 40 ÷ 8 = 5
Deviations (xᵢ − μ)−3, −1, −1, −1, 0, 0, 2, 4
Squared deviations9, 1, 1, 1, 0, 0, 4, 16
Sum of squares32
Population variance32 ÷ 8 = 4
Population standard deviation√4

Result: σ = 2.0 exactly

Values typically sit about 2 units from the mean of 5. Note that the deviations sum to zero (−3 −1 −1 −1 +0 +0 +2 +4 = 0), which is a useful arithmetic check before you square.

The same data treated as a sample

Identical numbers, but now they are eight measurements drawn from a much larger process, and you want to estimate the spread of that process.

Sum of squares32 (unchanged)
Degrees of freedomn − 1 = 8 − 1 = 7
Sample variance32 ÷ 7 ≈ 4.5714
Sample standard deviation√4.5714

Result: s = 2.138 — about 6.9% larger than σ = 2.0

Same data, different question, different answer. The gap shrinks as n grows: at n = 30 the difference is under 2%, at n = 100 under 0.5%. It only really matters for small samples, which is exactly when people are most likely to be working by hand.

Interpreting spread in context

Eight daily high temperatures in °F: 68, 72, 75, 71, 74, 69, 73, 70. Treated as a sample of that month's weather.

Mean572 ÷ 8 = 71.5 °F
Sum of squared deviations42.0
Sample variance42.0 ÷ 7 = 6.0
Sample standard deviation√6.0 ≈ 2.449 °F
Coefficient of variation2.449 ÷ 71.5 ≈ 3.4%

Result: s ≈ 2.45 °F, meaning most days fall within about 69 to 74 °F

A standard deviation of 2.45 is small or large only relative to the mean. The coefficient of variation — standard deviation divided by mean — makes that explicit and lets you compare spread across datasets with different units or scales.

How to Use the Result

The empirical rule, and when it applies

For data that is approximately normally distributed, standard deviation maps directly onto proportions of the data:

  • About 68% of values fall within one standard deviation of the mean.
  • About 95% fall within two standard deviations.
  • About 99.7% fall within three.

Why that rule fails more often than expected

The 68-95-99.7 figures depend on normality. Applied to skewed data — incomes, insurance claims, website session lengths, failure times — they are badly wrong, typically understating how often extreme values occur.

Chebyshev's inequality gives a distribution-free floor instead: at least 75% of any dataset lies within two standard deviations of the mean, and at least 89% within three, regardless of shape. Weaker guarantees, but they always hold.

Before leaning on the empirical rule, plot the data. A histogram or a simple sorted list will reveal skew and outliers faster than any summary statistic, and if the distribution is clearly non-normal, standard deviation may not be the right summary at all.

Choosing between the two formulas

Use the population formula (÷ N) when your data is genuinely the complete set: every student in a class when the class is what you care about, all twelve monthly figures for a specific year, every unit in a finished production batch.

Use the sample formula (÷ n − 1) when the data stands in for something larger: a survey of 500 voters, 30 test measurements from an ongoing process, historical returns used to estimate future volatility. This is the more common situation in practice, which is why it is the software default.

In spreadsheets, the distinction is in the function name and it is easy to get backwards. STDEV.S and STDEV use n − 1; STDEV.P and STDEVP use N. In Python, numpy.std defaults to N while pandas .std() defaults to n − 1, so the same data can produce two answers depending on which library you reached for.

Standard deviation versus standard error

These are routinely confused and they answer different questions. Standard deviation describes the spread of individual observations. Standard error describes the precision of the mean, and equals s / √n.

The practical consequence: standard deviation does not shrink as you collect more data — it converges on the true population spread. Standard error does shrink, proportionally to the square root of n. Quadrupling your sample halves the standard error while leaving the standard deviation essentially unchanged.

Error bars on a chart are ambiguous unless labelled. Bars showing standard deviation communicate variability in the data; bars showing standard error communicate confidence in the average, and are roughly √n times smaller.

Edge Cases and Common Mistakes

A single data point has no sample standard deviation

With n = 1, the sample formula divides by zero and is undefined — correctly so, since one observation carries no information about spread. The population formula returns 0, which is technically right but rarely what you want. Most software returns an error or NaN for the sample case.

Identical values give exactly zero

If every value is the same, all deviations are zero and so is the standard deviation. This is a legitimate result, but in real measurement data it usually signals a problem: a stuck sensor, a copy-paste error, or a rounding step that destroyed the variation you were trying to measure.

Outliers dominate the result

Because deviations are squared, a single distant value can move the standard deviation more than all the others combined. Add the value 100 to the dataset 2, 4, 4, 4, 5, 5, 7, 9 and the sample standard deviation jumps from 2.14 to about 31.7. When outliers are genuine rather than errors, the interquartile range or median absolute deviation are more robust summaries.

The naive computational formula loses precision

The algebraically equivalent shortcut Σx² − (Σx)²/n is faster but catastrophically unstable when the mean is large relative to the spread — it subtracts two nearly equal large numbers, and floating-point error can even produce a negative variance. Welford's online algorithm is the standard fix and is what well-written libraries use.

Frequently Asked Questions

When exactly do I use n − 1 instead of n?

Whenever your data is a sample being used to say something about a wider population. If the data is the entire population and you are only describing it, use n. When in doubt, use n − 1 — it is the safer default, and for samples above about 30 the difference is negligible anyway.

What is the difference between variance and standard deviation?

Variance is the standard deviation squared. Variance is mathematically convenient because variances of independent variables add, which is why it appears inside statistical theory. Standard deviation is what gets reported, because it is in the same units as the data and can be compared directly to the mean.

Can standard deviation be negative?

No. It is the square root of a sum of squares divided by a positive count, so it is always zero or positive. A negative result means an arithmetic mistake, or a floating-point failure in the unstable computational formula.

Is a high standard deviation bad?

It depends entirely on context. In manufacturing it means inconsistent output and is bad. In an investment portfolio it means volatility, which is the price of higher expected return. In a biological population it may simply reflect genuine diversity. The number describes spread; whether spread is desirable is a domain question.

How do I compare spread between datasets with different units?

Use the coefficient of variation — standard deviation divided by the mean, expressed as a percentage. It is unitless, so a 3.4% CV in temperature is directly comparable to a 3.4% CV in revenue. It breaks down when the mean is near zero or when the data can be negative.

Why square the deviations rather than take absolute values?

Mean absolute deviation is a valid measure and is more robust to outliers. Squaring won out because it is differentiable everywhere, makes variances additive for independent variables, and connects cleanly to the normal distribution and least-squares estimation. Nearly all of inferential statistics is built on that foundation.