Median Calculator
Enter a list of numbers separated by commas, spaces, or new lines, then click Calculate Median.
What is the median?
The median is the middle value in a data set after the numbers are sorted from smallest to largest. It is one of the most useful measures of central tendency because it is not heavily affected by extreme values (outliers).
For example, if one person in a neighborhood makes an unusually high income, the average (mean) income may be distorted, but the median income still gives a realistic picture of the “typical” resident.
How to calculate median: step-by-step
Step 1: List all values
Write down every number in your data set. Make sure nothing is missing.
Step 2: Sort the values
Arrange the numbers in ascending order (smallest to largest). This step is essential. If the values are not sorted, your median will be wrong.
Step 3: Count how many values you have
Let this count be n.
Step 4: Use the odd/even rule
- If n is odd: the median is the single middle value.
- If n is even: the median is the average of the two middle values.
Median formula by data size
Odd number of values: position = (n + 1) / 2
Even number of values: median = average of values at positions n / 2 and (n / 2) + 1
Examples
Example 1: Odd count
Data: 9, 3, 12, 7, 5
Sorted: 3, 5, 7, 9, 12
There are 5 numbers, so the middle is the 3rd value.
Median = 7
Example 2: Even count
Data: 4, 10, 2, 8
Sorted: 2, 4, 8, 10
There are 4 numbers, so take the average of the 2nd and 3rd values: (4 + 8) / 2 = 6.
Median = 6
Example 3: Includes negatives and decimals
Data: -1.5, 2.2, 0, 3.8, -4
Sorted: -4, -1.5, 0, 2.2, 3.8
Middle value is 0.
Median = 0
Median vs mean vs mode
- Mean: sum of values divided by number of values.
- Median: middle value after sorting.
- Mode: most frequent value.
Use the median when your data has outliers, skewed distributions, or values that are not symmetrically distributed.
Common mistakes to avoid
- Forgetting to sort the data first.
- Picking the middle by position from unsorted data.
- For even-sized sets, forgetting to average the two middle numbers.
- Using the mean when the median is the better choice for skewed data.
How to find median in Excel or Google Sheets
If your values are in cells A1 through A20, use:
=MEDIAN(A1:A20)
This function works whether the count is odd or even, and it handles sorting internally.
When median is especially useful
- House prices in a city
- Salary/income analysis
- Exam scores with a few extreme results
- Response times where a few long delays occur
Quick practice problems
- 5, 8, 1, 3, 9
- 12, 7, 4, 10
- 2.5, 2.5, 3.0, 1.2, 9.8, 0.7
Try them in the calculator above, then verify by sorting manually. Repetition is the fastest way to master median calculations.
Final takeaway
To calculate median correctly every time: sort the data, count values, then apply the odd/even rule. The median is simple, robust, and highly practical in real-world decision-making.