What Is the Median and Why Does It Resist Outliers?

The median (also labeled Q₂ or the 50th percentile) is the exact middle value dividing an ordered list of numbers into two equal halves: 50% of values sit at or below the median, and 50% sit at or above it.

Unlike the arithmetic mean, which sums every value and lets a single extreme outlier drag the average wildly higher or lower, the median depends strictly on sorted rank position. Whether the highest home price on a street is $400,000 or $40,000,000, the middle home's median price stays locked right where it is! Alongside the median, our calculator automatically produces the complete five-number summary (Min, Q1, Median, Q3, Max), Interquartile Range (IQR), Tukey outlier detection fences, and a live Box-and-Whisker plot.

Median Formulas: Odd Count vs. Even Count

Before counting middle ranks, you must sort your dataset from smallest to largest (x₍₁₎ ≤ x₍₂₎ ≤ … ≤ x₍ₙ₎). Once sorted, the exact median rule depends solely on whether the count N is odd or even:

Odd Count (N = 1, 3, 5, 7…): Median = x[(N + 1) ÷ 2]
Even Count (N = 2, 4, 6, 8…): Median = ( x[N ÷ 2] + x[(N ÷ 2) + 1] ) ÷ 2
Interquartile Range (IQR): IQR = Q₃ − Q₁
Tukey Outlier Fences: Lower = Q₁ − 1.5 × IQR | Upper = Q₃ + 1.5 × IQR
  • When N is Odd: One unique item sits dead center with an equal number of elements on both sides. If N = 7, position (7 + 1) ÷ 2 = 4th value is the median.
  • When N is Even: No single value sits alone in the middle, so you average the two innermost ranked numbers at positions N ÷ 2 and (N ÷ 2) + 1. If N = 6, average the 3rd and 4th sorted entries.
Median formula infographic contrasting odd N=7 middle rank 4 (=22) with even N=6 average of ranks 3 and 4 (22 and 28 = 25)
Diagram 1: Finding the median when N is odd (single center rank) versus when N is even (midpoint of the two middle ranks).

2 Worked Examples

Example 1: Odd Dataset & Five-Number Summary ([12, 15, 18, 22, 24, 29, 34])

