Median Calculator
Calculate the median of a dataset.
What is the Median?
The median is the middle value in a sorted dataset — half the values are above it, half are below it. Unlike the mean (average), the median is resistant to outliers. For example, in incomes [30k, 35k, 40k, 45k, 500k], the mean is $130k (misleading), but the median is $40k (representative of typical values).
The median is the 50th percentile (P50) and the second quartile (Q2). It's the preferred measure of central tendency for skewed distributions like incomes, home prices, reaction times, and survival data where extreme values distort the mean.
Key insight: The median splits data into two equal halves. For odd-sized datasets, it's the exact middle value. For even-sized datasets, it's the average of the two middle values. This makes the median robust — changing extreme values doesn't affect it unless they cross the middle.
Formulas Explained
Finding the median position:
For n values sorted in ascending order:
If n is odd:
Median position = (n + 1) / 2
Median = value at that position
If n is even:
Median = (value at position n/2 + value at position n/2 + 1) / 2
Median = average of two middle values
Examples:
- Dataset [3, 5, 7, 9, 11]: n = 5 (odd), position = 3, median = 7
- Dataset [2, 4, 6, 8, 10, 12]: n = 6 (even), median = (6 + 8) / 2 = 7
Median vs Mean:
- Symmetric data: median ≈ mean
- Right-skewed (positive skew): median < mean (incomes, house prices)
- Left-skewed (negative skew): median > mean (test scores with ceiling effect)
Median in grouped data:
For frequency distributions, interpolate within the median class:
Median = L + [(n/2 - CF) / f] × w
Where L = lower boundary of median class, CF = cumulative frequency before median class, f = frequency of median class, w = class width.
Step-by-Step Guide
- Enter your data: Input comma-separated numbers. Example: 15, 23, 18, 31, 27, 19, 25
- Click calculate: The calculator sorts data and finds the median
- Read your results: Sorted: 15, 18, 19, 23, 25, 27, 31 | Median = 23
- Interpret: Half of values are below 23, half are above 23
- Compare to mean: Mean = 22.6, close to median — data is roughly symmetric
Real Examples with Calculations
Example 1: Household income analysis
Neighborhood incomes (thousands): 45, 52, 48, 65, 58, 72, 180, 55, 61, 49
Sorted: 45, 48, 49, 52, 55, 58, 61, 65, 72, 180
n = 10 (even), median = (55 + 58) / 2 = 56.5
Mean = 685 / 10 = 68.5
Application: Median ($56.5k) better represents "typical" income. The $180k outlier inflates mean by $12k. Real estate listings and government reports use median for this reason.
Example 2: Real estate pricing
Home sale prices: $320k, $345k, $310k, $380k, $355k, $1,200k, $335k, $365k
Sorted: 310, 320, 335, 345, 355, 365, 380, 1200
n = 8 (even), median = (345 + 355) / 2 = $350k
Mean = 3610 / 8 = $451k
Application: The mansion sale ($1.2M) pulls mean up by $101k. Median ($350k) reflects typical home value. Zillow, Redfin, and Census Bureau report median home prices.
Example 3: Customer service response times
Response times (minutes): 5, 8, 12, 6, 9, 45, 7, 11, 8, 6
Sorted: 5, 6, 6, 7, 8, 8, 9, 11, 12, 45
Median = (8 + 8) / 2 = 8 minutes
Mean = 117 / 10 = 11.7 minutes
Application: One escalated ticket (45 min) distorts the mean. Median (8 min) shows typical customer experience. Service level agreements should use median, not mean.
Example 4: Clinical trial survival analysis
Patient survival months (some still alive at study end):
12, 18, 24, 36+, 15, 22, 28+, 19, 31, 25
(+ indicates censored — patient still alive)
Sorted: 12, 15, 18, 19, 22, 25, 28+, 31, 36+
Median = 22 months (50% survived at least this long)
Application: Median survival time is standard in oncology trials. Mean is inappropriate with censored data — requires Kaplan-Meier estimation.
Example 5: Website load time monitoring
Page load times (seconds) over 15 days:
2.1, 1.8, 2.5, 3.2, 1.9, 2.3, 8.5, 2.0, 2.4, 1.7, 2.2, 2.6, 2.1, 1.9, 2.3
Sorted: 1.7, 1.8, 1.9, 1.9, 2.0, 2.1, 2.1, 2.2, 2.3, 2.3, 2.4, 2.5, 2.6, 3.2, 8.5
n = 15 (odd), position = 8, median = 2.2 seconds
Mean = 35.5 / 15 = 2.37 seconds
Application: One server outage (8.5s) skews mean. Median (2.2s) reflects normal performance. Google Core Web Vitals uses median (p50) for field data.
4 Common Mistakes
- Not sorting data first: Median requires sorted data. Finding the "middle" of unsorted [10, 3, 8, 15, 6] gives wrong answer. Sorted: [3, 6, 8, 10, 15], median = 8, not 8 (coincidentally same here, but often wrong).
- Averaging all values for even-sized datasets: For [2, 4, 6, 8], median = (4 + 6) / 2 = 5, not (2+4+6+8)/4 = 5 (same here by coincidence). For [2, 4, 6, 100], median = 5, mean = 28 — very different!
- Using median for categorical data: Median requires ordered data. You can't find median of colors (red, blue, green) or categories (yes, no, maybe) — these have no natural ordering. Use mode (most frequent) instead.
- Assuming median equals mean: In symmetric distributions, median ≈ mean. But in skewed data (incomes, prices, reaction times), they differ substantially. Always check skewness before choosing which measure to report.
4 Pro Tips
- Use median for skewed data: Rule of thumb: if mean and median differ by more than 10%, report median. This applies to incomes, wealth, home prices, insurance claims, and city populations — all right-skewed.
- Combine median with IQR: Median ± IQR (interquartile range) describes spread robustly. Report: "Median = 45, IQR = 32 to 58" instead of "Mean = 47 ± SD = 15" for skewed data.
- Use weighted median for survey data: When responses have different weights (demographic adjustments), find the value where cumulative weight reaches 50%. This gives population-representative median.
- Apply median in running systems: For real-time monitoring, maintain a rolling median (last 100 observations) instead of rolling mean. This filters out spikes from outliers while tracking genuine shifts in typical values.
FAQs
Use median when: (1) data is skewed (incomes, prices), (2) outliers are present, (3) you want "typical" value, (4) data has open-ended categories (">100"). Use mean when: data is symmetric, you need to combine groups, or calculating further statistics.
Yes. For even-sized datasets, median is the average of two middle values. Dataset [1, 3, 5, 9] has median = (3+5)/2 = 4, which doesn't appear in the data. This is normal and correct.
Duplicates don't change the method. Dataset [2, 5, 5, 5, 8] has median = 5 (the middle value). Dataset [2, 5, 5, 8] has median = (5+5)/2 = 5. The median can equal a value that appears multiple times.
Exclude missing values (NA, null) from the count. Calculate median from observed values only. However, if missingness is systematic (e.g., high incomes less likely to be reported), the median may be biased — consider imputation or sensitivity analysis.
Related Calculators
Explore our statistics calculators: Quartile Calculator, Standard Deviation Calculator, Variance Calculator, Factorial Calculator, Percentage Calculator.