Median Calculator

Enter any list of numbers to find the median, mean, mode, and full descriptive statistics instantly.

📊 Median Calculator
Dataset (numbers separated by commas or spaces)

📖 What is the Median?

The median is the middle value of a dataset when all values are arranged in ascending or descending order. It is one of the three primary measures of central tendency in statistics, alongside the mean (arithmetic average) and the mode (most frequent value). Unlike the mean, the median is not calculated from all values - it is a positional measure that identifies the exact center of the ordered dataset.

To find the median, you first sort the data. For an odd number of values, the median is the single middle value. For an even number of values, the median is the average of the two middle values. For example, in the dataset {3, 7, 9, 12, 15} (n = 5, odd), the median is 9 - the third value. In {4, 8, 15, 16} (n = 4, even), the median is (8 + 15) / 2 = 11.5.

The median's most important property is its robustness to outliers. Consider household incomes in a neighborhood: if one billionaire moves in, the mean income rises dramatically, but the median barely changes. This is why economists, governments, and researchers consistently prefer the median when reporting income, house prices, wealth, and other distributions that tend to be right-skewed. When data is skewed, the median gives a far more representative picture of the "typical" value than the mean.

The median also has a clear probabilistic interpretation: it is the value such that 50% of the data falls below it and 50% falls above it. This makes it equivalent to the 50th percentile (second quartile, Q2). In a perfectly symmetric distribution such as the normal bell curve, the median equals the mean and the mode. In right-skewed distributions (common in income and price data), the median is less than the mean; in left-skewed distributions, the median is greater than the mean. This relationship between mean and median is used as a quick diagnostic for skewness in a dataset.

📐 Formula

Median = x(n+1)/2    (n odd)
Median = (xn/2 + xn/2+1) / 2    (n even)

Where:

  • x = the dataset sorted in ascending order
  • n = the total count of values
  • xk = the value at position k in the sorted list (1-indexed)

Worked example (odd n): Dataset = {9, 3, 15, 7, 12}. Step 1: Sort → {3, 7, 9, 12, 15}. Step 2: n = 5 (odd), so median position = (5+1)/2 = 3. Step 3: The value at position 3 is 9. Median = 9.

Worked example (even n): Dataset = {42, 23, 16, 4, 8, 15}. Step 1: Sort → {4, 8, 15, 16, 23, 42}. Step 2: n = 6 (even), so take positions n/2 = 3 and n/2+1 = 4. Step 3: Values at positions 3 and 4 are 15 and 16. Step 4: Median = (15 + 16) / 2 = 15.5.

✍ How to Use This Calculator

  1. Enter your numbers - type your dataset into the text area, separated by commas or spaces (e.g. 4, 8, 15, 16, 23, 42). Negative numbers and decimals are fully supported.
  2. Click Calculate - the calculator instantly computes the median, mean, mode, count (n), minimum, and maximum for your dataset.
  3. Review the sorted list - the sorted dataset is displayed below the results with the median value(s) highlighted in blue so you can visually confirm which value(s) define the center.
  4. Try an example - click any "Try this example" link in the Examples section below to pre-fill the calculator with a worked dataset and instantly see the results.

💡 Example Calculations

Example 1 - Odd number of values

1
Dataset: {3, 7, 9, 12, 15} - five values (odd n)
2
Already sorted in ascending order: 3, 7, 9, 12, 15
3
n = 5 (odd) → median position = (5+1)/2 = 3
4
Median = 9 (the value at position 3). Mean = (3+7+9+12+15)/5 = 9.2. Range = 15−3 = 12.
Try this example →

Example 2 - Even number of values

1
Dataset: {4, 8, 15, 16, 23, 42} - six values (even n)
2
Sorted: 4, 8, 15, 16, 23, 42
3
n = 6 (even) → take positions 3 and 4 → values 15 and 16
4
Median = (15 + 16) / 2 = 15.5. Note: 15.5 does not appear in the data - that is perfectly valid for an even-n median.
Try this example →

Example 3 - Dataset with a large outlier (median vs. mean)

1
Dataset: {10, 20, 30, 40, 10000} - five values, one extreme outlier
2
Sorted: 10, 20, 30, 40, 10000
3
Median = 30. Mean = (10+20+30+40+10000)/5 = 2020.
4
The outlier (10,000) dragged the mean to 2020 - far above most of the data. The median of 30 is a much more representative "typical" value. This is why income and house price statistics always use the median.
Try this example →

