Median Calculator

Compute the median of a list of numbers — the middle value when the data is sorted.

Science Median + mean + mode Outlier robust
Rate this calculator · 5.0 (2)

Median, mean, and mode

Robust to outliers · sorts automatically

Instructions — Median Calculator

1

Enter your data

Type or paste numbers separated by commas, spaces, or new lines. The calculator parses everything that looks like a number and ignores text. You can paste straight from a spreadsheet column.

2

Read the median

The calculator sorts your data, finds the middle value, and displays it as the headline number. If you have an even count, it averages the two middle values.

3

Compare to the mean

The result panel also shows the mean. If the gap (mean minus median) is large, your data is skewed — one or more outliers are pulling the mean. Income, home prices, and reaction times are common cases.

Use median, not mean, for skewed data: US household income is right-skewed by high earners. The median ($75K, 2023) is closer to typical experience than the mean ($105K).
Median is robust to outliers: Adding a $1M outlier to a dataset of $30K incomes changes the median by zero but raises the mean dramatically.

Formulas

The median is the value separating the higher half from the lower half of a dataset after sorting. The formula depends on whether the count is odd or even.

Odd count
$$ \text{Median} = x_{(n+1)/2} $$
After sorting, the median is the single middle value. For n = 7, it is the 4th value: position (7+1)/2 = 4.
Even count
$$ \text{Median} = \frac{x_{n/2} + x_{n/2 + 1}}{2} $$
After sorting, take the average of the two middle values. For n = 4, average positions 2 and 3.
Mean for comparison
$$ \bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i $$
Sum of all values divided by count. Mean changes when any value changes. Median changes only when the middle position changes.
Mode
$$ \text{Mode} = \arg\max_x \text{count}(x) $$
The most frequent value. May not exist (uniform data) or may be multimodal (two or more equally frequent values).
Grouped data
$$ \text{Median} = L + \left(\frac{n/2 - F}{f}\right)w $$
For binned data: L is lower boundary of median class, F is cumulative frequency before it, f is frequency of the class, w is class width.
Skewness signal
$$ \text{Skew}_{Pearson} = \frac{3(\bar{x} - \text{Median})}{\sigma} $$
A quick skewness check. Positive value = right-skewed (tail of high values). Negative = left-skewed. Near zero = symmetric.

Reference

When to use median vs. mean
ScenarioUseWhy
Household incomeMedianRight-skewed by top earners
Home sale pricesMedianMansions distort the mean
Test scoresMedianRobust to bottom outliers
Reaction timesMedianA few slow trials skew mean
Height in adultsMeanSymmetric, no skew
Coin flip averagesMeanSymmetric binomial
Investment returnsMedian + MeanLook at both for skew
Survey ratings (1–5)MedianOrdinal data

Worked examples

Odd count
DataMedian
5, 8, 12, 21, 3312
1, 1, 1, 1, 1, 1, 1001
10, 20, 3020
Even count
DataMedian
10, 15, 20, 2517.5
2, 4, 6, 8, 10, 127
1, 2, 1000, 2000501

Source: NIST/SEMATECH e-Handbook of Statistical Methods, U.S. Census Bureau income reports, Britannica statistics entries.

Article — Median Calculator

Median Calculator: middle value, mean, and mode for any dataset

A median calculator finds the middle value of a sorted dataset. For an odd count, the median is the single middle value. For an even count, it is the average of the two middle values. The median is robust to outliers, unlike the mean, which is why income, home prices, and reaction-time data are reported as medians.

The calculation is fast in code (O(n log n) for the sort, O(1) for the lookup) but easy to get wrong by hand — the most common errors are forgetting to sort first and counting positions from zero instead of one. This calculator handles both edge cases automatically and shows the sorted data so you can verify.

What is a median calculator

A median calculator returns the middle value of a list of numbers. It is one of three measures of central tendency — the others being mean (average) and mode (most frequent value). All three give a single number meant to represent the "typical" value of a dataset, but they answer slightly different questions.

The median answers: "What value separates the higher half from the lower half?" The mean answers: "If we distributed the total evenly, what would each unit get?" The mode answers: "Which value occurs most often?" For symmetric data, all three agree closely. For skewed data, they diverge — and the gap is itself useful information.

Did you know

The word "median" comes from Latin medianus, meaning "in the middle." It entered statistical usage in the 1880s, popularized by Sir Francis Galton, who argued that the median was the proper measure of central tendency for non-normal distributions — a position that was controversial at the time but is now standard practice.

The median formula

Two cases, depending on whether the data count is odd or even:

Median formulas
Sort x₁ ≤ x₂ ≤... ≤ xₙ
n odd median = x at position (n+1)/2
n even median = (x at n/2 + x at n/2+1) ÷ 2

Example with odd count: data = 12, 8, 21, 5, 33, 17, 9. Sort: 5, 8, 9, 12, 17, 21, 33. n = 7, middle position is (7+1)/2 = 4. The 4th value is 12. Median = 12.

Example with even count: data = 10, 15, 20, 25. Already sorted. n = 4, take the average of positions 2 and 3 (15 and 20). Median = 17.5.

Median vs. mean vs. mode

