Tools · Math & Statistics

Mean, Median, Mode & Range Calculator

Paste a list of numbers and get all four school averages at once — plus quartiles, the interquartile range, and the geometric and harmonic means. The chart marks the mean and the median so you can see, rather than guess, which one describes your data.

Every mode reported, not just the firstWhich one to useInputs stay on this device
Your inputs

Find the centre

Paste or type up to 1,000 numbers. Commas, spaces, tabs, and new lines all separate — so a spreadsheet column pastes straight in. Because a comma separates, do not use one as a thousands separator: type 1234, not 1,234.

Your inputs are calculated locally and are not stored.
Mean (the arithmetic average)5

8 values summing to 40. The median is 4.5 and the mode is 4 — appears 3 times. The mean and the median are close, so this list is roughly symmetric and either one describes it fairly.

Median (the middle value)
4.5
Mode (the most common)
4 — appears 3 times
Range
7
Minimum
2
Maximum
9
Values (n)
8
Sum (Σx)
40
First quartile (Q1)
4
Third quartile (Q3)
5.5
Interquartile range (Q3 − Q1)
1.5
Geometric mean · for growth rates
4.603216
Harmonic mean · for average speeds
4.201751
Every value in ascending order. The dashed line is the mean (5); the dotted line is the median (4.5). Half the bars fall either side of the median, whatever the tallest one does.
The decision

Which centre should you actually quote?

“The average” is not one number. It names at least three, and on real data they disagree — which is why the choice between them is the interesting part and the arithmetic is not.

The mean is a balance point. Every value pulls on it in proportion to how far away it sits, so one extreme observation can drag it as far as it likes. That sensitivity is exactly what you want when you need a figure you can multiply back up: mean × count returns the total, which is why budgets, totals and per-capita figures all use it.

The median is a rank. It only counts how many values sit either side, so the same extreme observation moves it by at most one position. That insensitivity is exactly what you want when you are describing a typical case, which is why every national statistics office publishes median household income and median house price rather than the mean.

The mode is a count. It is the only one of the three that works on things that are not numbers at all, and the only one that has to be a value you actually observed. It is also the only one that can legitimately come back as two answers, or as none.

The rule of thumb

If the mean and the median are close, the list is roughly symmetric and it does not much matter which you use. If they are far apart, the data has a tail, the mean is sitting inside that tail, and the median is the more honest description. The result panel above says which of those two situations you are in.

If what you need is the spread rather than the centre, the standard deviation calculator reports variance and standard error on both divisors. If some of your values should count for more than others, the weighted average calculator takes a weight per value. This page treats every value equally and answers a different question: where the centre of the list is.

Formula & methodology

How each figure is worked out

x̄ = Σx ÷ n  •  median = middle of the sorted list  •  range = max − min  •  IQR = Q3 − Q1
The mean — every value added up, divided by how many
Median
The middle value once sorted; the mean of the two middle values when the count is even
Mode
Every value tied for the highest count — none, one, or several
Q1, Q3
The values a quarter and three quarters of the way through the sorted list

Which quartile definition this uses

There are at least nine, and they disagree, which is why two calculators can both be “right” about Q1 and print different numbers. This one uses linear interpolation between the closest ranks: the quantile at fraction p sits at position (n − 1)p in the sorted list, interpolating between the neighbours when that position is not a whole number. It matches R's type 7, NumPy's default and Excel's QUARTILE.INC. It does not match Tukey's hinges or Excel's QUARTILE.EXC, which exclude the median from each half. The median itself is computed through the same rule at p = 0.5, which is provably identical to the textbook definition.

Why the mode is a list

Because a set of numbers can genuinely have more than one, and can genuinely have none. The rule here is the plain one: the mode is every value tied for the highest frequency, unless the highest frequency is 1 — in which case nothing repeats, the list has no mode, and the calculator says so instead of printing a value that is not one.

The two means most calculators leave out

The geometric mean is the nth root of the product, computed here as exp(mean of the logarithms) because a thousand values multiplied together overflow a double and the nth root of infinity is not a number. The harmonic mean is n ÷ Σ(1 ÷ x). Both need every value to be above zero — a logarithm of a negative and a reciprocal of a zero do not exist — so they are withheld rather than faked when your list contains one. For any list of positive numbers the ordering harmonic ≤ geometric ≤ arithmetic is a theorem, with equality only when every value is identical.

Worked example

The set 2, 4, 4, 4, 5, 5, 7, 9

Eight values summing to 40, so the mean is 40 ÷ 8 = 5. Sorted, the two middle values are the fourth and fifth — 4 and 5 — so the median is 4.5. The value 4 appears three times and nothing else appears more than twice, so the mode is 4. The range is 9 − 2 = 7.

For the quartiles, there are eight values so n − 1 = 7. Q1 sits at position 7 × 0.25 = 1.75 — three quarters of the way from the second value to the third, both of which are 4, so Q1 = 4. Q3 sits at position 7 × 0.75 = 5.25 — a quarter of the way from the sixth value (5) to the seventh (7), so Q3 = 5 + 0.25 × 2 = 5.5. The interquartile range is 5.5 − 4 = 1.5: the middle half of this list spans just a point and a half, while the full range spans seven.

The geometric mean of the same eight values is 4.603216 and the harmonic mean is 4.201751. Both sit below the arithmetic mean of 5, as they must.

