Sample or population: the one thing this page will not decide for you
Nearly everyone who looks up a standard deviation calculator arrives with the same unresolved question, and most tools make it worse by demanding an answer up front. A dropdown labelled "sample or population?" before you have seen a single number is a request to guess. So this page computes both, always, and puts them next to each other.
The distinction is not mathematical subtlety; it is about what your numbers are for. Write down the sentence you want to end up saying. If it is "the marks in this class varied by about 9 points", and the class is all 28 students and you are making no claim beyond the room, then your numbers are the population. Divide by n. The answer is exact, not an estimate, because there is nothing left unmeasured.
If the sentence is "reaction times in this task vary by about 40 milliseconds" and you tested 30 volunteers as a stand-in for people in general, your numbers are a sample. Divide by n − 1. You are not describing those 30 people; you are estimating a quantity about a group you will never fully measure.
That is why every statistics package defaults to the sample version. Excel's
STDEV.S, Google Sheets' STDEV, R's sd() and
Python's statistics.stdev all use n − 1. The population variants exist —
STDEV.P, numpy.std with its default ddof=0 — and
the gap between the two is the single most common reason two people get different
answers from the same data.
Why n − 1, in plain language
The correction has a name — Bessel's correction — and a reputation for being explained badly. Here is the version that actually explains something.
To measure spread you need a centre to measure from. The honest centre is the true population mean, and you do not have it. So you use the sample mean instead — and the sample mean is, by construction, the point that sits closest to your particular numbers. It was computed from them. Any other centre, including the real one, would give a larger total of squared distances.
So every sample understates its own spread, a little, by measuring from a centre that has already been tuned to fit it. Not sometimes: on average, every time. Dividing by n would bake that shortfall into the answer. Dividing by n − 1 inflates the result by exactly the amount needed to cancel it, so that across repeated samples the estimate is right on average rather than consistently a shade low.
The n − 1 is the degrees of freedom, and it is a counting fact. The deviations from the mean must add to zero. So if you know the mean and any n − 1 of the values, the last one is already determined — it has no freedom left. You have n numbers but only n − 1 independent pieces of information about spread. The denominator counts information, not data points.
How much does it matter? The ratio between the two answers is √(n / (n − 1)), which the calculator above shows for your data.
| n | s ÷ σ | Practical effect |
|---|---|---|
| 3 | 1.225 | 22% apart — picking wrong changes the conclusion |
| 10 | 1.054 | 5% apart — still visible in a report |
| 30 | 1.017 | Under 2% — rarely decisive |
| 100 | 1.005 | Half a percent — noise by comparison |
| 1,000 | 1.0005 | Invisible |
The lesson is that the choice matters most exactly when people care least about it: on small datasets. With twelve measurements the two answers can differ by more than the effect you were trying to detect.
The calculation, written out
The tool prints these steps with your own numbers in them, because that is usually the reason for looking a standard deviation up in the first place — the working has to be shown, not just the result.
- Count and add. Find n and the sum of all values.
- Mean. x̄ = Σx ÷ n.
- Deviations. Subtract the mean from every value. Some will be negative; that is the point of the next step.
- Square each one. Squaring removes the signs — otherwise the deviations would cancel to exactly zero every time — and it penalises far-away points more than near ones.
- Add the squares. This total is the sum of squared deviations.
- Divide. By n − 1 for a sample, by n for a population. This is the variance, and it is the only step where the two versions differ at all.
- Square root. The variance is in squared units — squared marks, squared milliseconds — which nobody can interpret. The square root brings the number back to the units of the original data, and that is the standard deviation.
Standard deviation is not standard error
This is the mix-up that changes conclusions, and it is extremely common in published charts. The two quantities are related by one square root and they answer completely different questions.
Standard deviation describes the data: how far individual observations sit from the mean. If patient recovery times have a standard deviation of 6 days, patients genuinely differ by roughly that much.
Standard error of the mean describes the estimate: how much the average itself would jump around if you repeated the entire study with a fresh group. It equals s ÷ √n.
The tell is what happens as you collect more data. The standard deviation converges on the real spread of the population and then stays there — measuring more people does not make people more alike. The standard error keeps shrinking toward zero, because a mean computed from more observations is pinned down more tightly.
So error bars drawn with the standard error look far tighter than error bars drawn with the standard deviation — by a factor of 4 at n = 16, and a factor of 10 at n = 100 — and a figure that does not say which one it used cannot be read. If the question is "how variable is this thing?", the standard deviation is the answer. If it is "how confident am I about this average?", it is the standard error.
Why the mean alone misleads
A mean with no measure of spread beside it is one of the most reliably misleading numbers in circulation. Two datasets:
| Set | Values | Mean | Sample s |
|---|---|---|---|
| A | 49, 50, 50, 51, 50 | 50 | 0.71 |
| B | 10, 90, 50, 5, 95 | 50 | 41.8 |
Identical averages; utterly different situations. If those are delivery times, set A is a process you can promise a customer and set B is a coin flip. The mean cannot tell them apart, and neither can any headline built on one.
Spread also decides whether a difference means anything. Two groups whose averages differ by 3 points are worth talking about if the standard deviation is 2, and are indistinguishable if it is 30. Every significance test ever built is, underneath, a comparison of a difference against a spread. Report the mean without it and you have withheld the half of the summary that carries the judgement.
One caution in the other direction: the standard deviation is itself sensitive to outliers, because the deviations get squared. A single mistyped value — 1000 instead of 100 — can double it. That is why the calculator also gives the median and the interquartile range, which barely move when one point goes wild. If the mean and median are far apart, or if s is enormous next to the IQR, look at your extreme values before trusting either number.
Quartiles, the IQR, and why two tools disagree
Quartiles look like they ought to be unambiguous and are not. There are at least nine published definitions, and they give different answers on the same small dataset. It is not that eight of them are wrong; they are different conventions for where to place a cut when it falls between two observations.
This calculator uses linear interpolation at position 1 + p(n − 1) —
Hyndman and Fan's type 7. It is the default in NumPy and in R's quantile(),
it is what Google Sheets does, and it matches Excel's QUARTILE.INC. The
choice is deliberate: it is the method most likely to agree with the spreadsheet the
numbers were pasted from. Excel's QUARTILE.EXC uses p(n + 1) instead and
will give you slightly different quartiles; so will the hinges method taught in many
introductory courses.
The interquartile range, Q3 − Q1, is the width of the middle half of the data. It is the natural companion to the median: both ignore the extremes entirely, so a single wild value cannot move them. Where the standard deviation is the right summary for roughly symmetric data, the median and IQR are the right summary for skewed data — incomes, response times, anything with a long tail on one side.
Reading the number: is a standard deviation of 12 big?
On its own, unanswerable — 12 what, around what centre? Three ways to give it meaning:
- Against the mean. The coefficient of variation is s ÷ mean, expressed as a percentage. A standard deviation of 12 around a mean of 20 is chaos; around a mean of 2,000 it is precision. The calculator reports it whenever the mean is not zero.
- Against the range. For data with no strong skew, nearly everything falls inside about six standard deviations from end to end. If yours does not, the data is probably skewed or has outliers.
- Using the 68–95–99.7 rule. For an approximately normal distribution, roughly 68% of values lie within one standard deviation of the mean, 95% within two and 99.7% within three. That is a useful sanity check, but only for bell-shaped data — for strongly skewed distributions it fails badly, and for reliably heavy-tailed things like financial returns it fails in the direction that hurts, understating how often extreme values happen.
Messy input, and why the skipped count is shown
Data pasted from the real world arrives with a header row, a blank line, a stray
n/a and a currency symbol. There are two bad ways to react. Rejecting
everything with "invalid input" tells the user nothing about what to fix. Quietly turning
unparseable entries into zeros is worse: it drags the mean down, inflates the spread, and
produces a plausible-looking number that is wrong.
So the tool skips what it cannot read, counts it, and shows it back. If you paste 40 rows and it says 38 values with 2 ignored, you know immediately whether that was the header and a blank line or two real measurements you need to fix. Values may be separated by commas, spaces, tabs, semicolons or line breaks, in any combination. Decimal commas are detected — a column of 1,5 / 2,5 / 3,5 is read as decimals, while 1, 2, 3 is read as three values — and there is a manual override for the cases where that guess is genuinely ambiguous.
A note on numerical accuracy
The obvious way to program a variance is the one-pass shortcut: accumulate the sum and the sum of squares, then compute the mean of the squares minus the square of the mean. It is compact, and on some data it fails catastrophically. Feed it 10000000.1, 10000000.2 and 10000000.3 and the two terms are both around 1014, differing only in the last digit a 64-bit float can hold. The subtraction throws away every significant figure and returns zero, or a negative variance whose square root is not a number at all.
This page uses the corrected two-pass method instead: compute the mean first, then sum the squared deviations, which stay small and well behaved no matter how large the inputs are, with a correction term for the rounding error in the mean itself. The arithmetic lives in a separate module with a test suite that checks that exact case, along with hand-verified standard deviations, quartiles and parsing.
Privacy
Everything happens in this tab. The list you paste is never transmitted, never stored and never logged; there is no account and no upload step. That matters more than it sounds for a statistics tool, because the numbers people paste into one are frequently unpublished measurements, salary figures or clinical readings.
Frequently asked questions
Should I use the sample or the population standard deviation?
Ask what your numbers are supposed to describe. If they are the entire group you care about — the exam scores of all 28 students in this class, and you are only talking about this class — the population formula, dividing by n, is exact. If they are a subset you measured in order to say something about a larger group you did not measure, use the sample formula with n − 1. Almost all real-world data is a sample, which is why spreadsheets default to it: Excel's STDEV.S, Google Sheets' STDEV, R's sd() and Python's statistics.stdev all divide by n − 1. This page shows both at once so you never have to guess before seeing the numbers.
Why divide by n − 1 instead of n?
Because the mean you subtract is estimated from the same data, and it sits closer to your particular numbers than the true population mean does. Squared distances measured from your sample mean are therefore systematically a little too small, and dividing by n would carry that shortfall into the answer. Dividing by n − 1 inflates the result by exactly the right amount so the variance is unbiased on average across repeated samples. The n − 1 is called the degrees of freedom: once you know the mean and any n − 1 of the values, the last one is fixed, so only n − 1 of the deviations are free to vary.
What is the difference between standard deviation and standard error?
Standard deviation describes how spread out the individual data points are. Standard error of the mean describes how much the average itself would wobble if you repeated the whole study, and it equals s divided by the square root of n. They answer different questions and only one of them shrinks as you collect more data: the standard deviation converges on the true spread and stays there, while the standard error keeps falling toward zero. Reporting a standard error when you meant to describe variability makes your data look four times tighter at n = 16 than it really is.
Which quartile method does this calculator use?
Linear interpolation at position 1 + p(n − 1), also known as Hyndman and Fan type 7. It is the default in NumPy, in R's quantile(), in Google Sheets, and it matches Excel's QUARTILE.INC. Other defensible methods exist — Excel's QUARTILE.EXC, Tukey's hinges, Minitab's convention — and they produce different quartiles on the same data. That is a difference of definition, not a mistake by any of them, so the number here is stated with its method attached.
Can it handle a column pasted from a spreadsheet?
Yes. Values may be separated by commas, spaces, tabs, semicolons or line breaks, in any mix, which covers pasting a column out of Excel, Google Sheets or a CSV. Decimal commas are detected too, so 1,5 and 1.5 both work. Anything that is not a number — a header row, a currency label, a stray n/a — is skipped, counted, and shown back to you, so you always know how many entries were left out instead of silently getting them treated as zeros.
Is my data uploaded anywhere?
No. The parsing and the arithmetic run in your browser tab. Nothing is sent to a server, nothing is stored, and there is no account — which matters when the numbers you are pasting are lab measurements, salaries or unpublished results.