IQR Calculator

Median Calculator

Sort the values and take the middle one. Even counts average the middle pair.

Median calculatorRuns entirely in your browser
Separate values with commas, spaces or line breaks. Paste a column straight from a spreadsheet.
Try:
ResultExclusive method · n = 7
Median4the middle of 7 values
Count
7
Mean
4
Q1
2
Q3
6
Minimum
1
Maximum
7

How we calculated it

Sort the values
1, 2, 3, 4, 5, 6, 7
Take the middle value of 7
Position (7 + 1) ÷ 2 = 4median = 4

Finding it

Sort the values, then take the middle one. With an even count there is no single middle, so average the two that straddle the centre.

odd n: median = value at position (n + 1) ÷ 2 even n: median = mean of the values at positions n ÷ 2 and n ÷ 2 + 1 Positions count from 1 in the sorted list.

Note that with an even count the median need not be a value that appears in your data — the median of 1, 2, 3, 4 is 2.5.

Median or mean?

The median only cares about order. Change the largest value from 100 to 100,000 and it does not move, because its position in the sorted list is unchanged. That is what makes it the right summary for skewed data — house prices, salaries, response times, anything with a long tail.

The cost is that it ignores magnitude entirely. Two data sets with identical medians can have wildly different totals. When the data is roughly symmetric, the mean uses more of the available information and is the better choice.

Worked example

Odd and even counts, side by side

Odd: 1, 2, 3, 4, 5, 6, 7 · Even: 4, 8, 15, 16, 23, 42

Seven values: position (7 + 1) ÷ 2 = 4, so the median is the 4th value, 4.

Six values: positions 3 and 4 hold 15 and 16, so the median is (15 + 16) ÷ 2 = 15.5 — a number that appears nowhere in the data.

Questions

Is the median the same as Q2?

Yes. Q2 is just the median named as a quartile, and every quartile method agrees on it.

Can a data set have two medians?

No. With an even count the two middle values are averaged into a single number, so there is always exactly one median.