Mean, Median, Mode and Standard Deviation Calculator - Sample and Population
Paste a list of numbers to get the count, sum, mean, median, mode, range, minimum and maximum, quartiles, variance and standard deviation for both a sample and a whole population, the standard error and the coefficient of variation.
Maintained by Hirantha Sandaruwan Lakshan. Updated 13 October 2026.
About this tool
Entries that are not numbers are flagged and left out. The sums use stable arithmetic, and nothing you paste leaves your browser.
How it works
The mean is the sum divided by the count. The median is the middle value of the sorted list, or the average of the two middle values when the count is even. The mode is the value that occurs most often: if no value repeats there is no mode, and if several values tie they are all listed. The range is the largest value minus the smallest.
Quartiles split the sorted list into four parts, and the interquartile range (IQR) is Q3 minus Q1. There is no single agreed method, so you can choose. The default is the textbook one: split the list in half, leave the middle value out of both halves when the count is odd, and take the median of each half. The second keeps the middle value in both halves (Tukey's hinges). The third is linear interpolation, which is what Excel's QUARTILE.INC and R's default (type 7) use: Q1 sits at position (n - 1) / 4 in the sorted list, counting from 0. Values below Q1 - 1.5 × IQR or above Q3 + 1.5 × IQR are listed as possible outliers.
The variance is the average squared distance from the mean. For a whole population you divide the sum of squared distances by n. For a sample you divide by n - 1 (Bessel's correction), which corrects the tendency of a sample to understate the spread of the group it came from. The standard deviation is the square root of the variance. The standard error of the mean is the sample standard deviation divided by the square root of n, and the coefficient of variation is the standard deviation divided by the size of the mean.
The sums use compensated (Neumaier) addition and the variance is computed in two passes, first the mean and then the squared distances from it. That keeps the answer right for lists such as 1000000004, 1000000007, 1000000013, 1000000016, where the one-pass shortcut formula loses the spread to rounding. Plain decimals are added exactly, so 0.1 + 0.2 - 0.3 gives 0 and not a tiny leftover. Results are shown to 12 significant digits with no stray digits like 0.30000000000000004, and the digits of a large whole number are never cut off.
Worked examples
2, 4, 4, 4, 5, 5, 7, 9
The mean is 40 / 8 = 5. The squared distances from the mean add up to 32. The population variance is 32 / 8 = 4, so the population standard deviation is exactly 2. The sample variance is 32 / 7 = 4.5714, so the sample standard deviation is 2.1381 and the standard error is 0.7559.
Eight test marks: 12, 15, 11, 18, 14, 20, 15, 13
The sum is 118, so the mean is 14.75. The median is 14.5, the mode is 15 and the range is 9. The sample standard deviation is 3.0119 and the quartiles (textbook method) are Q1 = 12.5 and Q3 = 16.5.
Why quartile methods differ: 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49
Leaving the median out gives Q1 = 15 and Q3 = 43. Keeping it in gives Q1 = 25.5 and Q3 = 42.5. Linear interpolation also gives 25.5 and 42.5. All three are correct under their own rules, so quote the method you used.
The formulas, worked for 2, 4, 4, 4, 5, 5, 7, 9
| Statistic | Formula | Result for the example |
|---|---|---|
| Mean | sum / n | 40 / 8 = 5 |
| Median | middle value, or the mean of the two middle values | (4 + 5) / 2 = 4.5 |
| Population variance | sum of (x - mean)^2 / n | 32 / 8 = 4 |
| Population standard deviation | square root of the population variance | 2 |
| Sample variance | sum of (x - mean)^2 / (n - 1) | 32 / 7 = 4.5714 |
| Sample standard deviation | square root of the sample variance | 2.1381 |
| Standard error of the mean | sample standard deviation / square root of n | 2.1381 / 2.8284 = 0.7559 |
| Coefficient of variation | standard deviation / mean | 2.1381 / 5 = 42.76% (sample) |
Frequently asked questions
Should I use the sample or the population standard deviation?
Use the population standard deviation (divide by n) when your numbers are the whole group you care about, such as every mark in one class. Use the sample standard deviation (divide by n - 1) when your numbers are a sample drawn from a bigger group and you want to estimate that group's spread.
What is the difference between mean, median and mode?
The mean is the average, the median is the middle value once the list is sorted, and the mode is the most common value. A few very large values pull the mean up but barely move the median, which is why the median is often used for incomes and prices.
What if no number appears more than once?
Then there is no mode, and the calculator says so. If two or more values tie for most frequent, they are all listed as modes.
Why do different tools give different quartiles?
There are several accepted ways to find a quartile, and they differ in how they treat the middle value and whether they interpolate. For 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49 the first quartile is 15 by one method and 25.5 by another. Pick the method your course or software uses; here you can choose among three.
What is the standard error of the mean?
It estimates how far the sample mean is likely to be from the true mean of the group: the sample standard deviation divided by the square root of the number of values. It shrinks as the sample gets bigger.
What does the coefficient of variation tell me?
It is the standard deviation as a share of the mean, shown as a percentage, so you can compare the spread of lists measured in different units or sizes. It is only meaningful for values on a scale with a true zero, and it is not defined when the mean is 0.
How are outliers found?
A common rule flags any value below Q1 - 1.5 × IQR or above Q3 + 1.5 × IQR, the same fences a box plot uses. It marks values worth a second look, not values to delete.
How many numbers can I paste?
Up to 100,000. Separate them with commas, spaces, semicolons or new lines. Anything that is not a number, such as text or a number with a stray character, is reported and left out of the results.
Sources & references
- Standard deviation - Wikipedia: population and sample, worked example
- Bessel's correction - Wikipedia: why n - 1
- Quartile - Wikipedia: the computing methods and worked examples
- R documentation: quantile, type 7 (the default)
- Microsoft Support: QUARTILE.INC function
- ZetCode: Excel PERCENTILE and QUARTILE, position 1 + (n - 1) × k
- Interquartile range - Wikipedia: the 1.5 × IQR outlier rule
- Coefficient of variation - Wikipedia
- Standard error - Wikipedia
Updated Oct 13, 2026