What Is the Median? (Definition)
The median is one of the three main measures of central tendency, alongside the mean and the mode. While the mean sums all values and divides by the count — making it sensitive to every number in the dataset — the median is sensitive only to rank order. A single billionaire in a room of middle-class workers changes the mean income dramatically but does not change the median at all, as long as they remain the highest earner.
This property is called robustness or resistance to outliers. It is the reason statisticians, economists, demographers, and data scientists choose the median whenever data is skewed or contains extreme values. Understanding the median through concrete examples is the fastest route to knowing when and why to use it — which is exactly what this guide provides.
The median is the middle value in a sorted dataset: for odd-numbered datasets it is the single center value, and for even-numbered datasets it is the average of the two center values.
Median Formula
There are two cases depending on whether the number of observations (n) is odd or even.
n = number of observations
xi = the value at position i in sorted data
(n+1)/2 = position of the middle value
xn/2 = lower middle value
x(n/2)+1 = upper middle value
Average the two middle values
- Odd n (e.g., n = 5): Middle position = (5+1)/2 = 3rd value
- Even n (e.g., n = 6): Middle positions = 3rd and 4th values → average them
- Always sort first — without ordering, the formula produces a meaningless result
- Ties are fine: Repeated values do not affect the procedure
- Units stay the same: The median of test scores is still a score, not a ratio or index
How to Find the Median (3 Steps)
Step 1: Sort all values in ascending order. Step 2: Count the values (n). Step 3: If n is odd, take the middle value; if n is even, average the two middle values.
Arrange All Values in Ascending Order
Sort the data from the smallest value to the largest. This step is non-negotiable — the position of values in the sorted list is the entire basis for finding the median. You can sort in descending order instead and reach the same answer, but ascending is the convention.
Count the Total Number of Values (n)
Count every data point, including any repeated values. The count n determines whether you have an odd or even dataset and tells you which position(s) to look at. For example, if you have 9 values, the middle position is (9+1)/2 = 5th.
Locate the Middle Value and State the Median
If n is odd: the median is the single value at position (n+1)/2. If n is even: the median is the arithmetic mean of the values at positions n/2 and (n/2)+1. The result carries the same units as the original data.
Median Examples — Odd Number of Values
When a dataset has an odd count of values, there is always one unambiguous middle value. No averaging is needed.
Example 1 — Student Exam Scores (Odd Dataset)
A statistics professor records the midterm scores of 7 students: 62, 78, 91, 55, 84, 70, 88. What is the median score?
Sort in ascending order: 55, 62, 70, 78, 84, 88, 91
Count the values: n = 7 (odd)
Find the middle position: (7 + 1) / 2 = position 4. The 4th value in the sorted list is 78.
✅ Median = 78. Half the students scored below 78 and half scored above. The mean of these scores is 75.4 — slightly lower, pulled down by the low score of 55. The median better represents the typical student's performance.
Example 2 — Daily Temperatures (Odd Dataset)
A meteorologist records daily high temperatures (°F) for 9 days: 74, 68, 82, 71, 91, 66, 78, 75, 80. Find the median temperature.
Sort: 66, 68, 71, 74, 75, 78, 80, 82, 91
Count: n = 9 (odd)
Middle position: (9 + 1) / 2 = 5th value = 75°F
✅ Median = 75°F. The mean is 76.1°F, only slightly higher. Notice the outlier of 91°F pulls the mean up but has no effect on the median — the median is entirely determined by position, not magnitude.
Example 3 — Employee Salaries with an Outlier
A small marketing agency has 5 employees with annual salaries: $42,000 | $45,000 | $48,000 | $51,000 | $210,000 (the CEO). Find the median salary and compare it to the mean.
Sort: $42,000 | $45,000 | $48,000 | $51,000 | $210,000
Count: n = 5 (odd)
Middle position: (5 + 1) / 2 = 3rd value = $48,000
✅ Median = $48,000. Mean = ($42K + $45K + $48K + $51K + $210K) / 5 = $396K / 5 = $79,200. The mean is inflated by 65% relative to the median because of the CEO's salary. A job applicant researching salaries would get a very misleading impression from the mean. The median accurately reflects what 3 out of 5 employees actually earn.
This salary example mirrors why the U.S. Census Bureau, the Office for National Statistics (UK), and Statistics Canada all use median household income in their official reports. A small number of very high earners inflate the mean, making it unrepresentative of the typical household's experience.
Median Examples — Even Number of Values
When a dataset has an even count, there is no single middle value. The median is calculated as the average of the two central values. This sometimes produces a number that does not appear in the original dataset, which is normal and correct.
Example 4 — House Prices in a Neighborhood
A real estate analyst records the selling prices of 8 homes in a neighborhood (in $thousands): 285, 310, 340, 295, 2,100, 320, 305, 330. Find the median home price.
Sort in ascending order: 285, 295, 305, 310, 320, 330, 340, 2,100 (thousands)
Count: n = 8 (even). The two middle positions are 8/2 = 4th and (8/2)+1 = 5th.
Average the two middle values: 4th value = 310 | 5th value = 320
Median = (310 + 320) / 2 = 630 / 2 = $315,000
✅ Median = $315,000. Mean = $4,285K / 8 = $535,625 — inflated by the $2.1M property to nearly 70% above what 6 of the 8 homes actually sold for. The median of $315,000 is the figure a home buyer or seller would recognize as representative of the neighborhood. This is exactly why the National Association of Realtors and housing market reports worldwide use the median, not the mean.
Example 5 — Hospital Patient Waiting Times
A hospital emergency department records waiting times (in minutes) for 10 patients in one shift: 12, 8, 45, 18, 6, 22, 137, 15, 10, 20. Find the median waiting time.
Sort: 6, 8, 10, 12, 15, 18, 20, 22, 45, 137
Count: n = 10 (even). Middle positions: 5th and 6th.
Average middle values: 5th = 15 | 6th = 18
Median = (15 + 18) / 2 = 33 / 2 = 16.5 minutes
✅ Median = 16.5 minutes. Mean = 293 / 10 = 29.3 minutes — skewed upward by the 45-minute and 137-minute waits. A hospital administrator reporting the mean would suggest performance far worse than what most patients experienced. The median of 16.5 minutes tells a more truthful story about the typical patient's wait.
Example 6 — Product Ratings
An online retailer receives 12 product ratings on a 1–10 scale: 9, 8, 10, 7, 9, 6, 10, 8, 1, 9, 8, 10. Find the median rating.
Sort: 1, 6, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10
Count: n = 12 (even). Middle positions: 6th and 7th.
6th value = 8 | 7th value = 9
Median = (8 + 9) / 2 = 8.5
✅ Median = 8.5. One unusually low rating of 1 (perhaps a spam review) pulled the mean down to 8.08 but barely touches the median. The median of 8.5 better represents the experience of most customers who gave ratings of 8, 9, or 10.
How Outliers Affect the Median vs Mean
The most important practical reason to know the median is understanding how it behaves in the presence of outliers. An outlier is a value far outside the typical range of a dataset. The mean incorporates every value equally, so one extreme observation can shift it substantially. The median cannot be moved unless the outlier crosses the center position.
Example 7 — Household Income with an Extreme Outlier
A small neighborhood has 7 households with annual incomes: $38,000 | $42,000 | $46,000 | $50,000 | $54,000 | $58,000 | $1,200,000. Compare the mean and median income.
Data is already sorted.
Count: n = 7 (odd). Middle position = (7+1)/2 = 4th value.
Median = $50,000 (4th value).
Mean = (38K + 42K + 46K + 50K + 54K + 58K + 1,200K) / 7 = 1,488K / 7 = $212,571
✅ The median is $50,000. The mean is $212,571 — 4.25× higher than what 6 of 7 households actually earn. Reporting the mean would mislead anyone trying to understand living standards in this neighborhood. The U.S. Census Bureau faced exactly this problem at a national scale, which is why its official statistic is median household income.
| Scenario | Median | Mean |
|---|---|---|
| 7 incomes, one at $1.2M | $50,000 ← representative | $212,571 ← inflated |
| Replace $1.2M with $100,000 | $50,000 ← unchanged | $61,143 ← closer to typical |
| Replace $1.2M with $60,000 | $50,000 ← still unchanged | $49,714 ← now accurate |
Table: The median does not change across scenarios as long as the same value remains the 4th-highest. The mean shifts dramatically with every change to the outlier.
More Real-Life Median Examples
Example 8 — NBA Player Points Per Game
A basketball analyst records points per game for 9 players on a roster: 28.4, 14.2, 11.8, 6.3, 18.7, 4.1, 22.5, 9.6, 16.0. Find the median scoring average.
Sort: 4.1, 6.3, 9.6, 11.8, 14.2, 16.0, 18.7, 22.5, 28.4
Count: n = 9 (odd). Middle position = 5th value.
Median = 14.2 points per game (5th value).
✅ Median = 14.2 PPG. The mean is 14.6 PPG — close to the median here because the distribution is not heavily skewed. In symmetric distributions, the mean and median converge. Sports analysts use medians when comparing teams with one superstar (outlier) who would inflate the mean beyond the typical player's contribution.
Example 9 — Monthly Website Traffic
A website records monthly visitor counts (in thousands) over 12 months: 42, 38, 51, 47, 44, 89, 41, 46, 43, 39, 48, 45. Find the median monthly traffic.
Sort: 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 51, 89
Count: n = 12 (even). Middle positions: 6th and 7th.
6th value = 44K | 7th value = 45K
Median = (44 + 45) / 2 = 44,500 visitors
✅ Median = 44,500 visits/month. The mean is 47,750 — inflated by a viral month with 89,000 visits (perhaps from a single article that went viral). A marketing manager setting a realistic baseline would use the median to represent typical monthly traffic, not the mean that includes a one-off event.
Example 10 — Clinical Trial Response Times
In a clinical trial, 11 participants show the following time-to-response (in hours) to a new medication: 2.1, 1.8, 3.4, 2.7, 1.5, 4.2, 2.3, 1.9, 2.6, 2.0, 3.1. Find the median response time.
Sort: 1.5, 1.8, 1.9, 2.0, 2.1, 2.3, 2.6, 2.7, 3.1, 3.4, 4.2
Count: n = 11 (odd). Middle position = (11+1)/2 = 6th value.
Median = 2.3 hours (6th value).
✅ Median = 2.3 hours. In clinical reporting, the median time-to-event (including survival time, time-to-response, and time-to-remission) is the standard metric. Clinical guidelines from the FDA and EMA require survival analyses to report median survival times, not means, because individual patient outcomes are highly variable and skewed.
Mean vs Median: When to Use Each
Understanding the median fully requires understanding when it outperforms the mean — and the rare cases when the mean is the better choice. The mean vs median vs mode comparison is one of the most commonly tested topics in introductory statistics. Here is a practical decision guide.
🔀 Decision Guide — Median vs Mean
| Feature | Median | Mean |
|---|---|---|
| Definition | Middle value of sorted data | Sum of all values ÷ count |
| Effect of outliers | Resistant — outliers don't move it unless they cross center | Sensitive — one extreme value shifts it |
| Best for skewed data | ✅ Yes — standard choice | ❌ No — gets distorted |
| Best for symmetric data | ✅ Works fine | ✅ More informative |
| Used in inferential stats | Non-parametric tests only | ✅ T-tests, ANOVA, regression |
| Real-world examples | Income, home prices, wait times, response times | Height, IQ, temperature averages (symmetric) |
| Affected by every value | No — only by rank positions | Yes — every number contributes |
| Can be a non-data value? | Yes (even dataset average) | Yes (always possible) |
Real-World Applications of the Median
The median appears in official statistics, financial reporting, scientific research, and everyday data analysis. Here are the most common domains where it is the standard measure of central tendency.
Real Estate
Median home prices are the universal standard. A single luxury property skews the mean; the median reflects what a typical buyer pays in a given market.
Economics
Median household income, median wealth, and median wages are used in all major economic reports to represent the typical household without distortion from the ultra-wealthy.
Healthcare
Median survival time, median time to response, and median hospital wait times are standard metrics in clinical trials and hospital performance reports.
Data Science
Median imputation replaces missing values in skewed distributions. Median absolute deviation is a robust alternative to standard deviation for outlier-prone data.
Sports Analytics
Team medians for performance metrics (points, assists, defensive rating) provide a more stable picture than means when rosters include a dominant star player.
Education
Median test scores are used when distributions are skewed by floor or ceiling effects. Median salaries for graduates by major are the standard reported by university career offices.
Common Mistakes When Finding the Median
| Common Mistake | Why It's Wrong | What's Correct |
|---|---|---|
| Finding the middle of unsorted data | Produces the wrong answer every time | Always sort the data before identifying the middle position |
| Using (n/2)th value for even datasets | Only gives one of the two middle values | Average the (n/2)th and (n/2 + 1)th values |
| Forgetting to include repeated values | Undercounts n and shifts the middle position | Every observation counts — duplicates must be retained when sorting |
| Confusing median with mean | Mean divides the sum by n; median uses position | The median never involves addition of all values — only the middle two at most |
| Thinking the median must be in the dataset | For even n, the median is often a number not in the data | The median can be a value between two data points — this is normal and mathematically correct |
| Using the median for all inferential tests | Most parametric tests (t-test, ANOVA) are built around the mean | For inferential statistics, use the mean unless the data violates normality; use non-parametric tests based on medians otherwise |
Interactive Median Calculator
Enter your numbers below separated by commas. The calculator will sort your data, identify the middle value(s), and show you the complete step-by-step solution including the mean for comparison.
📊 Median Calculator — Step-by-Step
Entity & Formula Glossary
| Term | Formula / Symbol | Definition |
|---|---|---|
| Median | x̃ or Med(X) | Middle value of a sorted dataset; divides the distribution at the 50th percentile |
| Mean | x̄ = Σxᵢ / n | Arithmetic average; sum of all values divided by the count |
| Mode | Most frequent value | Value appearing most often; a dataset can have multiple modes or none |
| Central Tendency | — | A single value summarizing the center or typical value of a dataset |
| Ordered Data | x₁ ≤ x₂ ≤ … ≤ xₙ | Values arranged from smallest to largest; required for median calculation |
| Outlier | x < Q1−1.5·IQR or x > Q3+1.5·IQR | Observation far removed from the bulk of the data; the median is resistant to outliers |
| Quartile | Q1, Q2, Q3 | Values dividing sorted data into four equal parts; Q2 is the median |
| Percentile | P50 = Median | Value below which a given percentage of observations fall; median = 50th percentile |
| IQR | IQR = Q3 − Q1 | Interquartile range — the spread of the middle 50% of data; used in outlier detection |
| Skewness | Mean > Median → right-skewed | Asymmetry in a distribution; skewed data is where the median outperforms the mean |
| Distribution | — | The pattern of how values are spread across a dataset |
| n | n = count of observations | Total number of data points; determines odd vs even median calculation |
Median Cheat Sheet
| n (Count) | Parity | Middle Position(s) | How to Get Median |
|---|---|---|---|
| 5 | Odd | 3rd value | Take the 3rd sorted value directly |
| 7 | Odd | 4th value | Take the 4th sorted value directly |
| 9 | Odd | 5th value | Take the 5th sorted value directly |
| 11 | Odd | 6th value | Take the 6th sorted value directly |
| 4 | Even | 2nd and 3rd | Average the 2nd and 3rd sorted values |
| 6 | Even | 3rd and 4th | Average the 3rd and 4th sorted values |
| 8 | Even | 4th and 5th | Average the 4th and 5th sorted values |
| 10 | Even | 5th and 6th | Average the 5th and 6th sorted values |
| 12 | Even | 6th and 7th | Average the 6th and 7th sorted values |
Frequently Asked Questions
The median is the middle value in a sorted dataset. Example: for the dataset {3, 7, 9, 12, 15}, sort the values and find the middle — the 3rd out of 5 values is 9. So the median is 9. For an even dataset like {4, 6, 8, 10}, average the 2nd and 3rd values: (6 + 8) / 2 = 7. The median is 7 even though 7 does not appear in the original data.
When n is even: (1) Sort all values in ascending order. (2) Identify the two center positions — they are at positions n/2 and (n/2)+1. (3) Add those two values and divide by 2. For example, for {10, 20, 30, 40} (n = 4), the middle positions are 2nd (20) and 3rd (30). Median = (20 + 30) / 2 = 25. Note that 25 does not appear in the original dataset — this is perfectly correct.
Income data is right-skewed — a small number of very high earners at the top pull the mean upward dramatically. If 10 people earn $50,000 each and one earns $1,000,000, the mean is $136,364 but the median is $50,000. The median represents what a typical person earns. The mean is inflated by the outlier and misleads anyone trying to understand what most people actually take home. This is why the U.S. Census Bureau, ONS (UK), and international statistical agencies report median household income as their primary income metric.
An outlier can affect the median only if it changes which value occupies the center position. In most cases it does not. For example, in {10, 20, 30, 40, 50}, the median is 30. If you replace 50 with 5,000, the sorted data becomes {10, 20, 30, 40, 5000} — the median is still 30 because the 3rd position didn't change. However, if the outlier pushes a different value into the center position (for example, by adding multiple outliers), the median will shift. In practice, single extreme outliers rarely change the median at all.
The mean is the arithmetic average — you add all values and divide by n. It is sensitive to every value in the dataset, including outliers. The median is the middle value in a sorted dataset — it depends only on rank position, not magnitude. For symmetric distributions (like heights in a large population), the mean and median are approximately equal. For skewed distributions (like income, home prices, or wait times), the median is usually a better measure of the typical value because it is not pulled toward the extreme end by a few large or small values. For a full comparison, see the guide on mean vs median vs mode.
In Microsoft Excel or Google Sheets, use the MEDIAN function: =MEDIAN(A1:A10) — replace the range with your data cells. Excel handles both odd and even n automatically: for odd n it returns the single middle value; for even n it averages the two middle values. You do not need to sort the data manually — Excel sorts it internally. The function ignores text cells and blank cells, so clean numeric data is required.
Use the median when: (1) The data has outliers that would distort the mean. (2) The distribution is skewed (e.g., income, house prices, wait times). (3) The data is ordinal (e.g., 1–5 satisfaction ratings). (4) You want a robust, easy-to-understand "typical" value. Use the mean when: (1) The distribution is approximately symmetric. (2) You plan to use the data in further statistical calculations (confidence intervals, t-tests, regression) that rely on the sample mean. (3) Every value carries information you want to incorporate, such as averaging exam grades.
Not always. When n is odd, the median is the middle observation and will always be a value in the dataset. When n is even, the median is the average of the two middle values — and this average may not appear in the original data. For example, for {4, 6, 8, 10}, the median is 7, which is not in the dataset. This is mathematically correct. The median is defined as the value that divides the distribution at 50% — it is not required to be an observed data point.
Summary
The median is the middle value of a sorted dataset. For odd n, it is the single center value. For even n, it is the average of the two center values. The median is resistant to outliers, making it the standard measure in income reports, real estate listings, clinical trials, and any other domain where skewed data or extreme values are present. When a distribution is roughly symmetric, the mean and median converge — in that case, the mean is equally valid and enables more inferential tests. The 10 examples in this guide cover education, salary, housing, healthcare, weather, e-commerce, sports, and web analytics — the most common real-life applications of the median.