Each measure has a use case:

  • Mean (average): Sensitive to every value, including extremes. Best for symmetric, normally-distributed data. The basis for variance and standard deviation.
  • Median (middle): Robust to outliers and skew. Better for income, home prices, reaction times, and any right-skewed data.
  • Mode (most frequent): The only measure that works for non-numeric categorical data. Less useful for continuous data where exact duplicates are rare.

A revealing dataset: 25, 28, 30, 32, 1000. Mean = 223. Median = 30. Mode: no mode (all unique). The single $1,000 value pulls the mean to 223, far from the "typical" value of about 30. The median resists this distortion.

When to use median

Several real-world domains default to median rather than mean:

  • Household income: Right-skewed by top earners. US median household income was about $80,610 in 2023 (US Census ACS); mean about $114K. The median better represents typical American experience.
  • Home prices: A few mansion sales distort the mean. Real-estate sites and the FHFA report median sale prices for the same reason.
  • Test scores: Educators use medians to avoid distortion from a small number of very low or very high scorers.
  • Reaction times: Psychology and HCI use median RT — the right tail of slow responses (distraction, blinks) skews means upward.
  • Wait times: Hospital triage and customer service measure median wait time. A few extreme delays should not define typical experience.
Tip

If you ever see "average" reported without specifying mean or median, assume mean and ask yourself whether the data is skewed. Headlines about "average household income" usually report the mean, which is consistently higher than the typical experience.

Median with outliers

The median is famously robust to outliers, but "robust" is not the same as "unaffected." Adding a single extreme value does not move the median if the count stays odd or the two middle values stay the same. But adding enough extreme values, or adding values that change which positions count as "middle," does shift the median.

Quantitatively: the breakdown point of the median is 50%. You can change up to half the data values arbitrarily and the median remains stable, as long as the remaining values still bracket the original median. The mean's breakdown point is 0% — a single value can move the mean as far as you like.

Median of grouped data

When you only have histograms or binned survey data, individual values are gone. The median estimate uses linear interpolation within the median class — the class that contains the n/2-th observation.

Grouped median formula
Median = L + (n/2 - F)/f × w
L = lower boundary of median class
F = cumulative frequency before class
f = frequency of median class
w = class width

This is the standard formula in introductory statistics and is what spreadsheet plug-ins like Excel's QUARTILE and Python's pandas use under the hood for binned data.

Median in real-world statistics

The US Census Bureau reports median household income annually as the primary measure. The reason is concrete: the top 1% of earners have incomes 100 times the median, which distorts the mean by tens of thousands of dollars. Policy decisions based on the mean would misrepresent the typical American household.

Similarly, the National Association of Realtors reports median home prices, the BLS reports median wages, and the OECD reports median inequality measures internationally. When you see "the average" in a finance or social-science context, it is often the median in disguise — or, sometimes, the mean used carelessly.

Pitfall: never average medians

If you have three datasets and the medians are 10, 20, and 30, the median of the combined dataset is not 20. Medians do not aggregate linearly. To get the combined median, you must combine the raw data and re-sort. This trips up dashboard builders who try to weighted-average median values from sub-groups.

Common median mistakes

The most common error is forgetting to sort the data first. The median is undefined for unsorted data — you must sort. Spreadsheet formulas like MEDIAN() and statistical software handle this internally, but hand calculations skip it surprisingly often.

The second error is confusing position with value. For data 5, 10, 15, 20, 25, the middle position is 3 and the middle value is 15. People sometimes report "3" as the median, which is the index, not the value.

The third error is using the median for variance or standard deviation calculations. Both of those measures are built on the mean. Substituting the median produces something called the "median absolute deviation" (MAD), which is a different statistic with different interpretation.

FAQ

The median is the middle value of a dataset when sorted in ascending order. For 5 numbers, it is the 3rd value. For 6 numbers, it is the average of the 3rd and 4th values. It is one of three measures of central tendency, alongside mean and mode.
Three steps: sort the data ascending, count how many values there are (n), then return the middle value. If n is odd, return position (n+1)/2. If n is even, average positions n/2 and (n/2)+1. This calculator does it automatically — paste your numbers in.
The mean is the sum divided by count — it uses every value. The median is the middle position after sorting — it ignores values far from the center. For symmetric data they are equal. For skewed data (income, home prices, reaction times) they diverge significantly.
Use the median when your data is skewed, contains outliers, or is ordinal (1-to-5 ratings). Use the mean when the data is symmetric and you need to preserve all values for downstream math like variance or standard deviation.
It ignores them. Adding a $1 million value to a list of $30,000 incomes does not change the median — only the values at the middle position matter. The same change moves the mean dramatically. This is why median household income is reported more often than mean.
Yes, when the data is perfectly symmetric around its center. A normal distribution has equal mean, median, and mode. Real-world data is rarely that symmetric — even body height has slight skew. A small gap is normal; a large gap indicates skew.
For an even count, the standard convention is to average the two middle values. Some statistical fields use other conventions: the lower or upper middle value alone, or interpolated quantiles. The "mean of two middles" rule is the consensus in introductory statistics and Python's NumPy.
Use linear interpolation in the median class: Median = L + ((n/2 - F) / f) × w, where L is the lower class boundary, F is cumulative frequency below it, f is class frequency, and w is class width. This handles histograms and binned survey data where individual values are not preserved.