Median Calculator
Calculate the median (middle value) of a set of numbers
About Median
The median is the middle value in a sorted dataset. If there is an even number of values, the median is the average of the two middle values.
The median is less affected by outliers than the mean, making it a robust measure of central tendency.
What Is the Median?
The median is the middle value of a dataset when arranged in order. It divides data into two equal halves—50% of values fall below and 50% above. Unlike the mean, the median is resistant to outliers, making it ideal for skewed distributions like income, house prices, and home sizes.
The median is actually the 50th percentile and Q2 (second quartile). It represents a "typical" value better than the mean when data has extreme values or is asymmetric.
| Dataset Type | Example Values | Mean | Median | Better Measure |
|---|---|---|---|---|
| Symmetric (no outliers) | 10, 20, 30, 40, 50 | 30 | 30 | Either |
| With outlier | 10, 20, 30, 40, 200 | 60 | 30 | Median |
| Income (right-skewed) | 30k, 40k, 50k, 80k, 500k | 140k | 50k | Median |
| Test scores (symmetric) | 65, 70, 75, 80, 85 | 75 | 75 | Either |
Median Formula
Where:
- n= Number of values in dataset
- (n+1)/2= Middle position for odd n
How to Find the Median
Finding the median requires sorting data first, then locating the middle value. The process differs slightly for odd and even numbers of values.
| Step | Odd n Example (n=5) | Even n Example (n=6) |
|---|---|---|
| 1. List data | 8, 3, 9, 1, 5 | 8, 3, 9, 1, 5, 7 |
| 2. Sort ascending | 1, 3, 5, 8, 9 | 1, 3, 5, 7, 8, 9 |
| 3. Find middle position | (5+1)/2 = 3rd | 3rd and 4th positions |
| 4. Get median value | Value at 3rd = 5 | (5 + 7)/2 = 6 |
| Result | Median = 5 | Median = 6 |
For even n: The median is the average of the two middle values, which may or may not be an actual data point.
Median vs Mean: When to Use Each
The choice between median and mean depends on your data's distribution and purpose. Both are valid measures of central tendency, but they answer different questions.
| Factor | Use Median | Use Mean |
|---|---|---|
| Data distribution | Skewed, non-normal | Symmetric, normal |
| Outliers present | Yes—median ignores them | No—or outliers are meaningful |
| Statistical inference | Non-parametric tests | Parametric tests (t-tests) |
| Common applications | Income, house prices, age | Test scores, heights, weights |
| Question answered | "What's typical?" | "What's the total ÷ count?" |
Real-world example: US median household income (~$75,000) vs mean (~$100,000). The difference exists because high earners pull the mean up, but the median better represents what a "typical" household earns.
Quartiles and the Five-Number Summary
The median is part of a broader framework of quantiles that divide data into equal parts. Quartiles split data into four quarters, and together with min/max, form the five-number summary.
| Quantile | Symbol | Definition | Interpretation |
|---|---|---|---|
| Minimum | Min | Smallest value | Lower bound |
| First Quartile | Q1 (25th %ile) | 25% below this | Lower quarter boundary |
| Median | Q2 (50th %ile) | 50% below this | Center of data |
| Third Quartile | Q3 (75th %ile) | 75% below this | Upper quarter boundary |
| Maximum | Max | Largest value | Upper bound |
The Interquartile Range (IQR) = Q3 - Q1 measures spread resistant to outliers. Values beyond Q1 - 1.5×IQR or Q3 + 1.5×IQR are often flagged as potential outliers.
Box Plots: Visualizing the Median
A box plot (box-and-whisker plot) displays the five-number summary visually, making it easy to see distribution shape, center, spread, and outliers at a glance.
| Box Plot Element | Represents | What It Shows |
|---|---|---|
| Box left edge | Q1 (25th percentile) | Start of middle 50% |
| Line inside box | Median (Q2) | Center of data |
| Box right edge | Q3 (75th percentile) | End of middle 50% |
| Box width | IQR (Q3 - Q1) | Spread of middle 50% |
| Whiskers | Range (within 1.5×IQR) | Non-outlier range |
| Individual points | Outliers | Extreme values |
Box plots are excellent for comparing distributions across groups (e.g., salaries by department, scores by grade level).
Median for Grouped Data
When data is presented in frequency tables or histograms (grouped data), you estimate the median using interpolation within the median class—the class containing the middle value.
| Class Interval | Frequency | Cumulative Frequency |
|---|---|---|
| 0-10 | 5 | 5 |
| 10-20 | 12 | 17 |
| 20-30 | 18 (median class) | 35 |
| 30-40 | 10 | 45 |
| 40-50 | 5 | 50 |
Grouped Data Median
Where:
- L= Lower boundary of median class
- n= Total frequency
- CF= Cumulative frequency before median class
- f= Frequency of median class
- h= Class width
Real-World Applications of the Median
The median is the preferred measure of central tendency in many fields where data is typically skewed or outlier-prone. Understanding these applications helps in choosing the right statistic.
| Field | Application | Why Median? |
|---|---|---|
| Economics | Median household income | High earners skew mean upward |
| Real Estate | Median home price | Luxury homes distort mean |
| Healthcare | Median survival time | Long survivors skew mean |
| Demographics | Median age | Robust to outliers |
| Sports | Median career length | Superstars skew mean |
| Wages | Median hourly wage | Better represents "typical" |
Media reporting: When you see "average salary" in news, check whether it's mean or median—the difference can be substantial (often 20-30% for income data).
Worked Examples
Finding Median (Odd Number of Values)
Problem:
Find the median of: 7, 3, 9, 1, 5, 8, 2
Solution Steps:
- 1Count values: n = 7 (odd)
- 2Sort ascending: 1, 2, 3, 5, 7, 8, 9
- 3Find middle position: (7+1)/2 = 4th position
- 4Identify value: 4th value is 5
Result:
Median = 5. Three values (1, 2, 3) are below, three (7, 8, 9) are above.
Finding Median (Even Number of Values)
Problem:
Find the median of: 12, 8, 15, 3, 20, 6
Solution Steps:
- 1Count values: n = 6 (even)
- 2Sort ascending: 3, 6, 8, 12, 15, 20
- 3Find middle positions: 3rd and 4th values
- 4Average middle values: (8 + 12) / 2 = 10
Result:
Median = 10. Note: 10 is not in the original data, but it correctly splits the sorted data in half.
Median vs Mean with Outliers
Problem:
Five employees earn: $40k, $45k, $50k, $55k, $300k. Compare mean and median salaries.
Solution Steps:
- 1Calculate mean: (40 + 45 + 50 + 55 + 300) / 5 = 490/5 = $98k
- 2Sort data: 40, 45, 50, 55, 300
- 3Find median: Middle value (3rd) = $50k
- 4Compare: Mean ($98k) is nearly double the median ($50k)
Result:
Median ($50k) better represents typical salary. The mean ($98k) is inflated by the $300k outlier—more than any of 4 employees actually earn.
Tips & Best Practices
- ✓Always sort data before finding the median—the middle position only makes sense in ordered data.
- ✓For quick estimation in large datasets, the median is approximately at position (n+1)/2, whether n is odd or even.
- ✓When comparing groups, report both median and mean—a large gap indicates skewness.
- ✓The median is the 50th percentile, Q2, and the second quartile—these are all the same thing.
- ✓For grouped data, use the interpolation formula; for raw data, use the direct method.
- ✓In box plots, the line inside the box is the median—use this for quick visual comparison across groups.
- ✓Median is robust to outliers, so it won't change much if you add or remove extreme values.
Frequently Asked Questions
Sources & References
Last updated: 2026-01-22