Article — Standard Deviation Calculator
Standard deviation: a practical guide to measuring spread
- What the standard deviation calculator does
- Sample vs population standard deviation
- How to compute standard deviation by hand
- Bessel's correction and the n minus one divisor
- The empirical rule for spread
- Standard deviation in finance
- Standard deviation in quality control
- Common mistakes when measuring spread
A standard deviation calculator returns two related numbers from a list of values: the sample standard deviation (s, computed with the n minus one divisor) and the population standard deviation (sigma, computed with the n divisor). Sample is the right choice for almost every real data set. The calculator above uses the two-pass formula the NIST/SEMATECH e-Handbook of Statistical Methods recommends, the same approach used by R's sd function and SciPy's scipy.stats.tstd.
Standard deviation measures the typical distance between each value and the mean. Small means the data clusters tightly; large means it spreads. The units match the data, which is why SD is reported more often than variance.
What the standard deviation calculator does
Paste numbers into the textarea. Commas, spaces, semicolons and new lines all work as separators, so a copy out of a spreadsheet column or a comma-separated CSV row both parse cleanly. Negative numbers and decimals are fine; anything that does not parse is dropped silently. The headline shows sample SD first, population SD beneath. The grid below adds count, mean, sample variance, population variance, sum, range, min and max.
The calculation uses the two-pass formula: compute the mean, then sum the squared deviations, then divide. The one-pass form that uses only sum-of-values and sum-of-squared-values is faster but loses precision when values are large and close together. The two-pass form is what statistical software defaults to.
mean = sum(x) / nSS = sum((x - mean)^2)s = sqrt(SS / (n-1)) sigma = sqrt(SS / n)Sample vs population standard deviation
The two flavours differ by one in the denominator. Sample uses n minus one; population uses n. For 30 values the difference is about 1.7%; for 100 values, 0.5%; for 1,000 values, 0.05%. The distinction matters most for small samples, which is exactly when people most need it.
Use sample whenever the numbers are drawn from a larger group you cannot fully observe. A survey of 1,000 voters, 30 quality-control samples from a production run, daily returns of one stock over the last year — all should use s. Use the population form only when the data literally is the entire group: every student in one class of 28, every employee at a 50-person company.
The annualised standard deviation of daily S&P 500 returns over the long run is approximately 16 percent. That is the headline volatility number used in option pricing, Sharpe ratios and value-at-risk models. Individual years swing widely: 2017 ran below 7 percent, while 2008 cleared 40 percent.
How to compute standard deviation by hand
For the values 2, 4, 4, 4, 5, 5, 7, 9 the mean is 40 divided by 8, which equals 5. The deviations from the mean are negative 3, negative 1, negative 1, negative 1, zero, zero, 2, 4. Squaring each gives 9, 1, 1, 1, 0, 0, 4, 16, which sum to 32.
For the population SD, divide 32 by 8 and take the square root: sigma equals 2 exactly. For the sample SD, divide 32 by 7 and take the square root: s equals approximately 2.138. These are the canonical "8 values, sigma = 2" example from introductory texts.
Round the mean to two decimal places early and the squared-deviation sum drifts, sometimes by enough to change the SD at two decimal places. Always carry full precision through the calculation and round only the final SD. Statistical software does this automatically; spreadsheet calculations sometimes do not, especially when the mean is pasted as a value rather than referenced as a formula.
Bessel's correction and the n minus one divisor
Why n minus one instead of n for samples? Because the sample mean used in the deviation sum is itself an estimate. Using the same data to estimate the mean and then measure spread around that mean understates the spread, on average, by a factor of n minus one over n. Dividing by n minus one cancels that bias. The correction is named after Friedrich Bessel.
One way to see it: with two observations you have one degree of freedom in the spread. With n observations you have n minus one degrees of freedom for variance. The divisor counts degrees of freedom, not raw observations.
- n = 2: sample SD overstates by factor of √2 over √1 = 1.414 vs the n-divisor form
- n = 10: sample over population ≈ 1.054 (5.4% larger)
- n = 30: ratio ≈ 1.017 (1.7% larger)
- n = 100: ratio ≈ 1.005 (0.5% larger)
- n = 1,000: ratio ≈ 1.0005 (0.05% larger)
- n = 1: sample SD is undefined; population SD is zero
The empirical rule for spread
For normally distributed data, NIST/SEMATECH calls this the empirical rule: roughly 68 percent within plus or minus one SD, 95 percent within plus or minus two SD, 99.7 percent within plus or minus three SD. Six-sigma manufacturing programmes target 99.99966 percent in-spec parts.
The empirical rule fails for skewed distributions or heavy tails. A quick histogram check tells you whether to trust it. US household income is heavily right-skewed: the empirical rule would predict negative incomes within one SD below the mean, which is not what happens. Always look at the shape of the data, not just the summary.
Standard deviation in finance
Volatility in finance is the annualised standard deviation of asset returns. A daily SD of one percent on US equity returns scales to about 16 percent annual (multiply by √252 trading days). Bonds run 5 to 8 percent. Single stocks run 25 to 60 percent. Standard deviation enters the Sharpe ratio, the Black-Scholes option formula and value-at-risk: a one-day 99 percent VaR is roughly 2.33 times the daily SD under a normal assumption.
The Sharpe ratio divides excess return by SD. Long-run S&P 500 Sharpe ratios run around 0.4 to 0.5. A fund advertising a Sharpe of 2 or above is either exceptional or running with too short a track record. Be sceptical of Sharpe ratios from fewer than three years of monthly data.
Standard deviation in quality control
Manufacturing tolerances are expressed in sigma. A line targeting 100 mm parts with a tolerance of plus or minus one millimetre wants the process SD small enough that three sigma (99.7 percent of parts) falls inside the tolerance. The six-sigma methodology Motorola popularised in the 1980s targets a process where plus or minus six SD fits within the band, corresponding to 3.4 defects per million parts after allowing for drift.
Common mistakes when measuring spread
The most common error is using sigma (population) when s (sample) is correct. Excel's STDEV.P is population; STDEV.S is sample. NumPy's default np.std is population, while R's sd() and Python's statistics.stdev() default to sample. Compare carefully across tools.
The second common error is comparing SD across data sets on different scales. Weights in kg are not directly comparable to heights in cm; use the coefficient of variation (SD divided by mean) for unit-free comparison. The third is trusting the empirical rule on non-normal data — income and trade-size data are heavy-tailed and skewed, and the 68-95-99.7 percentages will mislead.