# Mean, Median, Mode and Standard Deviation Calculator - Sample and Population

Page: https://hirantha.me/tools/statistics-calculator
Part of: Hirantha Sandaruwan Lakshan free tools (https://hirantha.me/tools)
Updated: 2026-10-13

Paste a list of numbers to get the mean, median, mode, range, quartiles, and sample and population variance and standard deviation.

This is a free tool that runs in the browser: open the page to use it. File tools process files on the visitor's own device; files are never uploaded or stored. No account, sign-up, payment or watermark.

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. Entries that are not numbers are flagged and left out. The sums use stable arithmetic, and nothing you paste leaves your browser.

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.

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) |

Q: Should I use the sample or the population standard deviation?
A: 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.

Q: What is the difference between mean, median and mode?
A: 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.

Q: What if no number appears more than once?
A: 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.

Q: Why do different tools give different quartiles?
A: 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.

Q: What is the standard error of the mean?
A: 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.

Q: What does the coefficient of variation tell me?
A: 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.

Q: How are outliers found?
A: 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.

Q: How many numbers can I paste?
A: 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: Standard deviation - Wikipedia: population and sample, worked example (https://en.wikipedia.org/wiki/Standard_deviation); Bessel's correction - Wikipedia: why n - 1 (https://en.wikipedia.org/wiki/Bessel%27s_correction); Quartile - Wikipedia: the computing methods and worked examples (https://en.wikipedia.org/wiki/Quartile); R documentation: quantile, type 7 (the default) (https://stat.ethz.ch/R-manual/R-devel/library/stats/html/quantile.html); Microsoft Support: QUARTILE.INC function (https://support.microsoft.com/en-us/office/quartile-inc-function-1bbacc80-5075-42f1-aed6-47d735c4819d); ZetCode: Excel PERCENTILE and QUARTILE, position 1 + (n - 1) × k (https://zetcode.com/excel/percentile-quartile/); Interquartile range - Wikipedia: the 1.5 × IQR outlier rule (https://en.wikipedia.org/wiki/Interquartile_range); Coefficient of variation - Wikipedia (https://en.wikipedia.org/wiki/Coefficient_of_variation); Standard error - Wikipedia (https://en.wikipedia.org/wiki/Standard_error)

Related tools:

- [Fraction calculator](https://hirantha.me/tools/fraction-calculator.md): Add, subtract, multiply and divide fractions and mixed numbers, with the working shown, the answer in lowest terms and as a decimal.
- [Quadratic equation solver](https://hirantha.me/tools/quadratic-equation-solver.md): Solve ax² + bx + c = 0: real or complex roots, discriminant, vertex, axis of symmetry and factored form, with the working shown.
- [Percentage calculator](https://hirantha.me/tools/percentage-calculator.md): Find X% of a number, what percent one number is of another, the whole from a part, or add and subtract a percentage, with the working shown.
- [Exam marks percentage and average calculator](https://hirantha.me/tools/marks-percentage-calculator.md): Add up marks across subjects for the total, overall percentage, average and a grade band you define, plus the mark you need in the last paper.
- [GPA calculator for Sri Lankan universities](https://hirantha.me/tools/gpa-calculator.md): Work out your semester and cumulative GPA from credits and grades, with a grade-point table you can edit to match your university.
