Median Calculator
In statistics and probability theory, a median is the value separating the higher half from the lower half of a data sample, population, or probability distribution. For a finite list of numbers, the median is the middle value when the numbers are sorted in ascending order. If the dataset has an odd number of elements, the median is the single middle value. If the dataset contains an even number of elements, it is calculated as the arithmetic average of the two middle values. Unlike the mean, the median is robust against extreme outliers, making it a preferred measure of central tendency for skewed data distributions, such as household incomes.
Enter a list of numbers separated by commas, spaces, or newlines. The calculator sorts the list in numerical order and computes the median (the exact middle value or average of the two middle values) with step-by-step steps.
Quick Answer
Find the middle value of any dataset. Enter your numbers to sort the list and calculate the median, with step-by-step math shown for both odd and even lists.
Separate values with commas, spaces, or new lines. Decimals and negative numbers are supported.
Step by step
- Sort the dataset: 4, 7, 7, 9, 12
- Count of values (N): 5
- Since N (5) is odd, the median is the single middle value at position (N + 1) / 2 = position 3
- Value at position 3 is 7
Median
7
Middle value (7)
Examples
4, 7, 7, 9, 12 (Odd count)
Sorted: 4, 7, 7, 9, 12 · Median = 7
2, 4, 6, 8 (Even count)
Sorted: 2, 4, 6, 8 · Median = (4+6)/2 = 5
-5, 0, 10, 15
Sorted: -5, 0, 10, 15 · Median = (0+10)/2 = 5
How it works
The median calculator sorts the input values in ascending order and finds the exact center of the dataset. The calculation path depends on whether the count of numbers (N) is odd or even.
If N is Odd
The median is the value at the exact center:
median = sorted[(N + 1) / 2]
If N is Even
The median is the average of the two middle values:
median = (sorted[N / 2] + sorted[(N / 2) + 1]) / 2
Learn the concept
These guides explain the idea this tool computes, with worked examples and the distinctions readers most often trip over.
What is the median?
The median is a measure of central tendency in statistics. Unlike the mean, which sums all values and divides by the count, the median represents the middle point of a dataset. It splits your data in half, which is useful when analyzing populations or metrics that contain extreme outlier values.
How to find the median step-by-step
To calculate the median of a dataset manually:
- Sort your numbers in order from lowest to highest.
- Count the total number of values in the list (N).
- If N is odd, look for the value in the exact middle. The formula to find its position is (N + 1) / 2.
- If N is even, locate the two middle numbers. The formulas for their positions are N / 2 and (N / 2) + 1. Add these two values together and divide by 2.
Mean vs Median vs Mode
All three metrics describe the center of a data distribution, but they behave differently depending on the shape of the data:
- Mean: The arithmetic average. It is calculated by summing all numbers and dividing by the count. It is sensitive to outliers.
- Median: The middle value. It is robust to outliers and is the best representation of skewed data.
- Mode: The value that appears most often. A dataset can have one mode, multiple modes, or no mode at all.
To compute all three at once, you can use our Mean Median Mode Calculator. For analyzing the spread or variability of your data, you can check the Standard Deviation Calculator or the Variance Calculator.
Worked Examples of Median Calculations
Here are two scenarios showing how the calculation adapts:
- Odd Count Example: For the dataset
[12, 4, 7, 9, 7]:
1. Sort the list:[4, 7, 7, 9, 12].
2. N = 5 (odd).
3. Position of median is (5 + 1) / 2 = 3.
4. The third value is 7. - Even Count Example: For the dataset
[8, 2, 6, 4]:
1. Sort the list:[2, 4, 6, 8].
2. N = 4 (even).
3. Middle positions are 4 / 2 = 2 and (4 / 2) + 1 = 3 (values 4 and 6).
4. Average the middle values: (4 + 6) / 2 = 5.
Common Mistakes when Finding the Median
- Forgetting to sort the list first: You cannot find the median of unsorted data. The numbers must be ordered in ascending or descending sequence.
- Taking the middle index of an even dataset: If N is even, there is no single middle value. You must locate the two middle elements and calculate their arithmetic average.
- Miscounting the list size: Ensure that you count every input number (including duplicate numbers) when determining N.
Related Calculators
More tools from Education



