Statistics & Probability Averages, Variance & Dispersion Descriptive statistics (measures of central tendency)

Mean, Median, Mode and Range Calculator

Paste a list of numbers and this calculator returns the four summary figures every statistics course starts with: the mean, the median, the mode and the range. It sorts the data for you, shows the arithmetic behind each answer, and builds a frequency table so you can see which values repeat. If your data already arrives as a frequency table, enter the distinct values in one box and their counts in the other and the calculator expands them before summarising.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Data valuesSeparate numbers with commas, spaces or line breaks. Negative values and decimals are fine.12, 15, 11, 18, 15, 14, 20, 15, 13, 17
Frequencies (optional)Leave blank for raw data. Otherwise enter one whole-number count per value, in the same order.

It returns

  • Mean (arithmetic average) — The sum of every observation divided by how many there are.
  • Median
  • Mode
  • Frequency of the most common value
  • Range (max - min)
  • Count n
  • Sum of values

The formula

x¯=i=1nxin
median=x(n+12)

In plain text: mean = (sum of x) / n; median = middle value of the sorted data; range = max - min

  • x-barArithmetic mean of the sample (same as the data)
  • x_iThe i-th observation (same as the data)
  • nNumber of observations (count)

The median is the value at sorted position (n+1)/2 when n is odd, and the mean of the values at positions n/2 and n/2+1 when n is even. The mode is the value with the highest frequency; a data set can have none, one, or several.

Updated Category Averages, Variance & Dispersion Verified against published test cases Reading time 11 min

What the mean, median, mode and range each tell you

These four numbers answer four different questions about the same list, and confusing them is the most common mistake in introductory statistics.

The mean is the balance point. Add every observation and divide by how many there are, and you get the value each observation would take if the total were shared out equally. It uses every number in the set, which makes it efficient when the data are roughly symmetric and ruinous when they are not: one salary of $2 million in a list of ten teachers moves the mean far more than it moves anything you would recognise as typical.

The median is the middle. Sort the data and take the value that splits it in half. It cares only about the order of the observations, not their magnitude, so it barely notices that one $2 million salary. That resistance is why house prices, incomes and response times are almost always reported as medians.

The mode is the most frequent value. It is the only one of the three that works on categories as well as numbers, and the only one that survives when the data are labels rather than measurements. A set can have no mode, one mode, or several.

The range is the crudest measure of spread: the largest value minus the smallest. It is built from exactly two observations, so it throws away the middle of the data and grows almost automatically as the sample gets bigger. Use it as a quick sanity check, then reach for the standard deviation or the interquartile range for anything serious.

The formulas, and why the median needs two cases

The mean is a single expression: add the observations and divide by the count. Written formally, x-bar = (sum of xi) / n. Nothing about it depends on the order of the data, which is why you can compute it on an unsorted list.

The median cannot be written that way, because "the middle" is only well defined when there is an odd number of values. Sort the data first, then apply one of two rules:

  • n odd: the median is the value at position (n + 1) / 2. With nine observations that is position 5, with 4 below it and 4 above.
  • n even: there is no single middle, so the median is the average of the values at positions n/2 and n/2 + 1. With eight observations that is the mean of the 4th and 5th values.

The convention for even n is a choice, not a derivation. It is the choice every statistics package makes, and it has the useful property that the median stays inside the data's range and moves smoothly as an observation crosses the middle.

The mode is defined by counting. Build a frequency table, find the largest count, and report every value that achieves it. When the largest count is 1, no value repeats and the data set has no mode. When every distinct value shares the same count, there is likewise no mode, because nothing stands out.

If your data arrive as a frequency table, the mean has a weighted form: multiply each distinct value by its frequency, add those products, and divide by the total frequency. That is the same calculation as this page's weighted average calculator performs with the frequencies acting as weights.

Worked example: eight exam scores

