Median Calculator
Find the median of any list of numbers with steps. Paste comma-, space- or line-separated data and also get the mean, mode, range, quartiles and IQR.
Median Calculator
Calculate the median (middle value) of a dataset. The median is a measure of central tendency that represents the middle value when data is arranged in order. This calculator also provides additional statistics including mean, mode, range, and quartiles for comprehensive data analysis.
Input Data
Start With The Right Assumption About The Median Calculator
The median is not simply the middle number. That is true only half the time. With an even count, the median is the average of the two middle numbers after sorting. The sorting step is where almost everyone slips up. This median calculator handles both cases, shows the sorted list so you can verify it, and tells you exactly which quartile method it uses, something most calculators hide.
Enter your dataset separated by commas, spaces, or new lines. The calculator sorts the numbers, identifies the middle position(s), and applies the correct rule for odd or even counts. It also calculates mean, mode, range, quartiles, and the interquartile range (IQR). You can display the step-by-step calculation to see exactly how each result was derived.
- Odd count: Median = the single middle value after sorting
- Even count: Median = average of the two middle values
- Quartile method: Hyndman-Fan Type 7 (R default, Excel QUARTILE.INC)
- Robustness: Unaffected by outlier magnitude, only their position matters
- Works with: Negative numbers, decimals, repeated values, ordinal data
What Is The Median? The Definition And The Odd/Even Rule
The median is the middle value of a dataset when the numbers are arranged from smallest to largest. It splits the data into two equal halves: exactly 50% of the numbers are below the median and 50% are above it.
The rule for finding the median depends on whether the dataset has an odd or even count.
Odd count: The median is the value at position (n+1)/2 in the sorted list. For 7 numbers, the median is the 4th value.
Even count: The median is the average of the two middle numbers, at positions n/2 and (n/2)+1. For 8 numbers, average the 4th and 5th values.
The tie convention goes back to Edgeworth (1883): for even n, the median is the arithmetic mean of the two middle numbers. This is the standard used by every major spreadsheet and statistics package, including Excel, Google Sheets, and R.
Worked Examples: Finding The Median Step By Step
Example 1: Odd Number Of Values
Dataset: 12, 7, 9, 15, 3, 20, 11
Step 1: Sort the data: 3, 7, 9, 11, 12, 15, 20
Step 2: Count the numbers. n = 7 (odd).
Step 3: Find the middle position: (7+1)/2 = 4th position.
Step 4: The 4th number in the sorted list is 11. The median is 11.
Example 2: Even Number Of Values
Dataset: 45, 32, 68, 51, 57, 40
Step 1: Sort the data: 32, 40, 45, 51, 57, 68
Step 2: Count the numbers. n = 6 (even).
Step 3: Find the two middle positions. Position 1 = 6/2 = 3rd number. Position 2 = (6/2)+1 = 4th number.
Step 4: The 3rd number is 45, the 4th number is 51. Median = (45 + 51)/2 = 48.
Median Vs Mean: When Each Measure Serves You Best
The mean is the arithmetic average, sum divided by count. The mean is pulled toward extreme numbers. A single CEO salary in a dataset of 10 workers raises the mean far above what any typical worker earns. The median stays anchored to the middle. That is why the U.S. Census Bureau reports median household income, not mean: income distributions are right-skewed, and the median better represents a typical household. OpenStax Introductory Statistics (§2.6) formalises the relationship: if mean > median, the distribution is right-skewed; if mean < median, it is left-skewed; if they are nearly equal, the distribution is symmetric. Use the median to describe the centre of skewed data. Use the mean when you need sums or totals, total revenue, total weight, total distance, or when the data is roughly symmetric with no outliers.
| Scenario | Use Median | Use Mean |
|---|---|---|
| Data has outliers (e.g., salaries, home prices) | Yes — robust to extreme numbers | No — outliers pull the mean |
| Distribution is skewed | Yes — better central measure | No — mean biased toward tail |
| Data is symmetric with no outliers | Fine — matches the mean | Yes — standard choice |
| You need sums or totals | No — not additive | Yes — mean × count = total |
| Ordinal data (rankings, ratings) | Yes — valid for ordinal data | No — distances between ranks not meaningful |
Which Quartile Method This Median Calculator Uses
This median calculator computes quartiles using the linear interpolation method known as Hyndman-Fan Type 7 (1996). This is the same method used by Excel's QUARTILE.INC function, R's default quantile function, and numpy.percentile in Python. The formula interpolates at position p(n-1) in the sorted list.
Other methods exist. Excel's QUARTILE.EXC uses Type 6 (p = j/(n+1)), which excludes the median from both halves when computing Q1 and Q3. Tukey's hinges, introduced in his 1977 book "Exploratory Data Analysis", take the median of the lower and upper halves of the data, which can produce different Q1 and Q3 numbers for datasets where n mod 4 equals 0 or 1. Tukey's hinges are not quartiles, though many sources conflate them. If you compare results between calculators, the difference almost always comes down to the quartile method. The calculator states its method so you can verify the output against your textbook or spreadsheet.
The One Failure Case That Catches Most People
The single thing that most often goes wrong is forgetting to sort the data before picking the middle number. If you average the two middle numbers of an unsorted list, you get a meaningless result. Every major software package sorts automatically, but if you are working by hand or checking a calculator's output, sort first. The second failure case is assuming that the quartile method used by one calculator matches another. Two calculators can return different Q1 and Q3 numbers for the same dataset if they use different Hyndman-Fan methods. This calculator uses Type 7 (Excel QUARTILE.INC). Always check which method is in use before comparing results.
Common Questions
How do I find the median with an even number of values?
Sort the numbers from smallest to largest. Take the two middle numbers and average them. For example, in the dataset 4, 8, 12, 20, the two middle numbers are 8 and 12. The median is (8 + 12)/2 = 10.
Does the median change if values repeat?
Repeated numbers do not change how the median is calculated. They simply appear multiple times in the sorted list. The median is found the same way, by identifying the middle position(s). Ties are handled by counting, not by averaging, unless the middle falls between two equal numbers (in which case the average is that same number).
What is the median of a dataset with only one value?
The median of a single number is that number itself. The dataset has one number, it is the middle by definition. The median also equals the mean in this case.
Can I calculate the median of categorical data?
No. The median requires ordered data, you must be able to arrange numbers from smallest to largest. Categorical (nominal) data like colours, brands, or categories has no natural order. The median is valid for ordinal data (rankings, ratings) but not for nominal data.
When should I use median instead of average?
Use the median when your data contains outliers or is skewed. The median is unaffected by extreme numbers. Use the mean when the data is symmetric with no outliers and you need to calculate totals (sum = mean × count). For income data, property prices, or any right-skewed distribution, the median is the more representative measure.