Median Calculator

This median calculator sorts your list and finds the middle value, averaging the two middle numbers when the count is even. It also reports Q1, Q3, the interquartile range, the mean, the minimum, the maximum and the range, and marks the median on a plot of the sorted values.

Median calculatorLive — updates as you type
You do not need to sort them first — the calculator does that for you.

How to use the median calculator

  1. Type or paste your numbers into the box. Commas, spaces, tabs and line breaks all separate values, so a spreadsheet column works as it is.
  2. You do not need to sort anything first. Sorting is the first thing the calculator does, and the sorted order is what the chart shows.
  3. The median appears at the top as you type, with the position rule or the middle-pair average written out underneath.
  4. Read Q1, Q3 and the IQR in the panel below, alongside the mean, minimum, maximum and range.

The chart draws the values in sorted order with the median as a dashed line across them. Compare where that line sits against the mean shown in the panel. If the two are close, the data is fairly symmetric. If the mean is well above the median, a few large values are stretching the top end.

Non-numeric entries are skipped and counted, so stray labels or currency symbols in a pasted column will not throw the result off.

How the median is found

position of the median = (n + 1) ÷ 2
Sort the list first. n is how many values you have.

That formula gives a position in the sorted list, not the answer itself. This is the single most common slip: for nine values, (9 + 1) ÷ 2 = 5 means take the fifth number, not the number 5.

When n is odd, the position lands on a whole number and there is exactly one middle value. When n is even, the position lands on a half — 3.5, 4.5, and so on — which tells you to take the two values on either side and average them. That average is the median even if it is not a value you recorded.

How many values (n)(n + 1) ÷ 2What to take
53The 3rd value
63.5Average of the 3rd and 4th
74The 4th value
84.5Average of the 4th and 5th
95The 5th value
105.5Average of the 5th and 6th
2513The 13th value
10050.5Average of the 50th and 51st

Only the order matters, not the sizes. Replace the largest value in any list with a number ten times bigger and the median does not move at all. That single property is what makes it useful.

Worked examples

Example: an odd count

Seven readings: 4, 8, 15, 16, 23, 42, 9.

sorted: 4, 8, 9, 15, 16, 23, 42 position = (7 + 1) ÷ 2 = 4 4th value = 15

The median is 15. The mean of the same seven numbers is 117 ÷ 7 = 16.71, nudged upward by the 42.

Example: an even count

Six values: 5, 3, 9, 1, 12, 7.

sorted: 1, 3, 5, 7, 9, 12 position = (6 + 1) ÷ 2 = 3.5 take the 3rd and 4th values: 5 and 7 (5 + 7) ÷ 2 = 6

The median is 6, which is not one of the six numbers. That is normal for an even count and is not a sign of an error.

Why the median beats the mean on skewed data

Five homes sell on one street:

$210,000 $240,000 $265,000 $290,000 $1,900,000 median = $265,000 mean = 2,905,000 ÷ 5 = $581,000

The mean says $581,000. Four of the five houses sold for less than half that. One unusual sale has moved the mean by more than $300,000 and left the median untouched. Anyone asking “what does a house on this street cost?” wants the $265,000.

The same shape shows up in salaries, rents, wait times, insurance claims, page load times and donation sizes. All of them have a hard floor at zero and no ceiling, so the long tail always runs to the right and always pulls the mean with it. Reported figures for household income and home prices are medians for exactly this reason.

The mean still has jobs the median cannot do. Multiply the mean by the count and you get the total; multiply the median by the count and you get nothing useful. If you are dividing a bill, budgeting a total spend or working out a per-unit cost, you want the mean from the average calculator. If you are describing a typical case, you want the median.

DataMeanMedianBetter summary
10 test scores, all between 70 and 9080.480.5Either
5 home sale prices with one $1.9M sale$581,000$265,000Median
Total restaurant bill split evenlyNeededUselessMean
Server response times with a few timeoutsInflatedStableMedian

Quartiles and the interquartile range

Quartiles use the same idea as the median, applied at the quarter marks. The median cuts the sorted list in half; Q1 sits a quarter of the way along it, and Q3 sits three quarters of the way along. The interquartile range is the distance between them.

IQR = Q3 − Q1
The spread of the middle half of your data, ignoring both tails.

When the quarter position falls neatly on a value, that value is the quartile. Nine evenly spaced numbers make this clean:

2, 4, 6, 8, 10, 12, 14, 16, 18 median = 10 Q1 = 6 Q3 = 14 IQR = 14 − 6 = 8

When the position falls between two values, the calculator interpolates between them, which is the same method spreadsheets use for an inclusive percentile. For 1, 3, 5, 7, 9, 12 the quarter position is 0.25 × (6 − 1) = 1.25, a quarter of the way from the second value to the third:

Q1 = 3 + 0.25 × (5 − 3) = 3.5 Q3 = 7 + 0.75 × (9 − 7) = 8.5 IQR = 8.5 − 3.5 = 5

The IQR is the median’s companion measure of spread. Where the standard deviation is built from distances to the mean and therefore reacts to outliers, the IQR simply ignores the top and bottom quarters. A common outlier test flags anything more than 1.5 × IQR below Q1 or above Q3.

