Math Runs locally Ready to use Built-in examples No tracking

Standard Deviation Calculator

Enter any list of numbers to get population and sample variance and standard deviation, together with quartiles, IQR, range, mode, standard error and coefficient of variation.

Two classes can share the same average mark and be nothing alike: one sits tightly around it, the other is dragged sideways by a few scores. An average answers "where is the middle"; the standard deviation answers "how scattered". Paste a column of numbers and this page returns both conventions at once — population and sample variance and standard deviation, plus quartiles, range, mode, standard error and coefficient of variation.

The population-versus-sample distinction is the trap: population variance divides by n, sample variance by n−1 (Bessel’s correction, because a sample is used to estimate a wider population) — and with n = 1 the sample standard deviation does not exist at all. Excel calls these STDEV.P and STDEV.S; numpy defaults to ddof=0 (population) and pandas to ddof=1 (sample), so align the convention before comparing figures across tools.

How to use

  1. Paste your numbers — commas, spaces and newlines are all accepted.
  2. Read the population and sample variance and standard deviation side by side.
  3. Check the quartiles, interquartile range, range, mode and coefficient of variation.
  4. Copy the result; when comparing with Excel, match the convention (STDEV.P or STDEV.S).

How it works

How standard deviation is computed step by step

First compute the mean, then the deviation of every value from it. Square each deviation, sum the squares, divide by the count and take the square root. For 2, 4, 4, 4, 5, 5, 7, 9: the mean is 5, the sum of squared deviations is 32, so the population variance is 32 ÷ 8 = 4 and the population standard deviation is 2. On the sample basis it is 32 ÷ 7 ≈ 4.5714, giving a sample standard deviation of about 2.1381.

Population (÷n) vs. sample (÷n−1): which to use

Use the population basis (divide by n) when the data itself is the entire object of study — the exam scores of all 40 students in a class, or all 12 months of sales. Use the sample basis (divide by n−1) when the data is a sample drawn from a larger population. Because the sample mean is computed from the same data, deviations are systematically too small; dividing by the degrees of freedom n−1 corrects this bias. At n = 10 the two bases differ by about 5.4%; at n = 100 only about 0.5% — the more data, the smaller the gap.

Why the quartiles differ from Excel

This tool computes quartiles with the median method: sort the data, split it in half at the median, and take the median of each half; with an odd count the median itself belongs to neither half. Excel's QUARTILE.INC uses linear interpolation at position (n−1), so for 1–11 it reports Q1 = 3.5 and Q3 = 8.5, while this tool gives 3 and 9. Both are accepted conventions — just state which one you used when writing a report.

Calculation basis: population variance σ² = Σ(xᵢ−μ)²/n and sample variance s² = Σ(xᵢ−x̄)²/(n−1), with the standard deviation as the square root of each. Quartiles use the median method (for an odd count the median is left out of both halves), which differs from the linear interpolation of Excel's QUARTILE.INC. Standard error = s/√n and coefficient of variation = s/mean.

Code example

JavaScript Population and sample conventions

function stats(xs) {
  const n = xs.length;
  const mean = xs.reduce((a, b) => a + b, 0) / n;
  const ss = xs.reduce((a, x) => a + (x - mean) ** 2, 0);
  return {
    mean,
    varPop: ss / n,                         // population (divide by n)
    varSample: n > 1 ? ss / (n - 1) : NaN   // sample (divide by n-1)
  };
}

stats([2, 4, 4, 4, 5, 5, 7, 9]);   // varPop: 4, varSample: 4.571

Python What statistics and numpy assume

import statistics as st
import numpy as np

xs = [2, 4, 4, 4, 5, 5, 7, 9]

st.pstdev(xs)      # 2.0 (population)
st.stdev(xs)       # 2.138 (sample, n-1)
np.std(xs)         # 2.0 (numpy defaults to ddof=0, population)
np.std(xs, ddof=1) # 2.138 (sample)

# pandas .std() defaults to ddof=1, the opposite of numpy — watch out

FAQ

What is the difference between standard deviation and variance?

Variance is the average of squared deviations, so its unit is the square of the original data's unit (a variance of scores is in "points squared"); standard deviation is the square root of variance and shares the original unit. That is why descriptive reports usually quote the standard deviation, while ANOVA and other statistical machinery work with the variance.

Should I use population or sample standard deviation?

If the data is the entire population you care about (all 40 students, all 12 months), divide by n. If the data is a subset drawn from a larger population (30 students sampled from a whole school), divide by n−1. For the same data the two figures differ only slightly, but the sample basis is the statistically honest choice for a sample.

Why does the sample standard deviation divide by n−1 instead of n?

The sample mean is computed from the sample itself, so the data naturally "hugs" that mean and the sum of squared deviations comes out too small; dividing by n would systematically underestimate the true spread. Dividing by the degrees of freedom n−1 corrects this bias, yielding an unbiased estimator.

Why do the quartiles differ from Excel's?

There are two accepted quartile conventions. This tool uses the median method (with an odd count, the median joins neither half); Excel's QUARTILE.INC interpolates linearly at position (n−1). For the data 1 to 11 this tool gives Q1 = 3 and Q3 = 9, while Excel gives 3.5 and 8.5. Either is fine — just note the convention in your report.

How large does the standard deviation have to be for data to be volatile?

Don't judge by the absolute value alone — look at the coefficient of variation (standard deviation ÷ mean). In the worked example the mean is 5 and the standard deviation 2, a CV of 40%, which is highly volatile. As a rule of thumb, a CV below 15% counts as stable. A standard deviation of 80 means something very different depending on whether the mean is 100 or 10,000.

Is the standard deviation still reliable with outliers present?

Because deviations are squared, extreme values get amplified, so the standard deviation is sensitive to outliers. For 1, 2, 3, 4, 100 the mean is 22 and the population standard deviation about 39.0 — "huge volatility" — yet the first four values are tightly clustered. With outliers present, report the median and interquartile range as well.

Can I compute a standard deviation from a single value?

No. A single value has no spread to speak of: the population variance is 0 by definition (every deviation is 0), and the sample variance is undefined because it divides by n−1 = 0. On the sample basis this tool shows "—" and notes that at least two values are required.

What is the standard deviation if all values are identical?

Zero. For 7, 7, 7, 7 every deviation is 0, the sum of squared deviations is 0, and the variance, standard deviation and coefficient of variation are all 0. The mode is also 7. A standard deviation of 0 means the data has no volatility at all — which is itself a meaningful finding.