Statistics Calculator
Mean, median, mode, five-number summary, IQR, outliers and SD with steps, a histogram and a box plot.
This standard deviation calculator finds the sample standard deviation (divide by n − 1) or the population standard deviation (divide by n) of a list or a frequency table, with the variance, mean, standard error, a dot plot and every step shown.
Sample standard deviation (s)
On average the values lie about 2.138 away from the mean of 5. The population version is 2; the sample value is the larger of the two because it divides by n − 1 instead of n.
| i | x | x − mean | (x − mean)² |
|---|---|---|---|
| 1 | 2 | −3 | 9 |
| 2 | 4 | −1 | 1 |
| 3 | 4 | −1 | 1 |
| 4 | 4 | −1 | 1 |
| 5 | 5 | 0 | 0 |
| 6 | 5 | 0 | 0 |
| 7 | 7 | 2 | 4 |
| 8 | 9 | 4 | 16 |
| Sum | 40 | 0 | 32 |
Find the mean
Add the 8 values and divide by n.
Subtract the mean and square
For every value, find its deviation from the mean and square it (the table below lists each one). Squaring makes every term positive.
Divide by n − 1 (sample variance)
A sample divides by n − 1 = 7 (Bessel’s correction).
Take the square root
Sample standard deviation
Plain-text formula: s = √((∑_{i = 1}^n (x_i − x̄)^2)/(n − 1))
Dividing by n − 1 instead of n (Bessel’s correction) makes the sample variance an unbiased estimate of the population variance.
Population standard deviation
Plain-text formula: σ = √((∑_{i = 1}^N (x_i − μ)^2)/N)
Used when the data are the entire population. It is always a little smaller than the sample version for the same numbers.
Grouped data (values with frequencies)
Plain-text formula: s = √((∑f(x − x̄)^2)/(∑f − 1)), x̄ = (∑fx)/(∑f)
Each value x is counted f times. For classes such as 10–20, use the class midpoint as x; the result is then an estimate, because the values inside each class are unknown. For a population, divide by Σf instead of Σf − 1.
Variance
Plain-text formula: s^2 = (SS)/(n − 1), σ^2 = (SS)/N, SS = ∑(x − x̄)^2
The variance is the standard deviation squared. It is in squared units (for example cm²), which is why the standard deviation is easier to interpret.
Standard error of the mean
Plain-text formula: SE = s/√(n)
The standard error measures how much the sample mean would vary from sample to sample. It shrinks as n grows, while the standard deviation does not.
The standard deviation is in the same units as your data and measures how far values typically are from the mean. A small value means the data cluster tightly around the mean; a large value means they are spread out.
For data that are roughly bell-shaped, the empirical rule says about 68% of values fall within one standard deviation of the mean, about 95% within two and about 99.7% within three. The calculator shows the actual shares for your data, so you can see how close to normal they are.
A value more than about two standard deviations from the mean is unusual, and one more than three is rare. Divide a value’s distance from the mean by the standard deviation to get its z-score.
Compare spreads of data on different scales with the coefficient of variation (standard deviation divided by the mean, also called the relative standard deviation), not with the raw standard deviations.
1. Add the values and divide by how many there are to get the mean.
2. Subtract the mean from each value to get its deviation. The deviations always add up to 0.
3. Square each deviation and add the squares. This total is the sum of squares, SS.
4. Divide SS by n − 1 for a sample or by n for a population. The result is the variance.
5. Take the square root of the variance. That is the standard deviation.
For 2, 4, 4, 4, 5, 5, 7, 9 the mean is 5, the squared deviations add to 32, the sample variance is 32 / 7 ≈ 4.571 and the sample standard deviation is about 2.138. The worked example below lays out every row, and the calculator’s steps do the same for your own numbers.
The difference is only the divisor. A sample tends to sit closer to its own mean than to the true population mean, so the squared deviations are slightly too small; dividing by n − 1 instead of n corrects this on average.
If you measured the heights of 25 students to learn about all students at a school, use the sample formula. If you are describing the final exam scores of every student in one class and only that class, use the population formula. When in doubt, use the sample version: most software defaults to it.
| Tool | Sample (n − 1) | Population (n) |
|---|---|---|
| Excel and Google Sheets | STDEV.S (or STDEV) | STDEV.P (or STDEVP) |
| TI-83 and TI-84 (1-Var Stats) | Sx | σx |
| Casio scientific (STAT mode) | sx (xσn−1 on older models) | σx (xσn on older models) |
| R | sd(x) | sd(x) × √((n − 1)/n) |
| Python | statistics.stdev(x) | statistics.pstdev(x) |
| NumPy | np.std(x, ddof=1) | np.std(x) |
When data come as a frequency table, you do not need to type every repeated value. Choose Values with frequencies, enter each value once and its count beside it. The calculator multiplies each squared deviation by its frequency, f(x − x̄)², and divides the total by Σf − 1 for a sample or Σf for a population.
For class intervals such as 0–10, 10–20 and 20–30, enter the midpoints 5, 15 and 25 as the values. This treats every value in a class as if it sat at the midpoint, so the answer is an approximation of the standard deviation of the raw data.
The standard deviation describes the spread of the individual values. The standard error of the mean, s/√n, describes how precisely the sample mean estimates the population mean. Collecting more data does not make the standard deviation smaller, but it does shrink the standard error.
Report the standard deviation when you describe the data (for example, “mean 5.0, SD 2.1”). Report the standard error, or a confidence interval built from it, when you describe how certain the mean is.
Treat the eight values as a sample and find s, then compare with σ.
Answer: s ≈ 2.138089935 (sample) and σ = 2 (population).
For a sample, s = √(Σ(x − x̄)² / (n − 1)). For a population, σ = √(Σ(x − μ)² / N). Both take the square root of the average squared distance from the mean; only the divisor differs.
Use the sample version unless your data include every member of the group you are describing. Survey responses, experimental measurements and quality-control samples are samples.
It divides the same sum of squares by a smaller number, n − 1 instead of n. The gap shrinks as n grows: with 8 values the ratio is √(8/7) ≈ 1.069, with 100 values about 1.005.
Use =STDEV.S(A1:A20) for a sample and =STDEV.P(A1:A20) for a population. Google Sheets uses the same function names. You can also paste the column straight into this calculator to see the working.
There is no universal good value, because the standard deviation is in the units of your data. Judge it against the mean with the coefficient of variation: below about 10% is usually considered low spread, though the right threshold depends on the field.
The relative standard deviation (RSD) is the standard deviation divided by the absolute value of the mean, usually written as a percentage. It is the same as the coefficient of variation, which the calculator lists under the results.
No. It is the square root of an average of squares, so it is zero when every value is the same and positive otherwise.
The sample formula divides by n − 1, which is 0 for a single value, so the sample standard deviation is undefined. The population standard deviation of one value is 0.
The variance is the average squared deviation, in squared units. The standard deviation is its square root, back in the original units, which makes it easier to interpret.
Mean, median, mode, five-number summary, IQR, outliers and SD with steps, a histogram and a box plot.
Z-scores, percentiles and normal probabilities with steps, a z-table and a shaded bell curve.
Line of best fit with r², slope p-value, 95% intervals and steps, plus five curved regression models.
Exact and cumulative Poisson probabilities for any average rate λ, with steps, a table and a graph.
Exact and cumulative binomial probabilities for up to a million trials, with steps, a table and a graph.
Type or tap expressions with exact fractions, memory, variables, constants and complex mode.
Results are calculated in your browser with methods checked by automated tests, and are intended for learning and general use. For engineering, medical, financial, legal or safety-critical decisions, verify important values independently and follow the rounding rules your work requires. How accurate are these results?