A tutor records eight scores: 2, 4, 4, 4, 5, 5, 7, 9. Work through it on paper.

  1. Sort the data. It is already ascending: 2, 4, 4, 4, 5, 5, 7, 9. Sorting is essential for the median and the mode, and harmless for the mean.
  2. Add the values. 2 + 4 + 4 + 4 + 5 + 5 + 7 + 9 = 40.
  3. Divide by the count. n = 8, so the mean is 40 / 8 = 5.0.
  4. Locate the median. n is even, so average the 4th and 5th sorted values: (4 + 5) / 2 = 4.5.
  5. Count the frequencies. 2 appears once, 4 appears three times, 5 twice, 7 once, 9 once. The largest count is 3, so the mode is 4.
  6. Subtract the extremes. 9 - 2 = 7, the range.

Read the three centres together. The mode (4) sits below the median (4.5), which sits below the mean (5.0). That ordering is the classic fingerprint of a right-skewed set: most scores bunch at the low end and the single 9 pulls the mean up. If you reported only the mean, you would describe a typical student as scoring 5 when in fact more students scored 4 than any other value.

Now suppose the 9 was a transcription error and the score was really 90. The median stays at 4.5 and the mode stays at 4, but the mean jumps to (40 - 9 + 90) / 8 = 121 / 8 = 15.125 - above every observation except one. That single substitution is the whole argument for reporting a median alongside a mean.

How to read the three centres against each other

Compare the mean with the median before you quote either. Their relationship is a free diagnostic of shape.

When the mean and the median are close, the data are roughly symmetric and the mean is the better summary: it uses every observation, it is what almost every downstream statistical method assumes, and it is the quantity a z-score is measured from.

When the mean sits well above the median, the data have a long right tail: a few large values are dragging the average up. Incomes, insurance claims, page-load times and repair costs behave this way. When the mean sits well below the median, the tail runs left instead, which happens with scores near a ceiling, such as exam marks out of 100 where most students pass comfortably and a few fail badly.

There is no universal cut-off for "well above". A practical rule used on this page's warnings is to flag a gap of more than a quarter of the range, which is deliberately loose - it is a prompt to look at the sorted list, not a verdict. The formal measures of shape are skewness and the 1.5 x IQR outlier fences, and either is a better basis for a decision than the mean-median gap alone.

Treat the mode with more caution than a first course usually suggests. On continuous measurements - weights, times, prices to the cent - exact repeats are largely an artefact of rounding, so the mode of a rounded data set often reflects the rounding rule rather than the underlying distribution. The mode earns its keep on discrete counts, on Likert scales, and on categorical data where no other average exists.

Which average to report, by data type

Choosing a measure of centre. Where more than one is valid, the first listed is the usual default.
DataExampleBest centreWhy
Symmetric measurementsAdult heights, machined part diametersMeanUses every observation and feeds directly into the standard deviation and confidence intervals
Right-skewed measurementsHousehold income, API response timesMedianUnaffected by the size of the largest values, only by their count
Data with suspected errorsHand-entered lab readingsMedianA single mistyped digit cannot move it beyond the neighbouring observation
Ordered categoriesLikert scale 1 to 5Median or modeThe spacing between categories is not known to be equal, so a mean is hard to defend
Unordered categoriesBlood type, browser choiceModeThe only average defined when the values cannot be ranked or added
Rates and ratiosSpeeds over equal distancesHarmonic or geometric meanThe arithmetic mean of ratios answers a different question from the one usually asked

The last row is a genuine trap: averaging 30 mph out and 60 mph back gives 45 mph arithmetically, but the average speed over the round trip is 40 mph.