Now the case that matters: one outlier

Take seven salaries — 38,000, 41,000, 43,000, 45,000, 47,000, 52,000 and 1,200,000. They sum to 1,466,000, so the mean is 209,429. The median is the fourth of the seven ranked values: 45,000.

Six of the seven people earn less than a quarter of the “average”. Now delete the 1,200,000 and recompute: the mean falls to 44,333 — a move of 165,095 — while the median falls to 44,000, a move of 1,000. One value out of seven moved the mean a hundred and sixty-five times as far as it moved the median. That ratio is the entire argument for the median, and it is why “the average salary at this company” is a number worth interrogating.

Paste both lists into the box above and watch the result panel change its recommendation between them.

Assumptions

What this calculator assumes

  • Your list is raw observations, not grouped or binned data. A frequency table like “twelve values of 4” needs those values written out.
  • Every value counts once, however often it appears. There is no weighting here — if some values should count for more, you want a weighted average instead.
  • Nothing is dropped as an outlier. The 1.5 × IQR fence is a convention, not a fact, and quietly discarding a value is the one thing a calculator must never do unasked. The interquartile range is reported so you can apply that fence yourself if you want it.
  • Commas separate values, so they cannot also be thousands separators. Type 1234, not 1,234, or the tool reads two numbers.
  • Quartiles use linear interpolation between closest ranks (R type 7). Other definitions exist and give different answers on short lists.
  • A tie for the highest frequency is reported as a tie. A list where nothing repeats is reported as having no mode.
  • Results are rounded to six decimal places for display. The arithmetic underneath runs at full double precision and the rounding happens once, at the end.
Common questions

Mean, median, mode and range FAQ

What is the difference between the mean, the median and the mode?

The mean is the total divided by how many values there are — the balance point of the list. The median is the value in the middle once everything is sorted, so half the list sits either side of it. The mode is whichever value appears most often. On symmetric data all three land in roughly the same place. On lopsided data they separate, and the gap between them is information rather than an error: it tells you the list has a tail.

Which average should I actually use?

Use the median for anything with a long tail — incomes, house prices, wait times, response times, donation sizes. Use the mean when the data is roughly symmetric and you need a figure you can add up again, because the mean multiplied by the count gives back the total and the median does not. Use the mode for categories and for anything discrete where a repeated value is the point: the most common shoe size, the most common test score, the most common number of people in a household.

Can a set of numbers have two modes, or no mode at all?

Both, and this is where most calculators quietly go wrong. 2, 2, 3, 3, 4 is bimodal — 2 and 3 tie, and picking one because it sorted first invents a fact about your data. 1, 2, 3, 4 has no mode at all: nothing repeats, so no value is more typical than any other. This calculator returns every value tied for the top count, and says plainly when there is no mode rather than printing a number that is not one.

Why is median income always lower than average income?

Because income has a floor and no ceiling. Nobody earns less than nothing, but a small number of people earn enormously more than everyone else, and the mean feels every pound of that while the median only counts heads. Take seven salaries: 38,000, 41,000, 43,000, 45,000, 47,000, 52,000 and 1,200,000. The mean is 209,429 — more than four times what six of the seven people take home. The median is 45,000, which is what somebody in that group actually earns. That gap is why national statistics offices publish median household income, not mean.

How do you find the median when there is an even number of values?

Average the two middle values. For 2, 4, 4, 4, 5, 5, 7, 9 the two middle values are the fourth and fifth — 4 and 5 — so the median is 4.5. Note that 4.5 is not in the list, and does not have to be: the median is the point that splits the list in half, not necessarily a value you collected.

Why does another calculator give a different first quartile?

Because there are at least nine accepted definitions of a quartile and they disagree on small lists. This calculator uses linear interpolation between the closest ranks — the quantile at fraction p sits at position (n − 1)p in the sorted list. That is R's type 7, NumPy's default, and Excel's QUARTILE.INC. Tukey's hinges and Excel's QUARTILE.EXC exclude the median from each half and give slightly wider quartiles. Neither is wrong; check which one your textbook or your software is using before assuming a bug.

When should I use the geometric or harmonic mean instead?

Use the geometric mean for anything that compounds. Three years of returns of +10%, −20% and +30% multiply out to a total of 1.144, or 14.4%. The arithmetic mean of those three is 6.67% a year, which compounds to 21.4% over three years — wrong. The geometric mean is 4.59% a year, which compounds back to exactly 14.4%. Use the harmonic mean for rates over a fixed quantity: drive 60 km at 30 km/h and 60 km back at 60 km/h and your average speed is not 45 km/h, it is 40 — three hours for 120 km, which is the harmonic mean of 30 and 60.

Primary sources

Sources and review notes

  1. NIST/SEMATECH e-Handbook of Statistical Methods §1.3.5.11 — measures of location, and why the median resists outliers the mean cannot
  2. NIST/SEMATECH e-Handbook — percentile and quantile definitions, including the interpolation rule used here
  3. NIST/SEMATECH e-Handbook of Statistical Methods — the full handbook, jointly produced by NIST and SEMATECH

These definitions have no data behind them to go stale. What can go wrong is the arithmetic, so the engine behind this page is a pure function under unit test — including cases for a bimodal list, a list with no mode, and the outlier example above.