Median Calculator

The median is the middle value of a dataset once it is sorted. For 12, 7, 3, 9, 15, 21, 5 the sorted list is 3, 5, 7, 9, 12, 15, 21 and the median is 9. With an even count, the median is the average of the two middle values.

Last updated · By · Runs in your browser, nothing is uploaded

Result

Step-by-Step Solution

Enter your values above to see the full working.

What Is the Median?

The median is the value that splits an ordered dataset into two equal halves: half of the values are at or below it and half are at or above it. It is one of the three main measures of central tendency, alongside the mean and mode.

Its great strength is that it ignores how extreme the extremes are. If the largest value in your dataset doubles, the median does not move, while the mean shifts noticeably. That is why official statistics on household income, house prices and waiting times are normally reported as medians.

Median vs Mean

MedianMean
What it isMiddle value of sorted dataSum divided by count
Affected by outliersVery littleStrongly
Best forSkewed data: income, prices, durationsSymmetric data with no extreme values
Uses every valueNo, only the positionYes
For 3, 5, 7, 9, 12, 15, 21910.2857

Median Formula

Sort the values from smallest to largest, then use the rule that matches your count n:

If n is odd: Median = value at position (n + 1) ÷ 2 If n is even: Median = average of the values at positions n ÷ 2 and (n ÷ 2) + 1
  • n is the number of values in the dataset.
  • A position is the place in the sorted list, counting from 1.
  • With an odd count there is exactly one middle value. With an even count there are two, so we take their mean.

The median can be a number that does not appear in your data. The median of 4, 6, 8, 10 is (6 + 8) ÷ 2 = 7.

Worked Example: Finding the Median

Odd number of values

The preloaded data is 12, 7, 3, 9, 15, 21, 5.

  1. Sort: 3, 5, 7, 9, 12, 15, 21.
  2. Count: n = 7, which is odd.
  3. Find the position: (7 + 1) ÷ 2 = 4.
  4. The 4th value is 9, so the median is 9.

Even number of values, with an outlier

Six homes sell for (in thousands) 210, 225, 240, 255, 270 and 2,400.

  1. The data is already sorted and n = 6, which is even.
  2. The middle positions are 3 and 4, holding 240 and 255.
  3. Median = (240 + 255) ÷ 2 = 247.5, or $247,500.
  4. The mean is 3,600 ÷ 6 = 600, or $600,000, which is more than double what five of the six homes sold for.

The single $2.4 million sale drags the mean far above a typical price, while the median stays representative.

How to Use This Median Calculator

  1. Enter your numbers separated by commas, spaces or new lines. They do not need to be sorted.
  2. The calculator sorts them and shows the median immediately.
  3. Check the count, the position of the median, the lowest and highest values and the sorted list in the results.
  4. Open the step-by-step solution to see exactly which position was used.

For the quartiles that sit either side of the median, use the quartile and IQR calculator or the five-number summary calculator.

Real-World Uses of the Median

  • Economics: median household income and median home price describe a typical household without being distorted by a few very wealthy ones.
  • Healthcare: median survival time and median length of stay are standard in clinical reports because individual outcomes vary widely.
  • Technology: engineers track median page load time and median response time, usually alongside the 95th percentile, because averages hide slow outliers.
  • Real estate and retail: median sale price and median basket size give a stable picture even with a few extreme transactions.
  • Education: median exam scores show what the middle student achieved when a few very low or very high marks would skew the mean.

Median, Quartiles and Percentiles

The median is the 50th percentile and the second quartile (Q2). The first quartile (Q1) is the median of the lower half and the third quartile (Q3) is the median of the upper half. Together they make up the five-number summary used in box plots. The distance between Q3 and Q1, the interquartile range, is a spread measure that is as robust to outliers as the median itself.

A Quick Way to Check Your Answer

Cross off the smallest and largest values in pairs. The value (or pair of values) left at the end is the median. For 3, 5, 7, 9, 12, 15, 21 you remove 3 and 21, then 5 and 15, then 7 and 12, leaving 9.

What Are the Most Common Mistakes With the Median Calculator?

  • Not sorting first. The middle item of an unsorted list is meaningless.
  • Taking the middle of an even set. With an even count you must average the two central values.
  • Miscounting positions. For n = 9 the median is the 5th value, not the 4th or 4.5th.
  • Dropping duplicates. Repeated values are separate data points. Removing them changes the median.
  • Assuming it equals the mean. They only coincide for symmetric data.
  • Ignoring the rest of the distribution. The median says nothing about spread, so pair it with the range or interquartile range.

Where Can You Verify These Formulas?

The definitions and formulas on this page follow standard references. Check them against these sources:

Built and maintained by S. Dilshan. Found a mistake? Email [email protected] with the page address.

Frequently Asked Questions

How do you find the median?

Sort the numbers from smallest to largest. If there is an odd count, the median is the middle value. If the count is even, it is the average of the two middle values. For 3, 5, 7, 9, 12, 15, 21 the median is 9.

Why use the median instead of the mean?

Use the median when your data is skewed or contains outliers, such as incomes or house prices. A few extreme values pull the mean away from the typical case, but they barely affect the median.

What is the median of an even number of values?

Average the two middle values. For 4, 6, 8, 10 the middle values are 6 and 8, so the median is 7.

Can the median be a decimal or a value not in the data?

Yes. With an even count the median is the average of two values, so it can be a number that is not in the dataset, such as 247.5 in the home price example.

Is the median always in the middle of the range?

No. The median is the middle by position, not by value. In skewed data it can sit much closer to the minimum or maximum than to the midpoint of the range.

What is the difference between median and mode?

The median is the middle value of sorted data, while the mode is the most frequently occurring value. A dataset can have one median but several modes, or none.