Find the Median

Every dataset hides a central point that divides it into two equal halves. That point is the median – one of the most important measures of central tendency in statistics. Unlike the arithmetic mean, the median ignores how extreme the highest and lowest values are, which makes it the go-to metric for skewed distributions such as household income, rent prices, or medical costs.

Data Set Input Use commas or spaces to separate your values.

What Is the Median?

The median is the value separating the higher half from the lower half of a sorted dataset. Formally, it is the number at position (n + 1) / 2 when n values are arranged in ascending order. If n is even, the median equals the arithmetic mean of the two central values.

Key properties of the median:

  • Robust to outliers. A single extreme value (say, $5,000,000 in a list of salaries) barely shifts the median, while the mean can jump dramatically.
  • Works with ordinal data. Even when data can only be ranked (e.g., customer ratings: poor → fair → good → excellent) but not averaged meaningfully, the median still applies.
  • Unique for every dataset. Any set of real numbers has exactly one median.

How to Find the Median Step by Step

Regardless of dataset size, the procedure follows three stages:

  1. Sort all values in ascending order (smallest to largest).
  2. Count the number of values – denote it n.
  3. Locate the middle position:
    • n is odd → the median is the single middle value.
    • n is even → the median is the mean of the two middle values.

Finding the Median of an Odd-Numbered Dataset

Dataset: 12, 3, 7, 18, 5

Step 1 – Sort: 3, 5, 7, 12, 18

Step 2 – Count: n = 5 (odd)

Step 3 – Position: (5 + 1) / 2 = 3 → the 3rd value

Median = 7

Visually, 7 sits exactly in the center with two values on each side.

Finding the Median of an Even-Numbered Dataset

Dataset: 12, 3, 7, 18, 5, 22

Step 1 – Sort: 3, 5, 7, 12, 18, 22

Step 2 – Count: n = 6 (even)

Step 3 – Positions: n / 2 = 3 and (n / 2) + 1 = 4 → 7 and 12

Median = (7 + 12) / 2 = 9.5

Because there is no single middle value, the median falls between the two central numbers.

Median Formula

For a sorted dataset x₁ ≤ x₂ ≤ … ≤ xₙ:

Dataset sizeMedian formula
n is oddx₍n+1₎/₂
n is even(xₙ/₂ + x₍n/₂₎₊₁) / 2

The subscripts refer to positions in the sorted array, not the original order.

Median vs Mean vs Mode

These three measures each describe “the center” of data, but they do it differently.

PropertyMedianMean (Average)Mode
DefinitionMiddle valueSum ÷ countMost frequent value
Affected by outliersNoYesNo
Requires numerical dataOrdinal or numericalNumerical onlyAny type
Always existsYesYesNot always
Typical useSkewed distributionsSymmetric distributionsCategorical data

Example showing the difference: In the set {1, 2, 2, 3, 100}:

  • Mean = (1 + 2 + 2 + 3 + 100) / 5 = 21.6
  • Median = 2
  • Mode = 2

The mean is pulled far from the “typical” value by the outlier 100. The median and mode both correctly represent the cluster around 2.

When to Use the Median

Choose the median over the mean in these situations:

  • Income and wealth data. The U.S. Census Bureau reports median household income precisely because billionaire earnings distort the mean.
  • Real estate prices. A handful of luxury mansions can double the average home price while leaving the median nearly unchanged.
  • Reaction times or response latencies in experiments. These distributions are typically right-skewed with occasional very long delays.
  • Likert-scale surveys. Responses such as “strongly disagree” through “strongly agree” are ordinal; averaging them is statistically questionable, but finding the median is valid.
  • Test scores with ceiling or floor effects. If almost everyone scores near the maximum, the median better reflects the group’s performance.

Common Mistakes When Finding the Median

  • Skipping the sort. The most frequent error – picking the middle element of the unsorted array.
  • Averaging incorrectly for even n. Simply picking one of the two middle numbers instead of computing their mean.
  • Confusing median and mean. Especially in word problems where “average” is used loosely to mean “typical.”
  • Ignoring repeated values. Duplicates still occupy their own position in the sorted list; do not collapse them.

This article is for educational purposes. For formal statistical analysis, consult a qualified statistician or the relevant methodological guidelines.

Frequently Asked Questions

What is the difference between median and average?
The median is the middle value in an ordered dataset, while the average (mean) is the sum of all values divided by the count. The median is less affected by extreme outliers, making it more reliable for skewed distributions like income or housing prices.
Can the median be a decimal?
Yes. When a dataset has an even number of values, the median is the arithmetic mean of the two central numbers, which often produces a decimal result – for example, (7 + 11) / 2 = 9.0.
What happens if all values in a dataset are the same?
If every value in the dataset is identical, the median equals that value regardless of how many data points exist. For instance, the median of {5, 5, 5, 5} is 5.
Do I need to sort the data before finding the median?
Yes. Arranging values in ascending (or descending) order is an essential first step. Finding the middle of an unsorted dataset will give an incorrect result.
How is the median used in real life?
Governments and research agencies report median household income, median home prices, and median test scores because these figures are not skewed by extremely high or low values, unlike the arithmetic mean.
Does the median work with grouped or frequency data?
Yes, but the process differs. For grouped data you identify the median class – the interval containing the middle observation – and interpolate using a specific formula that accounts for cumulative frequencies.
What is the median formula for odd versus even datasets?
For n odd: median = value at position (n + 1) / 2. For n even: median = average of values at positions n / 2 and (n / 2) + 1. In both cases the data must be sorted first.
  1. Median Calculator
  2. 5 Number Summary Calculator
  3. Mode Median Mean Calculator
  4. Weighted Average Calculator & Formula
  5. Calculate Standard Deviation on Calculator
  6. Calculator Percentile