Standard Deviation Calculator
Calculate population and sample standard deviation with Bessel's correction.
About the Standard Deviation Calculator
The standard deviation calculator measures how spread out a dataset is around its mean. A small standard deviation means the values cluster tightly; a large one means they are spread out. Standard deviation is the most widely used measure of dispersion in statistics, and it is the denominator of the familiar z-score (x - mean) / sd.
The tool computes both the population standard deviation (sigma, dividing by n) and the sample standard deviation (s, dividing by n-1). The n-1 denominator is Bessel's correction, named after Friedrich Bessel who introduced it in 1820 to correct the bias in the naive estimator. The correction is needed because the sample mean is itself derived from the data, so the squared deviations are systematically smaller than they would be if computed against the true population mean.
Per the National Institute of Standards and Technology (NIST/SEMATECH e-Handbook, section 1.3.6), the choice between population and sample depends on whether your data represents the entire population of interest or only a sample drawn from it. If you have measurements for every member of the population, use the population formula. If you have a sample intended to estimate the spread of a larger population, use the sample formula.
The calculator also reports the variance (the square of the standard deviation) and the sum of squared deviations. All computation runs client-side; no data leaves your browser.
How It Works
The standard deviation is computed in four steps:
1. Compute the mean: mean = sum(x_i) / n
2. Compute deviations: d_i = x_i - mean
3. Compute variance:
Population variance: sigma^2 = sum(d_i^2) / n
Sample variance: s^2 = sum(d_i^2) / (n - 1)
4. Take the square root: sd = sqrt(variance)
The two-pass algorithm above is numerically stable for typical datasets. For very large inputs or inputs with a large mean relative to the spread, a single-pass algorithm such as Welford's method (Welford, 1962) is preferred, but for browser-side computation the two-pass form is clearer and accurate enough.
Bessel's correction (the n-1 denominator) is applied only in sample mode. The intuition is that the sum of squared deviations about the sample mean is always smaller than the sum of squared deviations about the population mean, because the sample mean minimises that sum. Dividing by n-1 instead of n inflates the result to compensate, yielding an unbiased estimator of the population variance. The correction is most visible for small samples: with n = 2, dividing by n-1 = 1 doubles the naive variance.
The calculator rejects the input of a single value in sample mode, since division by zero is undefined and there is no meaningful notion of spread with only one observation.
Worked Examples
For the default dataset [4, 8, 15, 16, 23, 42] (the famous Lost numbers, n = 6), the mean is 108 / 6 = 18. The deviations are [-14, -10, -3, -2, 5, 24], the squared deviations are [196, 100, 9, 4, 25, 576] summing to 910. Population variance is 910 / 6 = 151.6667, giving sigma = 12.3149. Sample variance is 910 / 5 = 182, giving s = 13.4907. The sample sd is larger, as expected.
For a tightly clustered dataset [10, 10, 10, 10], the mean is 10 and every deviation is zero, so both variances and both standard deviations are zero. There is no spread. This is the minimum possible value.
For a single value [5] in population mode, the mean is 5, the variance is 0 / 1 = 0, and the standard deviation is 0. In sample mode the calculator reports an error because division by zero is undefined. With two values [3, 7] in sample mode, the variance is ((3-5)^2 + (7-5)^2) / 1 = 8, and s = sqrt(8) = 2.8284.
When to Use This Tool
Use the standard deviation calculator when you need to:
- Quantify the spread of test scores, response times, or measurement errors.
- Compute the denominator of a z-score to standardise a value against a distribution.
- Compare the variability of two datasets with similar means.
- Compute the volatility of an asset's returns over a historical period.
- Estimate process capability in a manufacturing or quality-control context.
- Detect outliers using the three-sigma rule (values more than three sd from the mean).
- Teach the difference between population and sample statistics in a statistics class.
Limitations & Disclaimer
This calculator reports standard deviation, variance, mean, and sum of squared deviations. It does not compute the interquartile range, median absolute deviation, skewness, or kurtosis. Outliers are not removed or winsorised. The two-pass algorithm is numerically stable for typical inputs but may lose precision for datasets with a very large mean relative to the spread; for such cases use Welford's online algorithm. See our disclaimer for full details.
Frequently Asked Questions
What is Bessel's correction and why is it needed?
Bessel's correction divides the sum of squared deviations by n-1 instead of n when computing the sample variance. Without it, the sample variance would systematically underestimate the population variance, because the squared deviations about the sample mean are smaller than the squared deviations about the population mean. The correction was introduced by Friedrich Bessel in 1820.
When should I use population vs sample standard deviation?
Use population (divide by n) when your data represents every member of the population of interest. Use sample (divide by n-1) when your data is a sample drawn from a larger population, and you want to estimate the spread of that population. Per NIST/SEMATECH e-Handbook section 1.3.6, the sample sd is the unbiased estimator of the population sd.
Why does the calculator reject a single value in sample mode?
Because the sample variance formula divides by n-1, which would be zero for n=1. Division by zero is undefined. With a single observation, there is no information about spread, so the standard deviation is mathematically undefined rather than zero.
How is standard deviation related to variance?
Variance is the average squared deviation from the mean; standard deviation is the square root of variance. Standard deviation is reported more often because it has the same units as the original data, while variance has squared units. For data measured in metres, variance is in square metres, which is harder to interpret.
What is the difference between standard deviation and standard error?
Standard deviation measures the spread of the data. Standard error measures the spread of the sample mean as an estimator of the population mean; it equals the sample standard deviation divided by the square root of n. The standard error shrinks as the sample size grows, while the standard deviation does not.
How does the calculator handle outliers?
It does not. Every value contributes to the mean and to the sum of squared deviations with equal weight. A single extreme value can dramatically inflate the standard deviation. For robust measures of spread, use the interquartile range (IQR) or the median absolute deviation (MAD) instead.
Last updated: September 9, 2026 · Author: HT99 Tools Editorial Team