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.
How to use the median calculator
- 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.
- 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.
- The median appears at the top as you type, with the position rule or the middle-pair average written out underneath.
- 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
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) ÷ 2 | What to take |
|---|---|---|
| 5 | 3 | The 3rd value |
| 6 | 3.5 | Average of the 3rd and 4th |
| 7 | 4 | The 4th value |
| 8 | 4.5 | Average of the 4th and 5th |
| 9 | 5 | The 5th value |
| 10 | 5.5 | Average of the 5th and 6th |
| 25 | 13 | The 13th value |
| 100 | 50.5 | Average 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.
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.
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:
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.
| Data | Mean | Median | Better summary |
|---|---|---|---|
| 10 test scores, all between 70 and 90 | 80.4 | 80.5 | Either |
| 5 home sale prices with one $1.9M sale | $581,000 | $265,000 | Median |
| Total restaurant bill split evenly | Needed | Useless | Mean |
| Server response times with a few timeouts | Inflated | Stable | Median |
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.
When the quarter position falls neatly on a value, that value is the quartile. Nine evenly spaced numbers make this clean:
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:
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 size | Households | Positions covered |
|---|---|---|
| 1 | 4 | 1st – 4th |
| 2 | 7 | 5th – 11th |
| 3 | 5 | 12th – 16th |
| 4 | 2 | 17th – 18th |
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.
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.
Related calculators
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.
https://fourfunctioncalculator.com/median-calculator/