Skip to content
thecalculatorstudio

Statistics Calculator: Mean, Median, Mode and Standard Deviation

Enter your numbers, separated by commas, spaces or new lines. You will see the main summary statistics, worked out exactly, with the working explained below.

Last reviewed

Separate with commas, spaces or new lines, up to 5,000 numbers. Leave out thousands separators.

Mean

5

of 8 numbers, sum 40

Median
4.5
Mode
4 (3 times)
Range
7 (2 to 9)
Sample standard deviation
2.138089935
Population standard deviation
2
Sample variance
4.571428571
Population variance
4
Standard error of the mean
0.755928946
Quartiles by three common methods
MethodQ1Q3IQR
Median of the halves462
Inclusive (Excel QUARTILE.INC)45.51.5
NIST (Excel QUARTILE.EXC)46.52.5

Use the sample figures when your numbers are a sample of something larger, and the population figures when they are all of it.

What the numbers tell you

A list of numbers is hard to read as it is. Summary statistics boil it down to a few figures that answer different questions: where the middle is, how spread out the values are, and what is typical or unusual. This page works out the ones people ask for, from any list you paste in.

The sums are done in exact decimal arithmetic. A list such as 0.1, 0.2 and 0.3 adds up to exactly 0.6, with a mean of exactly 0.2, rather than 0.6000000000000001.

A worked example

Take the numbers 2, 4, 4, 4, 5, 5, 7, 9.

Statistic Value How
Count 8 how many numbers
Sum 40 add them up
Mean 5 40 ÷ 8
Median 4.5 the average of the middle pair, 4 and 5
Mode 4 it appears three times
Range 7 9 − 2
Population variance 4 the mean of the squared distances from 5
Population standard deviation 2 the square root of 4
Sample variance 4.5714 32 ÷ 7
Sample standard deviation 2.1381 the square root of 4.5714

The squared distances from the mean are 9, 1, 1, 1, 0, 0, 4 and 16, which add up to 32. Dividing by 8 gives the population variance, 4. Dividing by 7 gives the sample variance.

Mean, median and mode

  • The mean is the sum divided by the count. Every value counts, so one very large number can drag it.
  • The median is the middle value of the ordered list, or the mean of the two middle values when there is an even number of them. It ignores how far out the extremes are, which makes it steadier than the mean when a few values are unusual. NIST notes that data in the tails have less influence on the median than on the mean.
  • The mode is the most common value. A list can have no mode (nothing repeats) or several (a tie).

Variance and standard deviation

The variance measures spread by averaging the squared distance of each value from the mean. The standard deviation is its square root, which puts it back in the same units as the data.

The NIST handbook defines the standard deviation of a sample as the square root of the sum of squared deviations from the mean divided by N − 1. There are two versions, and the choice matters:

  • Population: divide by N. Use it when your numbers are the whole group, for example every score in a class.
  • Sample: divide by N − 1. Use it when your numbers are a sample drawn from a larger group, and you want to estimate the spread of the group. Dividing by N would tend to understate it.

For a large list the two are very close. For a small one, as in the example, they differ by an eighth. With a single number there is no sample variance at all, because there is no spread to estimate, and the calculator says so.

The standard error of the mean is the sample standard deviation divided by the square root of N. It describes how precisely the mean is known, and it shrinks as the list grows.

Quartiles: three answers

Quartiles split the ordered list into four parts. The first quartile (Q1) has a quarter of the values below it, and the third (Q3) three quarters. The distance between them is the interquartile range, a measure of spread that outliers do not affect much.

The catch is that there is no single method. NIST says there is no standard, universally accepted way of interpolating percentiles, and that several methods are in use. So the calculator shows three.

For the numbers 1 to 8:

Method Q1 Q3
Median of the halves 2.5 6.5
Inclusive (Excel’s QUARTILE.INC, and the default in R and NumPy) 2.75 6.25
NIST (position p × (N + 1), Excel’s QUARTILE.EXC) 2.25 6.75
  • Median of the halves. Split the list into a lower and an upper half, leaving out the middle value if there is an odd number, and take the median of each. It is the method in many textbooks.
  • Inclusive. Interpolate at position (N − 1) × p + 1.
  • NIST. Interpolate at position p × (N + 1). For the 90th percentile of twelve measurements, NIST works out p(N + 1) = 0.9 × 13 = 11.7, so the answer lies 0.7 of the way from the 11th value to the 12th.

Use the one your course, your software or your organisation specifies. If you are comparing with a spreadsheet, check which function it uses.

Outliers

A common test flags a value as a possible outlier if it is more than 1.5 interquartile ranges below Q1 or above Q3. In 10, 10, 11, 12, 12, 12, 13, 13, 14, 15, 100, the quartiles by the halves method are 11 and 14, so the interquartile range is 3 and the fences are 6.5 and 18.5. The value 100 is outside, and the calculator flags it.

An outlier is not necessarily a mistake. It may be an error to correct, or it may be the most interesting number in the list. The mean and standard deviation are sensitive to it, and the median and interquartile range are not, so look at both.

Entering your data

  • Separate numbers with commas, spaces, semicolons or new lines, in any mix.
  • Use a decimal point, not a comma, for decimals.
  • Leave out thousands separators. A number such as 1,000 could be one thousand or the two numbers 1 and 0, so the calculator asks you to rewrite it, or to put a space after each comma between numbers.
  • Negative numbers and scientific notation such as 1e3 are fine.

Common mistakes

  • Using the population formula on a sample. The spread comes out too small.
  • Reporting a mean without a spread. The mean of 4 and 6 and the mean of 0 and 10 are both 5.
  • Using the mean for skewed data. Incomes, prices and waiting times often have a few very large values. The median says more about a typical case.
  • Comparing quartiles from different software. They may use different methods.

For percentages, see the percentage calculator. For yearly investment returns, where the average is more subtle, see the average return calculator. For lists that follow a rule, the number sequence calculator.

How it is calculated

The numbers are read as exact decimals and sorted. The mean is the sum over the count. The variance is the sum of squared deviations from the mean, over N or N − 1, and the standard deviation is its square root, to 50 digits. The median and the three kinds of quartile are found from the sorted list as described above. Results are shown to 15 significant figures.

Frequently asked questions

What is the difference between sample and population standard deviation?

The population figure divides the sum of squared deviations by N, and the sample figure divides by N − 1. Use the sample figure when your numbers are a sample of a larger group, and the population figure when they are all of it. For 2, 4, 4, 4, 5, 5, 7, 9 the population standard deviation is exactly 2 and the sample figure is 2.138.

Why divide by N − 1?

NIST describes the sample standard deviation as an estimate of the population standard deviation with N − 1 degrees of freedom. Dividing by N would, on average, give a figure that is too small when the numbers are a sample.

What is the mean, median and mode?

The mean is the sum divided by the count, the median is the middle value once the numbers are in order, and the mode is the most common value. For 2, 4, 4, 4, 5, 5, 7, 9 they are 5, 4.5 and 4.

Why are there three sets of quartiles?

Because there is no single agreed method. NIST says there is no standard universally accepted way to interpolate percentiles, and that several methods are used in practice. For 1 to 8 they give a first quartile of 2.5, 2.75 or 2.25. Check which one your course or software uses.

What if my list has no mode?

If no value repeats, there is no mode and the calculator says so. If two or more values tie for most common, all of them are listed.

Can I paste numbers with thousands separators?

No. A number like 1,000 could be one thousand or the two numbers 1 and 0, so the calculator asks you to remove the separator, or to put a space after each comma between numbers.

Related calculators

Sources