Medians with repeated or grouped values

Repeats change nothing about the method. Every copy of a value occupies its own position in the sorted list, so 3, 7, 7, 9 has median (7 + 7) ÷ 2 = 7. Do not remove duplicates before you start — deleting them changes n and moves the middle.

Data given as a frequency table works the same way once you count the positions. Say a survey records household sizes:

Household sizeHouseholdsPositions covered
141st – 4th
275th – 11th
3512th – 16th
4217th – 18th
n = 4 + 7 + 5 + 2 = 18 position = (18 + 1) ÷ 2 = 9.5 the 9th and 10th positions are both a household size of 2 median = 2

You can also just expand the table into a full list and paste it in: 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4 gives the same answer. For small frequency tables that is the quickest route.

Watch outIf your data is grouped into ranges rather than exact values (for example “20–29: 14 people”), you cannot recover an exact median. The best you can do is name the group that contains the middle position, or estimate within it by interpolation.

Common mistakes

  • Taking the middle of an unsorted list. The median of 5, 3, 9 is 5, not 3. Sorting is not optional.
  • Letting a spreadsheet sort numbers as text. Text sorting puts 100 before 9 and 11 before 2, which silently produces the wrong middle value. Pasting the raw column here avoids it.
  • Reading (n + 1) ÷ 2 as the answer. It is a position in the sorted list, not a value from it.
  • Taking only one middle value when the count is even. With 8 values you need the average of the 4th and 5th, not the 4th alone.
  • Stripping out duplicates first. Repeats are real data points and each one takes a position.
  • Assuming half the values are below the median. With repeats at the middle, several values can equal the median exactly.
  • Averaging medians from different groups. Medians do not combine that way, and unlike means they cannot be recovered from group totals. Go back to the pooled raw data.
  • Rounding the middle pair before averaging them. Average first, then take the result to the rounding calculator if you need fewer decimals.

One more limitation worth knowing: a median treats every item as equally important. If some of your values genuinely count for more than others — credits, quantities, group sizes — the middle value is the wrong tool, and a weighted average is the right one.

Frequently asked questions

What is the median of 5, 3, 9, 1, 12 and 7?

The median is 6. Sorted, the list reads 1, 3, 5, 7, 9, 12. There are six values, so the middle position is (6 + 1) ÷ 2 = 3.5, meaning you average the 3rd and 4th values: (5 + 7) ÷ 2 = 6. The mean of the same set is 6.17, so here the two summaries almost agree.

What is the median of 4, 8, 15, 16, 23, 42 and 9?

The median is 15. Sorting gives 4, 8, 9, 15, 16, 23, 42. Seven values means the middle position is (7 + 1) ÷ 2 = 4, and the fourth value is 15. The mean of the same numbers is 16.71 because the 42 pulls it up. With an odd count you never have to average anything.

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

Sort the list, then average the two values on either side of the middle. For 2, 4, 6, 10 the middle pair is 4 and 6, so the median is (4 + 6) ÷ 2 = 5. The result often is not one of your original numbers, and that is expected. If the two middle values are identical, the average is simply that value.

Is the median better than the mean?

Better for describing a typical value in skewed data, and worse for anything involving totals. The median ignores how extreme the extremes are, which is exactly what you want for home prices or salaries and exactly what you do not want when splitting a bill. Report both when you can; the gap between them tells you how skewed the data is.

What are Q1 and Q3?

They are the quarter marks of the sorted list. Q1 is the value a quarter of the way through, Q3 the value three quarters of the way through, and the median is the halfway mark between them. For 2, 4, 6, 8, 10, 12, 14, 16, 18 the values are Q1 = 6, median = 10, Q3 = 14, giving an interquartile range of 8.

Can the median be a decimal if all my numbers are whole?

Yes, whenever the count is even and the two middle values differ by an odd amount. The median of 4 and 7 is 5.5. Nothing has gone wrong: the median of an even-sized list is defined as the midpoint of the middle pair, and that midpoint does not have to be a whole number or a number you recorded.

Do I have to sort my numbers before pasting them in?

No. Sorting happens automatically, and the sorted order is what the chart displays. This is safer than sorting yourself in a spreadsheet, where a column formatted as text sorts 100 ahead of 9 and quietly gives you the wrong middle value. Paste the raw column and let the sorting happen here.

How do you find the median of a frequency table?

Add the frequencies to get n, work out the middle position with (n + 1) ÷ 2, then walk down the table adding frequencies until you reach that position. With 18 households split 4, 7, 5, 2 across sizes 1 to 4, the middle position is 9.5, which falls inside the group of 7 twos, so the median is 2.

Put this calculator on your own site (free)

Copy this into any page. The calculator stays up to date on its own, works on mobile, and carries a small credit link back here.

Preview it
Cite this page “Median Calculator”. Four Function Calculator, 6 September 2026.https://fourfunctioncalculator.com/median-calculator/
Shows the workingRuns entirely in your browser — nothing you type is sent anywhere.Last reviewed 6 September 2026