Suppose a teacher records 7 student lab completion times (sorted from fastest to slowest): 12, 15, 18, 22, 24, 29, 34 minutes. Find the median, quartiles, and check for outliers:

  1. Check count and center rank: With N = 7 (odd), calculate (7 + 1) ÷ 2 = 4th value. Counting from left (#1: 12, #2: 15, #3: 18, #4: 22), the median is 22 minutes.
  2. Find Lower Quartile (Q₁): Take the lower half strictly below the median: [12, 15, 18]. Its middle item is 15 (Q₁ = 15).
  3. Find Upper Quartile (Q₃): Take the upper half strictly above the median: [24, 29, 34]. Its middle item is 29 (Q₃ = 29).
  4. Compute IQR and Outlier Fences: IQR = 29 − 15 = 14. The fences run from 15 − 1.5(14) = −6 up to 29 + 1.5(14) = 50, confirming zero outliers exist inside this batch.

Example 2: Even Dataset With Outlier ([14, 19, 22, 28, 35, 92]) Plus Tukey Fence Test

Now suppose 6 daily customer support wait times (in seconds) are sorted as 14, 19, 22, 28, 35, 92, where one escalation ticket took 92 seconds. Find the median and compare it to the mean; then test [42, 46, 48, 50, 52, 54, 130] with Tukey fences:

  • Even count middle pair (N = 6): Find positions 6 ÷ 2 = 3rd (22) and 4th (28). Average them: (22 + 28) ÷ 2 = 25 seconds. Notice how completely different this is from the arithmetic mean (210 ÷ 6 = 35 seconds), which got pulled +10 seconds higher by the single 92 spike!
  • Outlier detection on [42, 46, 48, 50, 52, 54, 130]: Here Median = 50, lower half [42, 46, 48] gives Q₁ = 46, upper half [52, 54, 130] gives Q₃ = 54, so IQR = 54 − 46 = 8. Multiplying 1.5 × 8 = 12 puts the Upper Fence at 54 + 12 = 66. Because 130 > 66, Tukey's rule immediately flags 130 as an extreme high outlier!

Five-Number Summary, Quartiles & Box-and-Whisker Plots

The median rarely travels alone in serious statistical analysis. Because the median splits data at the 50% mark, repeating the exact same splitting process on each half creates the Five-Number Summary (Minimum, Q₁, Median, Q₃, Maximum), visualized directly as a Box-and-Whisker plot.

Box-and-whisker anatomy diagram highlighting Min, Q1 (25%), Median Q2, Q3 (75%), IQR box, upper fence Q3 + 1.5*IQR, and high outlier
Diagram 2: Anatomy of a Box-and-Whisker plot showing how the shaded IQR box spans the central 50% of observations around the Median.

Median vs. Mean Across Skewed & Symmetric Distributions

How do you decide whether to lead your report with the median or the mean? Comparing both numbers together diagnoses skewness instantaneously:

Three distribution curves comparing right-skewed (Median < Mean), symmetric bell (Mean = Median = Mode), and left-skewed (Mean < Median)
Diagram 3: Comparing Mean and Median across right-skewed, symmetric bell, and left-skewed curves.
Distribution Shape Mean vs. Median Real-World Examples Recommended Center + Spread
Symmetric (Bell-Shaped) Mean ≈ Median Adult heights, standardized exam grades, sensor noise Mean + Standard Deviation
Right-Skewed (Positive) Median < Mean Household incomes, house prices, page load latency Median + IQR (Box Plot)
Left-Skewed (Negative) Mean < Median Easy classroom quizzes, retirement ages, failure lifetimes Median + IQR (Box Plot)

Real-World Uses Where Median Beats Mean

Official agencies, technology teams, and economists prioritize the median whenever extreme tails exist:

  • Salaries & Household Income Censuses: One executive billionaire moving into a town skyrockets the town's arithmetic mean income while leaving the typical family's experience untouched. Census bureaus report median household income so skewed wealth never distorts policy statistics.
  • Real Estate Home Values: A single waterfront estate selling for 10 times neighborhood average skews mean prices upward. Buyers and appraisers track median sold price per ZIP code instead.
  • Web Performance & Latency SLAs (p50 / p95): Software reliability engineers track p50 (median) response time alongside p95 and p99 tails because rare network timeouts drag average latency far above typical user experience.
  • Clinical & Survival Studies: Medical researchers report median survival time when small cohorts respond extraordinarily well or poorly, preventing skewed averages from misleading patients.

Grouped Frequency Tables & Why Median Minimizes Total Distance

In real-world surveys and census reports, numbers often arrive grouped into frequency counts or bracketed intervals (for example, age bands 20–29, 30–39, 40–49) instead of raw individual rows. You can still recover the median cleanly without listing thousands of duplicate rows:

  • Ungrouped Frequency Table: Build a running cumulative frequency column until the running total first equals or crosses (N + 1) ÷ 2 (odd) or sits between N ÷ 2 and (N ÷ 2) + 1 (even). Look up the corresponding value directly.
  • Grouped Class Interval Estimation: Find the median class containing the N ÷ 2 item and interpolate inside that class width w using Estimated Median = L + [ (N ÷ 2 − F) ÷ f ] × w, where L is the lower boundary of the median class, F is cumulative frequency before the class, and f is the frequency inside the median class.
  • Minimum Absolute Error Optimality: Mathematically, the median is the unique point c that minimizes the sum of absolute distances Σ |xᵢ − c|! That explains why warehouse site planners locate a central distribution hub at the median customer coordinate when total straight-line delivery distance matters more than squared error.

Finding Median in Excel, Google Sheets & Python

Note that spreadsheet software uses exclusive (.EXC) and inclusive (.INC) quartile conventions. Here are the exact functions matching standard reports:

Excel / Sheets Median: =MEDIAN(A2:A10)
Quartiles (Textbook Exclusive): =QUARTILE.EXC(A2:A10, 1) | =QUARTILE.EXC(A2:A10, 3)
Quartiles (Inclusive Default): =QUARTILE.INC(A2:A10, 1) | =QUARTILE.INC(A2:A10, 3)
Python (statistics module): statistics.median(data), statistics.quantiles(data, n=4)

5 Common Median Mistakes to Avoid

  1. Counting the Middle Position Without Sorting First: Taking the middle number of unsorted data ([30, 10, 50] and picking 10) yields total nonsense. Always sort smallest to largest first!
  2. Including the Median Inside Q₁ and Q₃ for Odd Counts: Under the standard textbook (OpenStax / Tukey) exclusive method used here, when N is odd, exclude the center median itself before finding the medians of the lower and upper halves. (Some inclusive software formulas keep the center point, which shifts Q₁ slightly on small odd datasets.)
  3. Confusing Mean With Median on Even Lists: When N is even, you only average the two innermost numbers (not the whole dataset!).
  4. Dropping Duplicate Values Before Ranking: If a number appears multiple times ([10, 20, 20, 20, 50]), keep every duplicate copy in the sorted list when counting ranks!
  5. Reporting Median Without IQR or Range: Two datasets can both have Median = 50 while one spans 48–52 and another spans 5–95. Pair Median with IQR (Q₃ − Q₁) to describe both center and spread cleanly.

Related Statistics & Math Calculators

Compare position and spread across our Math & Statistics hub:

See how Staticnexa tests ranking edge cases and quartile conventions across tools in our Editorial & Mathematical Accuracy Policy.

Frequently Asked Questions

How do you find the median when there is an even number of values?

First sort the values from smallest to largest. When the count N is even, locate the two middle values at positions N/2 and (N/2) + 1, add them together, and divide by 2. For [14, 19, 22, 28, 35, 92], the middle two are 22 and 28, giving (22 + 28) / 2 = 25.

What is the median when N is odd?

Sort the numbers in ascending order and pick the single item sitting at rank position (N + 1) / 2. For 7 sorted numbers, the 4th item is the exact median.

When should I use the median instead of the mean?

Use the median whenever your data has extreme outliers or skewness (like home prices, salaries, or response latencies). Unlike the mean, extreme values do not pull the median off center.

Why might my Q1 and Q3 differ slightly from another software tool?

There are two common quartile conventions: the exclusive textbook method (used by TI-84 calculators, AP Statistics, OpenStax, and Excel QUARTILE.EXC) excludes the middle element on odd N before halving, whereas Excel QUARTILE.INC interpolates inclusively. Both always agree on the Median (Q2) itself.

How does the 1.5 x IQR outlier rule work?

Compute IQR = Q3 - Q1. Any value lower than Q1 - 1.5 x IQR or higher than Q3 + 1.5 x IQR is flagged as a statistical outlier on a Tukey Box-and-Whisker plot.

Do repeated duplicate numbers stay in the list when calculating the median?

Yes! Always keep every repeated observation in the sorted array so frequencies weigh into the median rank accurately.

Mathematical References & Standards