IQR Calculator

Standard Deviation Calculator

Typical distance from the mean, in the units of your data. Sample and population, kept apart.

Standard deviation calculatorRuns entirely in your browser
Separate values with commas, spaces or line breaks. Paste a column straight from a spreadsheet.
Try:
Data represents
ResultExclusive method · n = 8
Sample standard deviation (s)5.237229√27.428571typical distance from the mean of 18
Count
n = 8
Mean
18
Sum
144
Variance s²
27.428571
Std dev s
5.237229
Sum of squares
192

The other convention, for comparison

Population σ
4.898979
Population σ²
24

Use the sample formula when your values are a sample drawn from a larger group, and the population formula only when they are the entire group.

Distribution

Histogram of 8 values from 10 to 23, with the mean at 18 and dashed lines one standard deviation either side.2 values from 10 to 13.252 values from 13.25 to 16.54 values from 19.75 to 23mean 18101520

How we calculated it

Find the mean
x̄ = 144 ÷ 8 = 18
Subtract the mean from each value, then square it
See the deviation table below for every row.
Σ(x − x̄)² = 192
Divide by n − 1
s² = 192 ÷ 7 = 27.428571
The n − 1 divisor (Bessel’s correction) compensates for using the sample mean rather than the unknown population mean.
Take the square root
s = √27.428571 = 5.237229
The square root puts the answer back into the original units.

Deviation table

xx − x̄(x − x̄)²
10-864
12-636
23525
23525
16-24
23525
2139
16-24
Total192

What it measures

The standard deviation answers one question: how far from the mean is a typical value? Not the furthest, not the closest — the typical one. It is expressed in the same units as the data, so a standard deviation of 12 on exam scores means "typically about 12 marks away from the average", which is a sentence anyone can act on.

It is built by measuring every value's distance from the mean, squaring those distances, averaging them, and then taking a square root to undo the squaring. The squaring is what makes it sensitive to distant values — a point twice as far away contributes four times as much.

Sample or population — the choice that changes the answer

There are two formulas. They differ in one place, and picking the wrong one is the most common mistake in this calculation.

Population: σ = √( Σ(x − μ)² ÷ N ) Sample: s = √( Σ(x − x̄)² ÷ (n − 1) ) σ, μ, N — population standard deviation, population mean, population size
s, x̄, n — sample standard deviation, sample mean, sample size

Which one do you need?

Ask what your numbers represent.

  • Population (divide by N) — your values are the complete group you want to describe. Every student in the class, when the class is the whole question. All twelve monthly totals for the year that just ended.
  • Sample (divide by n − 1) — your values are a subset, and you want to say something about the larger group they came from. Forty customers surveyed out of thousands. Thirty measurements from a process that will keep producing more.

In practice the sample formula is the right one far more often, which is why statistics software defaults to it and why this calculator does too.

Why n − 1?

Because the sample mean is itself estimated from the same data. The values in a sample sit closer to their own mean than to the true population mean — they have to, since the sample mean is calculated to be the point that minimises exactly those distances. Dividing by n would therefore produce an estimate that is systematically too small, every time. Reducing the divisor to n − 1 corrects the bias. This is Bessel's correction.

The gap matters most when n is small. At n = 5 the two divisors differ by 25%; at n = 500, by 0.2%.

Interpreting the number

A standard deviation has no meaning in isolation — it carries the units and the scale of the data. 12 is large for a set of shoe sizes and negligible for a set of annual revenues. Three ways to give it context:

  • Against the mean. The coefficient of variation divides the standard deviation by the mean, giving a unitless percentage that can be compared across data sets.
  • Against a single value. A z-score says how many standard deviations one observation sits from the mean.
  • Against the shape. For roughly normal data the empirical rule applies: about 68% of values fall within one standard deviation of the mean, about 95% within two, and about 99.7% within three. For data that is not normal, those percentages do not hold, and a box plot will tell you more.

Standard deviation or IQR?

They answer the same question with opposite temperaments. The standard deviation uses every observation and is therefore efficient, but the squaring makes it easy to dominate with one distant point. The IQR uses four positions and ignores magnitudes entirely, so it barely reacts to extremes.

Use the standard deviation with roughly symmetric data, and when whatever you do next expects one — confidence intervals, t-tests and control charts are all built on it. Use the IQR with skewed data, or alongside a median. Quoting a median with a standard deviation is a mismatch that will be noticed.

Worked examples

A set with a whole-number population σ

Data: 2, 4, 4, 4, 5, 5, 7, 9

The mean is 40 ÷ 8 = 5. The deviations are −3, −1, −1, −1, 0, 0, 2, 4, and their squares are 9, 1, 1, 1, 0, 0, 4, 16 — summing to 32.

  • Population: σ² = 32 ÷ 8 = 4, so σ = 2.
  • Sample: s² = 32 ÷ 7 ≈ 4.571, so s ≈ 2.138.

Same eight numbers, two answers that differ by about 7%. Which is correct depends entirely on whether these eight values are the whole story.

A worked set with a non-integer result

Data: 10, 12, 23, 23, 16, 23, 21, 16

The mean is 144 ÷ 8 = 18. The squared deviations are 64, 36, 25, 25, 4, 25, 9, 4, summing to 192.

  • Population: σ² = 192 ÷ 8 = 24, σ = √24 ≈ 4.899.
  • Sample: s² = 192 ÷ 7 ≈ 27.429, s ≈ 5.237.

The deviation table in the result panel above lists every row of this calculation for whatever data you enter.

When the standard deviation is zero

Data: 7, 7, 7, 7, 7

Every value equals the mean, so every deviation is 0 and so is their sum. Both σ and s are 0. A standard deviation of zero means the data has no spread at all — and note that it makes a z-score undefined, since the formula would divide by it.

Questions

Can the standard deviation be negative?

No. It is the square root of an average of squares, so it is always zero or positive. A negative value in a report means an error somewhere upstream.

What is the relationship between variance and standard deviation?

The standard deviation is the square root of the variance. Variance is in squared units, which makes it awkward to interpret; the square root puts the answer back into the units of the data.

Does Excel use the sample or population formula?

STDEV.S is the sample formula with the n − 1 divisor, and STDEV.P is the population formula with the N divisor. The legacy STDEV function is the sample version. Picking the wrong one is a common source of small, hard-to-spot discrepancies.

How does one outlier affect it?

Strongly, because deviations are squared before averaging. A value three times further from the mean than the others contributes nine times as much to the sum of squares. If that worries you, compare the result against the mean absolute deviation, which does not square, or use the IQR.

Method & sources