Median Calculator
Sort three numbers and pick the middle value to find the median.
What this calculator does
Enter three numbers in any order and the calculator sorts them and returns the middle one. At the defaults, 5, 2 and 9 sort into 2, 5, 9 and the median is 5 — one value below it, one above, regardless of how the inputs were typed. With exactly three values, the median is also the value left over after deleting the largest and the smallest, which is a ten-second mental method for this case.
How the median is defined
The notation x(2) means the second value after sorting, and sorting is the entire algorithm — no arithmetic happens at all. This is the deepest difference between the median and the mean: the median is an order statistic, a real data point from the list, while the mean is a computed mixture. It also means the median of three numbers must be one of the three numbers you typed, which the defaults confirm: 5 is both the second input and the middle of the sorted list.
Median versus mean for the same three numbers
At the defaults the mean is (5 + 2 + 9) ÷ 3 = 16 ÷ 3 ≈ 5.33, close to the median of 5 because the values are fairly balanced. The two diverge when one value runs away: replace the 9 with 90 and the mean jumps to (5 + 2 + 90) ÷ 3 = 32.33 while the median stays exactly 5. That stability under extremes is the median’s whole selling point, and the same logic is why reported US household income and home prices use medians — a handful of billionaires or beachfront estates would otherwise drag the average far above what a typical family experiences.
Worked example at the defaults
Sort, take the middle
- Inputs, in entry order: 5, 2, 9.
- Sort ascending: 2, 5, 9.
- Take the middle position: the second value is 5.
- Result: median = 5.
A faster shortcut for three numbers: discard the maximum and the minimum. From 5, 2, 9, delete the 9 and the 2, and the survivor 5 is the median. The shortcut works because with exactly three values the middle position is the only one that is neither extreme, and it cannot fail even with duplicates — from 7, 7, 3 you delete one 7 and the 3 and report 7.
Median and mean across different spreads
| Values | Sorted | Median | Mean |
|---|---|---|---|
| 5, 2, 9 | 2, 5, 9 | 5 | 5.33 |
| 1, 2, 3 | 1, 2, 3 | 2 | 2 |
| 5, 2, 90 | 2, 5, 90 | 5 | 32.33 |
| 4, 4, 4 | 4, 4, 4 | 4 | 4 |
| −10, 0, 10 | −10, 0, 10 | 0 | 0 |
The table shows exactly when the two measures agree and when they split. Symmetric lists — 1, 2, 3 or −10, 0, 10 — give identical answers because the extremes cancel evenly. Skewed lists like 5, 2, 90 pull the mean 27 points above the median, and the gap itself is a quick skewness diagnostic: mean far above median means a long right tail, mean far below means a long left tail.
Duplicates, negatives and ties
Duplicates sort into adjacent positions and change nothing about the method: from 5, 5, 2 the sorted list is 2, 5, 5 and the median is 5. Negative numbers participate normally — from −10, 0, 10 the median is 0, which sits two-thirds of the way through the sorted order even though it is zero. If all three values are equal, that value is both the median and the mean, as the 4, 4, 4 row shows. The only case needing care is a set where two values tie for the middle after a different count — with three inputs that cannot happen, because there is always exactly one middle position.
Common mistakes
- Skipping the sort and reading the second typed value: from 5, 2, 9 the second entry is 2, but the median is 5. Entry order is irrelevant; sorted order is everything.
- Confusing the median position with the median value: the middle position of three numbers is the second, but its value depends entirely on the data.
- Computing the mean when a median is asked for: 5, 2, 90 has a mean of 32.33 and a median of 5, and the two answer different questions.
- Forgetting that the median must be a member of the input set: if your three-value median is not one of the three numbers, you computed the mean by mistake.
The discard-extremes shortcut doubles as a checker: delete the largest and smallest, and whatever remains must equal the reported median. If the leftovers do not match, the sort went wrong somewhere.
Where the median beats the mean
Any ranking or threshold question wants the median. A delivery service quoting three delivery times of 2, 3 and 40 minutes serves a typical customer in 3 minutes; the mean of 15 minutes would misdescribe almost every shipment. Real-estate listings, salary surveys and hospital wait-time reports all use medians for the same reason. For larger datasets the same sorting logic applies with slightly different bookkeeping for even counts, which the mean & median calculator handles; for a single aggregate of many values the average calculator computes the mean side by side, and the arithmetic mean calculator works through the summation step by step.
Frequently asked questions
How do I find the median of three numbers?
Sort them and take the second value. For 5, 2, 9 the sorted order is 2, 5, 9 and the median is 5. Equivalently, delete the largest and smallest and keep the survivor.
Why use the median instead of the mean?
The median ignores how extreme the outer values are. Replacing 9 with 90 in the defaults leaves the median at 5 but pushes the mean to 32.33, so the median describes the typical value better in skewed data.
What if two of the three numbers are equal?
The method is unchanged. From 5, 5, 2 the sorted list is 2, 5, 5 and the median is 5; the duplicate simply occupies an adjacent position.
Do negative numbers change anything?
No. From −10, 0, 10 the sorted order is −10, 0, 10 and the median is 0. The median handles any mix of signs.
Is the median always one of the input values?
Yes, for an odd count like three. The middle position after sorting holds a real data point, unlike the mean, which can be a value nobody entered.
What is the median of 5, 2 and 90?
5. The sorted list is 2, 5, 90. The mean of 32.33 is dragged upward by the 90, which is exactly the situation where the median is the more honest summary.
When do the median and mean agree exactly?
For symmetric data. The lists 1, 2, 3 and −10, 0, 10 both have a mean equal to the median because the extremes balance evenly around the center.
How is the median defined for larger sets?
Sort everything; for an odd count take the middle value, and for an even count average the two middle values. Four numbers sorted as 1, 2, 8, 9 have a median of (2 + 8) ÷ 2 = 5.
Method and sources
- Median = middle value of a sorted list.