Standard Deviation Calculator
Calculate the population or sample standard deviation, variance, and mean of any dataset, with step-by-step results.
How It's Calculated
Formula
\sigma^2 = \frac{\sum (x_i - \mu)^2}{N} \quad\text{(population)} \qquad s^2 = \frac{\sum (x_i - \bar{x})^2}{n-1} \quad\text{(sample)} \qquad \sigma = \sqrt{\sigma^2},\ s = \sqrt{s^2}Standard deviation measures how spread out a set of numbers is around its average. A small standard deviation means the values cluster tightly around the mean; a large one means they're spread wide. This calculator computes the count, sum, mean, variance, and standard deviation of any dataset you enter, using either the population or sample formula. Population standard deviation is the correct choice when your dataset IS the entire group you care about — every student in a class, every day in a completed month, every unit in a finished batch. Sample standard deviation is the correct choice when your dataset is only a subset drawn from a larger population you're trying to describe — a survey of 50 customers standing in for your whole customer base, a handful of test measurements standing in for a full production run. The two formulas differ only in what they divide by: population divides by N (the full count), while sample divides by n − 1. That n − 1 is called Bessel's correction, and it exists because a sample's own mean is, on average, slightly closer to the sample's own data points than the true (unknown) population mean would be — dividing by n instead of n − 1 would systematically underestimate how spread out the real population actually is. Dividing by the smaller number n − 1 inflates the estimate just enough to correct for that bias, making sample variance an unbiased estimator of the population variance it's approximating.
Worked Examples
Population standard deviation
- Dataset: 2, 4, 4, 4, 5, 5, 7, 9 (N = 8, treated as the entire population)
- Mean (μ) = (2+4+4+4+5+5+7+9) / 8 = 40 / 8 = 5
- Squared deviations from the mean: 9, 1, 1, 1, 0, 0, 4, 16
- Sum of squared deviations = 32
- Population variance = 32 / N = 32 / 8 = 4
- Population standard deviation = √4 = 2
Sample standard deviation
- Dataset: 2, 4, 4, 4, 5, 5, 7, 9 (n = 8, treated as a sample of a larger population)
- Mean (x̄) = 40 / 8 = 5 (the sample mean is calculated the same way as the population mean)
- Sum of squared deviations from the mean = 32 (same as above — the deviations don't change)
- Sample variance = 32 / (n − 1) = 32 / 7 ≈ 4.5714
- Sample standard deviation = √4.5714 ≈ 2.1381
- Notice this is larger than the population result (2) — dividing by n − 1 instead of N always produces an equal or larger estimate, which is Bessel's correction at work
Frequently Asked Questions
Should I use population or sample standard deviation?
Use population when your dataset contains every member of the group you're describing — for example, the test scores of every student in one specific class. Use sample when your dataset is only a subset used to estimate a larger, unmeasured population — for example, 30 survey responses standing in for all of your customers. When in doubt, sample is the more common and more conservative choice for real-world data collection.
Why does sample standard deviation divide by n − 1 instead of n?
This is Bessel's correction. A sample's own mean is calculated from, and therefore pulled slightly toward, the sample's own data points — so measuring each point's distance from the sample mean (rather than the unknown true population mean) tends to understate the real spread. Dividing by the smaller number n − 1 instead of n inflates the result just enough to offset that bias, so sample variance becomes an unbiased estimate of the population's actual variance.
Why do I need at least 2 values for a sample standard deviation?
Sample variance divides by n − 1. With a single value, n − 1 = 0, which is a division by zero — there is no meaningful sample spread from one data point alone. Population standard deviation has no such restriction: a population of one value is mathematically valid and simply has a standard deviation of 0 (there's no deviation from a single point).
What happens if I enter a non-numeric or blank value?
The calculation is not performed and a clear message identifies which row is the problem. This calculator deliberately does not silently drop invalid rows and calculate with what's left — doing so would quietly change your dataset without telling you, which could produce a misleading result for a statistics tool. Fix or remove the flagged row to get a result.
Does the order of the values matter?
No. Standard deviation, variance, and mean are all order-independent — you can enter your values in any order and get the same result.