Sort the data, then take the middle
The median is the value that splits a sorted data set into two equal halves. Sorting first is mandatory — the median of the raw, unsorted list is wrong. With an odd count there is one clear middle; with an even count you average the two straddling the center.
Two worked cases
- Odd count. 12, 8, 21, 5, 33 sorts to 5, 8, 12, 21, 33. Five values, so the 3rd is the middle: median = 12.
- Even count. 10, 15, 20, 25 is already sorted. The two middle values are 15 and 20, so median = (15 + 20) ÷ 2 = 17.5.
Why the median beats the mean on skewed data
Take 25, 28, 30, 32, 1000. The lone outlier barely moves the median but wrecks the mean.
Four of the five values sit near 30, yet the single 1000 pulls the mean to 223. The median stays at 30, describing the typical value.
Median vs mean vs mode
| Measure | What it is | Reacts to outliers? |
|---|---|---|
| Median | middle value when sorted | no, resistant |
| Mean | sum divided by count | yes, strongly |
| Mode | most frequent value | no |
In a symmetrical distribution the median and mean coincide. They diverge as the data skews — which is why US median household income (~$75K) sits well below the mean (~$105K).
Common questions
How do you find the median of a data set?
Sort the numbers from smallest to largest, then take the middle one. If there is an odd count, that single middle value is the median. If the count is even, average the two middle values.
What is the median of an even number of values?
It is the average of the two middle values after sorting. For 10, 15, 20, 25 the two middle numbers are 15 and 20, so the median is 17.5. The median does not have to be a value that appears in the set.
When is the median better than the mean?
When the data is skewed or has outliers. Incomes and house prices are classic cases: a few very large values drag the mean upward, while the median stays near the typical figure.


