Statistics
Standard deviation calculator for large datasets
Paste a whole column from a spreadsheet, a QC log or an analytics export: thousands of values, one per line or separated by commas. The standard deviation is computed in your browser with a numerically stable method, and nothing is uploaded.
Separate numbers with commas, spaces or new lines, or paste a spreadsheet column.
Decimals and negatives are fine; write 10:3 for a value that occurs 3 times.
Your results will appear here: the standard deviation first, then the rest of the summary and a chart.
Standard deviation (sample)
0.998178
Your values typically sit about 0.998 above or below their mean of 500.5, in the same units as your data. 16 of 24 values (67%) fall between 499.5 and 501.5, within one standard deviation of the mean; for normally distributed data about 68% would.
Population SD (σ): 0.977161, if these values are the whole group.
- Count (n)
- 24
- Mean (x̄)
- 500.463
- Variance (s²)
- 0.996359
- Standard error
- 0.203752
- Minimum
- 498.6
- Q1 (25%)
- 499.875
- Median
- 500.45
- Q3 (75%)
- 501.025
- Maximum
- 502.6
- Range
- 4
More statistics (5)
- Relative SD (%RSD)
- 0.199451%
- Coefficient of variation
- 0.00199451
- Sum (Σx)
- 12011.1
- Sum of squares, Σ(x − x̄)²
- 22.9163
- IQR (Q3 − Q1)
- 1.15
Data distribution
Shaded bands mark ±1, ±2 and ±3 SD from the mean. 16 of 24 values (67%) fall within ±1 SD.
Chart as text
Mean 500.463, sample standard deviation s = 0.998178, from 24 values between 498.6 and 502.6.
- Within ±1 SD (499.5 to 501.5): 16 of 24 values (67%). About 68% for normal data.
- Within ±2 SD: 23 (96%). About 95% for normal data.
- Within ±3 SD: 24 (100%). About 99.7% for normal data.
Show the working, step by step
What changes when the dataset is large
The formula is the same for 24 values or 24,000. What changes is where things go wrong:
- Rounding error. Summing many large, similar numbers can lose precision, depending on how it is done (below).
- Bad rows. In a big export, a few unit strings, blanks or error codes are easy to miss. The calculator skips anything that is not a number and tells you how many entries it skipped. Check that count.
- Outliers. One sensor glitch recorded as 99999 barely moves the median of 20,000 readings, but it can double the standard deviation.
- Sample vs population. This choice matters less the bigger n gets.
A worked example
The default data is 24 fill weights in grams, taken from a longer production log. The same steps apply to a longer column:
- Sum = 12,011.1 over n = 24, so the mean is 500.4625 g.
- The squared deviations add up to Σ(x − x̄)² = 22.91625.
- As a sample, divide by n − 1 = 23: s² = 0.996359.
- s = √0.996359 = 0.998178 g.
The population figure, dividing by 24, is σ = 0.977161 g. The standard error of the mean is 0.998178 ÷ √24 = 0.203752 g. The spread of individual fills is five times larger than the uncertainty in their average.
Why the shortcut formula fails on real data
Textbooks often give a "computational" formula that needs only two running totals:
s² = (Σx² − (Σx)² ÷ n) ÷ (n − 1)
It is exact in algebra and unreliable on a computer. When the values are large and close together, Σx² and (Σx)² ÷ n are two huge, nearly equal numbers. Subtracting them wipes out most of the significant digits. Take four timestamps or IDs near one billion:
1,000,000,004 1,000,000,007 1,000,000,013 1,000,000,016
Their deviations from the mean are −6, −3, 3 and 6, so the sample variance is exactly 90 ÷ 3 = 30 and s = 5.47723. The shortcut formula, run in ordinary double-precision arithmetic, returns a variance of −170.667. That is negative, which is impossible, and the square root fails. Spreadsheets and hand-written code that use this formula produce wrong answers in exactly this situation.
This calculator uses Welford's algorithm instead. It updates the mean and the sum of squared deviations one value at a time and never forms the two huge totals. On the four values above it returns 30 exactly. The methodology page gives the update rule.
Sample or population at large n
The two standard deviations differ by a fixed factor:
s ÷ σ = √(n ÷ (n − 1))
| n | s is larger than σ by |
|---|---|
| 5 | 11.8% |
| 30 | 1.7% |
| 100 | 0.50% |
| 1,000 | 0.050% |
| 10,000 | 0.005% |
Report whichever one matches the data. Use the sample SD for a sample from an ongoing process, and the population SD for a complete census. For large n the choice barely changes the number. See sample vs population for how to decide.
When a few values dominate the result
The standard deviation squares each deviation, so a value 100 SDs out contributes 10,000 times as much as a typical one. In a large export, a few corrupt rows can therefore account for most of the SD. Before reporting it:
- Look at the minimum and maximum in the results. Values that are physically impossible are data errors, not outliers.
- Open the working and look at the flagged z-scores (it lists the first 200 values).
- Run the column through the outlier calculator, which uses the quartiles. Quartiles are not distorted by the values they are trying to find.
- Compare the SD with the IQR. For roughly normal data the IQR is about 1.35 SD. An SD far larger than that points to heavy tails or a few extreme rows.
Beyond what a browser box should hold
For hundreds of thousands of rows, or a calculation you repeat every week, use code. It reads the file directly and leaves an audit trail:
| Tool | Sample SD |
|---|---|
| pandas | df['value'].std() |
| NumPy | np.std(x, ddof=1) |
| R | sd(x, na.rm = TRUE) |
| SQL (PostgreSQL) | SELECT stddev_samp(value) FROM t; |
| Excel | =STDEV.S(A:A) |
Related calculators
-
CSV data
Read one column out of pasted CSV or spreadsheet rows.
-
Descriptive statistics
Skewness, kurtosis, quartiles and a CI for a whole export at once.
-
Histogram maker
See the shape of thousands of values before you summarise them.
-
Outliers & IQR
Find the handful of values that are driving a large SD.
Common questions
How many values can I paste?
Tens of thousands. On a recent laptop, reading and summarising 50,000 values takes a few
hundredths of a second; the text box itself is the slow part, because the browser has to
lay out that much text. Beyond about 100,000 values, compute in code instead: pandas, R or
a spreadsheet will handle millions of rows. The value:count shorthand also
stops expanding at 100,000 values in total.
Is my data uploaded anywhere?
No. The calculation runs in your browser, and the numbers you paste are not sent to a server. That matters for large exports, which often hold production or patient data. The methodology page gives the details.
Does sample or population matter for a large dataset?
Less and less as n grows. The two differ by a factor of √(n ÷ (n − 1)): 1.7% at n = 30, 0.05% at n = 1,000 and 0.005% at n = 10,000. Pick the one that matches what the data represents, but at this scale the choice will not change a conclusion.
Why does my spreadsheet give a slightly different standard deviation?
Most often because it counted different cells: a blank read as zero, a text cell dropped, or a filtered-out row still included. Compare the count first. If the counts match and the difference is only in the last few digits, it is floating-point rounding. This calculator uses Welford's method, which keeps that rounding small.
Why is the step-by-step table cut off?
The working lists each value's deviation and z-score for the first 200 values only. A 50,000-row table would make the page unusable. Every value is still used in the result; the note under the table says how many were left out of the display.