Mistakes that change the answer

  • Computing the median without sorting. The median is a position in the sorted list, not a position in the list as typed. Every other measure here is order-independent, which is exactly why this error survives.
  • Using the wrong rule for even n. Taking the lower of the two middle values instead of their average gives a different answer and will not match Excel, R or your textbook.
  • Reporting a mode that is an artefact. If your measurements are rounded to the nearest whole number, repeats are manufactured by the rounding. Check whether the mode survives at finer precision before you quote it.
  • Averaging averages. The mean of three class averages is not the school average unless the classes are the same size. Weight each class mean by its class size instead.
  • Letting the range stand in for spread. The range uses two observations and ignores the rest, and it can only grow as you collect more data. Two data sets with the same range can have wildly different concentrations.
  • Treating a bimodal set as having one centre. Two clear peaks usually mean two populations have been mixed. Split them before you summarise, or you will describe a group that nobody in the data belongs to.

Where these fit among the other summaries

Centre is only half of a description. A data set is characterised by centre, spread and shape, and the mean on its own is compatible with almost any spread. Pair it with the standard deviation when the data are roughly symmetric, and with the interquartile range when they are skewed or contain outliers - a median with an IQR is a matched pair in a way that a median with a standard deviation is not.

Once you have a mean and a standard deviation you can standardise any observation into a z-score and, if the distribution is approximately normal, convert it to a percentile. For arbitrary cut-points on the raw data rather than on a fitted curve, the percentile calculator interpolates directly between sorted observations.

The mean here is the arithmetic mean, which is one of several. The geometric mean, the n-th root of the product of n values, is the right average for growth rates and index numbers. The harmonic mean, n divided by the sum of the reciprocals, is the right average for rates measured over a fixed distance or quantity. Both are always less than or equal to the arithmetic mean for positive data, with equality only when every value is identical.

Finally, remember what a summary is for. These four numbers exist to compress a list into something you can hold in your head and compare against another list. They are not a substitute for looking at the data. Sort it, plot it, and check the extremes before you trust any single figure.

Frequently asked questions

What do I do when there is an even number of values?

Average the two middle values of the sorted list. With ten observations, sort them and take the mean of the 5th and 6th. That average is the median even if it is not itself one of the observations, which is normal: the median of 4 and 5 is 4.5 whether or not 4.5 appears in the data.

Can a data set have more than one mode?

Yes. If two or more values tie for the highest frequency, all of them are modes and the set is bimodal or multimodal. This calculator lists every tied value. Two well-separated modes usually mean two different populations have been combined, so consider splitting the data before summarising it.

What if no value repeats?

Then the set has no mode, and this calculator says so rather than inventing one. Reporting "every value is a mode" is a defensible convention in some textbooks but it carries no information, so a plain statement that the data contain no repeats is more useful.

Should I report the mean or the median?

Report the median when the data are skewed or contain extreme values, and the mean when they are roughly symmetric. If you are unsure, report both - the gap between them is itself informative, and hiding it looks like a choice made to flatter the result. Any measure of centre should be quoted alongside a measure of spread.

How do I use the frequency boxes?

Put the distinct values in the first box and their counts in the second, in the same order and the same length. Values 1, 2, 3 with frequencies 1, 2, 3 expand to the six observations 1, 2, 2, 3, 3, 3. Leave the frequency box blank for ordinary raw data. Frequencies must be whole numbers of at least 1; for fractional or decimal weights use the weighted average calculator instead.

Does the mean have to be one of the data values?

No, and it usually is not. The mean of 1, 2 and 4 is 2.333, which appears nowhere in the data. The same is true of the median when n is even. Only the mode is guaranteed to be an actual observed value, which is occasionally a decisive advantage - an average shoe size of 9.4 is not something you can stock.

Why is the range considered a weak measure of spread?

Because it depends on exactly two observations, both of them the most extreme and therefore the least reliable. It also increases with sample size: draw more values from the same population and the largest will tend to get larger. The interquartile range and the standard deviation both use the whole data set and are stable as n grows.

Can I paste data straight from a spreadsheet column?

Yes. Line breaks, commas, tabs and spaces all work as separators, so a pasted column, a pasted row and a comma-separated list all parse the same way. Any text that is not a number is skipped, so stray labels or units will not break the calculation - but check the reported count n matches how many values you meant to enter.

References