Standard Deviation Calculator
Paste a list of numbers — commas, spaces, tabs or new lines all work — and get the sample and population standard deviation side by side, with the variance, the standard error of the mean, and the deviation of every single value — plus the coefficient of variation, quartiles, and a 95% confidence interval for the mean. Open Advanced options to switch how the quartiles split an odd-length list.
Measure the spread
Paste or type up to 1,000 numbers. Commas, spaces, tabs, and new lines all separate — so a spreadsheet column pastes straight in. Because a comma separates, do not use one as a thousands separator: type 1234, not 1,234.
Sample is the usual answer: measurements, survey responses, and test scores are nearly always a slice of something bigger. Choose population only when the list is genuinely everything.
8 values, mean 5, summed squared deviations divided by n − 1 = 7. The other divisor gives 2.
- Population standard deviation (σ)
- 2
- Sample variance (s²)
- 4.571429
- Population variance (σ²)
- 4
- Coefficient of variation
- 42.761799%
- Standard error of the mean
- 0.755929
- 95% CI lower bound
- 3.212228
- 95% CI upper bound
- 6.787772
- 95% CI margin of error
- ±1.787772
- t critical value (95% CI)
- 2.365 at df 7
- Values (n)
- 8
- Sum (Σx)
- 40
- Mean (x̄)
- 5
- Median
- 4.5
- Minimum
- 2
- Maximum
- 9
- Range
- 7
- Lower quartile (Q1)
- 4
- Upper quartile (Q3)
- 6
- Interquartile range (IQR)
- 2
Two formulas, one sum of squared deviations
Both standard deviations start from the same quantity: add up how far each value is from the mean, squared. What separates them is the number you divide that total by.
σ = √(Σ(x − x̄)² ÷ n) • s = √(Σ(x − x̄)² ÷ (n − 1)) • SE = s ÷ √n- x̄
- The mean — the sum of the values divided by how many
- n
- How many values there are
- σ
- Population standard deviation — the spread of this exact list
- s
- Sample standard deviation — an estimate of the spread of the larger group
- SE
- Standard error of the mean — how far this sample's mean is likely to sit from the true one
Why the sample formula divides by n − 1
That is Bessel's correction, and the reason for it is specific. The sample mean is the value that makes the sum of squared deviations smallest for that sample — pick any other centre and the total goes up. But the population mean the sample came from is almost never exactly the sample mean, so deviations measured from the sample mean are systematically smaller than the deviations that actually exist in the population. Dividing by n − 1 rather than n inflates the estimate by exactly the amount needed to cancel that bias in expectation. It is not a fudge for small samples; it is a correction for measuring from the wrong centre, and the correction happens to matter most when samples are small.
Why this calculator makes two passes over your data
Most textbooks give a one-pass shortcut, Σx² − (Σx)²/n, which is algebraically identical and was genuinely useful when the pass was a person with a pencil. In floating-point arithmetic it is dangerous. When the mean is large relative to the spread, the two terms become nearly equal and very large, and subtracting them cancels away every digit they share — leaving an answer built out of whatever rounding noise was underneath.
Take three values: 100000000.1, 100000000.2 and 100000000.3. They are 0.1 apart, so their sample variance is 0.01 and their standard deviation is 0.1. In double precision the shortcut returns a variance of −2 — not merely imprecise but negative, which a sum of squares divided by a positive number cannot possibly be. This calculator finds the mean first, then sums the real deviations, and returns 0.01. Try those three numbers in the box above; the answer holds up. That is the whole reason for the second pass.
The coefficient of variation
Standard deviation carries the data's units and its scale together, so a spread of “2” on its own could be enormous or negligible depending on the mean it sits beside. The coefficient of variation divides the standard deviation shown above by the (absolute value of the) mean and reports it as a percentage, which is what makes lists on different scales comparable. It is undefined — not merely large — at a mean of exactly zero, where there is no scale left to divide into.
Quartiles: Tukey's hinges, inclusive by default
Finding Q1 and Q3 means splitting the sorted list in half and taking the median of each half, which is unambiguous when the count is even. When it is odd, the middle value has nowhere unambiguous to go: the inclusivemethod — John Tukey's original definition of a “hinge”, from his 1977 Exploratory Data Analysis — counts it in both halves. The exclusivemethod, which Moore and McCabe teach, leaves it out of both instead. The two agree exactly on an even-length list and differ only on an odd one — this calculator's default eight-value set is even, so switching the Advanced options toggle above does nothing to it; try it on an odd-length list to see the two methods pull apart. Either way, the interquartile range reported is Q3 minus Q1.
Why the confidence interval always uses t, never z
A confidence interval for the mean needs a multiplier, and the honest multiplier depends on whether the standard deviation feeding it is known outright or estimated from the same list. This calculator only ever has the second kind — it computes s from whatever you typed in, never a σ handed down from outside — so it always reads its multiplier from the Student's t distribution at n − 1 degrees of freedom, exactly as NIST/SEMATECH's own formula for this situation does. t is always at least as wide as the familiar z = 1.960, narrowing toward it as the sample grows — 2.365 at 7 degrees of freedom, 1.984 at 100 — which is why “use z once n is around 30 or more” works as a rule of thumb: it is a large-sample shortcut for a number this calculator would rather compute exactly. The interval is always built from the samplestandard deviation, even when the basis above is set to population — a complete population's mean is already known exactly and has no sampling error to bracket, so on that basis the interval is shown for reference rather than as a claim about the data, the same treatment the standard error above already gets.
The set 2, 4, 4, 4, 5, 5, 7, 9
This is the list every introductory text uses, and it is the default above. There are eight values and they sum to 40, so the mean is 40 ÷ 8 = 5.
Now the deviations from that mean: −3, −1, −1, −1, 0, 0, +2, +4. Squared, they are 9, 1, 1, 1, 0, 0, 4 and 16, which add to 32. That single number, 32, is everything the two formulas share.
Treat the eight values as the whole population and divide by n = 8: the variance is 32 ÷ 8 = 4 and the standard deviation is √4 = 2, exactly. Treat them as a sample and divide by n − 1 = 7: the variance is 32 ÷ 7 = 4.571429 and the standard deviation is 2.138090. The sample figure is about 7% larger, and that gap is the entire practical effect of Bessel's correction at n = 8.
The standard error of the mean follows from the sample figure: 2.138090 ÷ √8 = 0.755929. Read that as — if this really is a sample of something bigger, the mean of that bigger thing is probably within a point or so of 5, not pinned to 5 exactly.
The same eight values have a coefficient of variation of 2.138090 ÷ 5 × 100 = 42.76% — a large relative spread. For the quartiles, split the sorted list 2, 4, 4, 4, 5, 5, 7, 9 into two even halves: the lower half (2, 4, 4, 4) medians to Q1 = 4, and the upper half (5, 5, 7, 9) medians to Q3 = 6, so the interquartile range is 6 − 4 = 2. Eight is an even count, so the inclusive and exclusive methods agree here; paste an odd-length list, such as 1 through 7, to see them pull apart (Q1 = 2.5 inclusive versus Q1 = 2 exclusive).
And the 95% confidence interval for the mean, reading this list as a sample of something larger: at 8 − 1 = 7 degrees of freedom the published t multiplier is 2.365, so the margin of error is 2.365 × 0.755929 = 1.787772, and the interval runs from 5 − 1.787772 = 3.212228 to 5 + 1.787772 = 6.787772. That is the honest, t-based interval this calculator returns at every sample size — see “Why the confidence interval always uses t, never z” above for why it never substitutes the narrower z = 1.960.
What this calculator assumes
- Your list is raw observations, not grouped or binned data. A frequency table like “12 values of 4” needs those values written out, or a weighted formula this tool does not implement.
- Every value counts equally. There is no weighting, and nothing is dropped as an outlier — an extreme value moves the mean and inflates the deviation, which is the honest result. If you want it excluded, remove it yourself and say so.
- Commas separate values, so they cannot also be thousands separators. Type 1234, not 1,234, or the tool will read two numbers.
- The standard error is always built from the sample standard deviation, whichever basis you pick. A complete population has no sampling error to report, so on that basis the figure is shown for reference rather than as a claim about your data.
- Nothing here assumes a normal distribution. The standard deviation itself never needed one — but the familiar 68–95–99.7 reading of it does, and that reading fails on skewed data. The histogram is there to let you check.
- Results are rounded to six decimal places for display. The arithmetic underneath runs at full double precision, and the rounding happens once, at the end.
- Quartiles use Tukey's method of medians-of-halves, inclusive by default — the middle value joins both halves on an odd-length list. Switch to exclusive in Advanced options to match the Moore and McCabe convention instead; the two can legitimately disagree on the same list, and neither is a bug. Both differ from the linear-interpolation method FigureBetter's mean/median calculator uses, so do not expect the two tools to agree on Q1 or Q3 for a short list.
- The coefficient of variation divides the standard deviation shown above by the (absolute value of the) mean and is undefined at a mean of exactly zero.
- The 95% confidence interval always uses the Student's t distribution, never z, because this calculator only ever has an estimated standard deviation, not a known one. It is built from the sample figures regardless of which basis is selected, for the same reason the standard error above is.
Standard deviation FAQ
Should I use the sample or the population formula?
Ask what the list is. If it is every member of the group you care about — the marks of all 31 students in one class, when the class is the whole question — use the population formula and divide by n. If it is a slice of something larger you want to describe — 31 measurements from a process that will keep producing them, 31 survey responses out of thousands — use the sample formula and divide by n − 1. Sample is the right answer far more often than people expect, because most data is a sample of something.
Why does the sample formula divide by n − 1 instead of n?
This is Bessel's correction, and the reason is subtler than 'small samples need a nudge'. The sample mean is, by construction, the point that makes the sum of squared deviations as small as it can possibly be for that sample — no other centre gives a smaller total. But the true population mean is almost never exactly the sample mean, so measuring spread from the sample mean systematically understates it. Dividing by n − 1 rather than n inflates the result by exactly enough to cancel that bias on average. The shortfall shrinks as n grows, which is why the two formulas converge: at n = 5 the sample figure is about 12% larger, at n = 100 about 0.5%.
What is the difference between standard deviation and standard error?
Standard deviation describes the data: how far a typical single value sits from the mean. Standard error of the mean describes an estimate: how far this sample's mean is likely to sit from the mean of the group it was drawn from. It is s ÷ √n, so it shrinks as you collect more data while the standard deviation does not. If eight values have a standard deviation of 2.14, collecting eight hundred more will not change that much — but it will shrink the standard error from 0.76 towards nothing.
Is a standard deviation of 2 high or low?
Neither on its own — it carries the units of the data, so it is only meaningful next to the mean. Two points of spread around a mean of 5 is enormous; two points around a mean of 5,000 is nothing. The usual way to compare across scales is the coefficient of variation, standard deviation divided by the mean, which for the default list here is 2.14 ÷ 5 = 0.43, or 43%.
Why not use the Σx² − (Σx)²/n shortcut my textbook shows?
Because it breaks on real data. The shortcut is algebraically identical and needs only one pass, which mattered when the pass was a person with a pencil. In floating-point arithmetic it subtracts two nearly equal, very large numbers, and the leading digits they share cancel away — leaving an answer assembled from rounding noise. For the values 100000000.1, 100000000.2 and 100000000.3, whose sample variance is plainly 0.01, the shortcut returns −2 in double precision: a negative variance, which is arithmetically impossible. This calculator finds the mean first and then sums the actual deviations, so it returns 0.01.
Does standard deviation assume the data is a bell curve?
No. The calculation is just the root-mean-square distance from the mean and works on any list of numbers. What does assume a bell curve is the familiar interpretation — that about 68% of values fall within one standard deviation and 95% within two. On skewed data, or data with a long tail, those percentages are wrong, sometimes badly. The histogram above is there so you can check the shape before you lean on that rule.
What is the coefficient of variation, and when should I use it?
It is the standard deviation divided by the mean, shown here as a percentage: for the default list, 2.138090 ÷ 5 × 100 = 42.76%. Because it is a ratio rather than a raw figure, it lets you compare the relative spread of two lists that are not on the same scale — a spread of 2 around a mean of 5 is enormous, the same spread of 2 around a mean of 5,000 is nothing, and the standard deviation alone cannot tell you that. It is undefined at a mean of exactly zero, where there is no scale left to divide into, and this calculator says so rather than showing an error or an infinite number.
What do 'inclusive' and 'exclusive' mean for the quartiles?
They are two textbook-standard ways of finding Q1 and Q3 that disagree only when your list has an odd number of values. Splitting a sorted list in half is unambiguous when the count is even; when it is odd, the middle value has to go somewhere. Inclusive — Tukey's original 'hinges' — counts it in both halves, which pulls Q1 and Q3 slightly toward the centre. Exclusive, the method Moore and McCabe teach, leaves it out of both, which pushes them slightly further apart. Neither is more correct; they are different, equally standard conventions, and this calculator defaults to inclusive with a toggle in Advanced options to switch.
Why do the quartiles here sometimes differ from FigureBetter's mean/median calculator?
Because the two tools use different, equally legitimate, quartile methods on purpose. This calculator uses Tukey's method of medians-of-halves, described above. The mean/median calculator uses linear interpolation between ranks — R's 'type 7', the default in NumPy, and Excel's QUARTILE.INC — a different rule that can print a different Q1 or Q3 for the same list, especially a short one. If you need your answer to match a specific textbook, spreadsheet function, or statistics package, check which method it uses before assuming either calculator made an error.
Should a confidence interval for this mean use z or t?
Use t whenever the standard deviation came from the sample itself rather than being known in advance — which is every case this calculator can see, since it only ever computes s from the list you typed in. That is also why this calculator always uses t: NIST/SEMATECH's own formula for this situation is written with t, not z. z is only exactly correct when the population standard deviation σ is genuinely known outright, a different and rarer problem (FigureBetter's confidence interval calculator covers that case directly). As the sample grows, t and z converge — 2.365 at 7 degrees of freedom, 1.984 at 100 — so a reader who has learned 'use z once n is 30 or more' is using a reasonable large-sample shortcut for a number this calculator would rather compute exactly.
Sources and review notes
- NIST/SEMATECH e-Handbook of Statistical Methods §1.3.5.6 — measures of scale, including the definitions of variance and standard deviation used here
- NIST/SEMATECH e-Handbook of Statistical Methods — the full handbook, jointly produced by NIST and SEMATECH
- NIST/SEMATECH e-Handbook §1.3.5.2, Confidence Limits for the Mean — the t-based formula behind the 95% confidence interval above
- NIST/SEMATECH e-Handbook §1.3.6.7.2, Critical Values of the Student's t Distribution — the published table this calculator reads its multiplier from
- NIST/SEMATECH Dataplot reference, Coefficient of Variation
- Peltier Tech, “Hinge Techniques for Determining Quartiles” — Tukey's inclusive hinges versus the Moore–McCabe exclusive method
The formulas here are definitional and have no data behind them to go stale. What can go wrong is the arithmetic, which is why the engine behind this page is a pure function under unit test, including a case built specifically to fail if the one-pass shortcut ever creeps back in.