Example 4 - Class exam scores

1
Scores: {72, 85, 91, 78, 88, 76, 94, 82} - eight students (even n)
2
Sorted: 72, 76, 78, 82, 85, 88, 91, 94
3
n = 8 (even) → positions 4 and 5 → values 82 and 85
4
Median = (82 + 85) / 2 = 83.5. Mean = 83.25. Mode = No mode (all scores unique). Half the class scored below 83.5 and half above.
Try this example →

Frequently Asked Questions

How do you find the median of a dataset?+
Sort all values in ascending order. If the count n is odd, the median is the middle value at position (n+1)/2. If n is even, the median is the average of the two middle values at positions n/2 and n/2+1. Example (odd n=5): {3, 7, 9, 12, 15} → median = 9. Example (even n=6): {3, 7, 9, 12, 15, 20} → median = (9+12)/2 = 10.5.
What is the difference between median and mean?+
The mean is the arithmetic average (sum ÷ count); the median is the middle value after sorting. The mean is sensitive to outliers - a single extreme value shifts it significantly. The median is robust. Example: {1, 2, 3, 4, 100} → mean = 22, median = 3. For skewed data (income, house prices), the median is the better measure of the "typical" value.
When should I use the median instead of the mean?+
Use the median when: (1) data is skewed by outliers (e.g. income distribution, house prices, company valuations); (2) data has open-ended categories (e.g. "more than 10 years"); (3) data is ordinal rather than interval (e.g. satisfaction ratings); (4) a resistant measure of center is needed for robustness. The mean is better for symmetric distributions without outliers.
Can a dataset have multiple medians?+
No - the median is always unique. For odd n, it is the single middle value. For even n, it is the average of the two middle values. However, a dataset can have multiple modes (values that appear most frequently). If all values appear the same number of times, the dataset has no mode (or every value is a mode, depending on the convention).
What is the median of an even number of values?+
When there is an even number of values (even n), no single middle value exists. The median is defined as the average of the two values at positions n/2 and n/2+1 in the sorted list. Example: {4, 8, 15, 16} (n=4) → positions 2 and 3 → median = (8+15)/2 = 11.5. This is still a valid measure of center even if 11.5 does not appear in the data.
How is the median affected by outliers?+
The median is highly resistant to outliers. Adding or removing an extreme value only shifts the median if it changes which value(s) are in the middle position(s). Example: {2, 4, 6, 8, 10} → median = 6. Replace 10 with 10,000: {2, 4, 6, 8, 10000} → median still = 6. The mean shifts from 6 to 2004. This makes the median ideal for real-world datasets where outliers are common.
What is the weighted median?+
The weighted median accounts for the relative importance (weight) of each value. It is the value W such that the total weight of values below W equals the total weight above W. It is used in economics (weighted income distributions), signal processing, and machine learning. This calculator computes the standard (unweighted) median - all values treated equally.
What is the difference between median and mode?+
The median is the middle value (a positional measure of center). The mode is the most frequently occurring value (a measure of the most common value). Median = 6 means half of values are below 6 and half above. Mode = 6 means 6 appears more often than any other value. A dataset can have one mode (unimodal), two modes (bimodal), more modes (multimodal), or no mode (all values appear once).
How do I find the median from a frequency table?+
Sum all frequencies to get n. The median is at position (n+1)/2 (for odd n) or between n/2 and n/2+1 (for even n). Accumulate frequencies until you reach the median position. Example: values {1,2,3} with frequencies {5,3,2} (n=10) → cumulative: 5, 8, 10. Median position is between 5th and 6th. Both fall in the first group (value=1) since cumulative reaches 5 at position 5 and 8 at position 6 - wait, positions 5 falls in group 1 (cum=5) and position 6 falls in group 2 (cum=8). So median = (1+2)/2 = 1.5.
What is the median in a normal distribution?+
In a perfectly symmetric normal (bell-curve) distribution, the median equals the mean equals the mode. All three coincide at the center of symmetry. In right-skewed distributions (like income), mean > median > mode. In left-skewed distributions, mean < median < mode. The relationship between mean and median is a quick test for skewness - if they differ significantly, the data is likely skewed.