Loading
Calculate the median of any dataset instantly. Handles odd & even numbers, grouped data & large datasets. Free median calculator — accurate, fast, no signup needed.
Enter numbers separated by commas. We’ll show the count, median, and a histogram.
Math
Last updated: April 2026 | Accurate for ungrouped and grouped data across all dataset sizes
The median is one of the most powerful and most misunderstood numbers in statistics. Unlike the mean, it doesn't get pulled off course by outliers — making it the go-to measure of central tendency whenever your data has extreme values, skewed distributions, or when you need to know what's truly typical rather than mathematically average.
A median calculator finds the middle value of any dataset instantly. Enter your numbers, and the tool sorts them, identifies the position, and returns the median — with the full working shown so you understand exactly how the result was reached.
Whether you're analysing exam scores, comparing house prices, reviewing income data, working through a statistics assignment, or processing data in a professional context — this calculator handles any dataset size, works for both odd and even counts, and supports grouped frequency data.
🔢 Calculate Your Median Now → Median Calculator
✅ Free and instant | ✅ Works for odd and even datasets | ✅ Grouped data support | ✅ Full sorted steps shown
The median calculator is built for every level of user — from school students finding the middle of five numbers to data analysts processing large frequency distributions.
It handles:
Direct answer: The median is the middle value of a dataset when all values are arranged in ascending order. Exactly half the values fall below it and half above it.
It is one of the three primary measures of central tendency alongside the mean (arithmetic average) and mode (most frequent value). Each serves a different purpose — and choosing the right one for your data is as important as calculating it correctly.
Consider household income in a street of 9 residents:
£22,000 / £24,000 / £28,000 / £31,000 / £34,000 / £37,000 / £40,000 / £45,000 / £850,000
Mean: Sum = £1,111,000 ÷ 9 = £123,444 Median: Middle value (5th of 9) = £34,000
The mean is nearly four times higher than most residents earn — because one extremely high earner distorts it. The median of £34,000 is what a randomly selected resident is actually likely to earn. This is precisely why governments and economists report median household income rather than mean income when describing living standards.
When a dataset has an odd count (n), the median is a single value:
Position of Median = (n + 1) ÷ 2
The median is the value at that position in the sorted dataset.
Example (n = 5): Position = (5 + 1) ÷ 2 = 3rd value
When a dataset has an even count (n), there is no single middle value — so the median is the average of the two middle values:
Position of lower middle = n ÷ 2 Position of upper middle = (n ÷ 2) + 1
Median = (value at lower position + value at upper position) ÷ 2
Example (n = 6): Lower middle = 6 ÷ 2 = 3rd value Upper middle = 3 + 1 = 4th value Median = (3rd value + 4th value) ÷ 2
| Dataset Size | Formula | Key Step |
|---|---|---|
| Odd (n) | Median = value at position (n+1)/2 | Find single middle value |
| Even (n) | Median = (value at n/2 + value at (n/2)+1) ÷ 2 | Average two middle values |
Dataset: 7, 3, 9, 2, 5
Step 1 — Sort in ascending order: 2, 3, 5, 7, 9
Step 2 — Identify the count: n = 5 (odd)
Step 3 — Find the median position: Position = (5 + 1) ÷ 2 = 3rd value
Step 4 — Read the value at that position: 2, 3, 5, 7, 9
Median = 5 ✓
Dataset: 12, 4, 8, 6
Step 1 — Sort in ascending order: 4, 6, 8, 12
Step 2 — Identify the count: n = 4 (even)
Step 3 — Find the two middle positions: Lower: 4 ÷ 2 = 2nd value = 6 Upper: 2 + 1 = 3rd value = 8
Step 4 — Average the two middle values: (6 + 8) ÷ 2 = 7
Median = 7 ✓
Dataset: 45, 12, 78, 23, 56, 9, 34, 67, 31
Step 1 — Sort: 9, 12, 23, 31, 34, 45, 56, 67, 78
Step 2 — Count: n = 9
Step 3 — Position: (9 + 1) ÷ 2 = 5th value
Median = 34 ✓
Dataset: 15, 22, 8, 31, 19, 27
Step 1 — Sort: 8, 15, 19, 22, 27, 31
Wait — let's recount: 8, 15, 19, 22, 27, 31 (n=6)
Step 2 — Positions: 3rd = 19, 4th = 22
Median = (19 + 22) ÷ 2 = 20.5 ✓
Grouped data is presented in class intervals (also called bins or frequency classes) rather than individual values. This format is common in statistics textbooks, census data, survey results, and large-scale research where exact individual values aren't recorded.
Example — Age distribution of 50 survey respondents:
| Age Group | Frequency |
|---|---|
| 20–30 | 8 |
| 30–40 | 15 |
| 40–50 | 12 |
| 50–60 | 10 |
| 60–70 | 5 |
| Total | 50 |
Median = L + [(N/2 − CF) ÷ f] × h
Where:
Using the age distribution above:
Step 1 — Find N/2: Total N = 50 → N/2 = 25
Step 2 — Build cumulative frequency table:
| Age Group | Frequency | Cumulative Frequency |
|---|---|---|
| 20–30 | 8 | 8 |
| 30–40 | 15 | 23 |
| 40–50 | 12 | 35 ← median class |
| 50–60 | 10 | 45 |
| 60–70 | 5 | 50 |
Step 3 — Identify the median class: The cumulative frequency first exceeds N/2 = 25 at the 40–50 group (CF = 35). So 40–50 is the median class.
Step 4 — Identify formula components:
Step 5 — Apply formula: Median = 40 + [(25 − 23) ÷ 12] × 10 = 40 + [2 ÷ 12] × 10 = 40 + 0.1667 × 10 = 40 + 1.667 = 41.67
Interpretation: The median age of the 50 respondents is approximately 41.7 years. Half the respondents are younger than 41.7, and half are older.
With grouped data, you don't have individual values — only the boundaries and counts for each class. The formula uses linear interpolation to estimate where the median falls within the median class, assuming values are evenly distributed across the interval.
This is an approximation — more precise than guessing, and sufficient for most statistical analysis purposes.
| Feature | Ungrouped Data | Grouped Data |
|---|---|---|
| Format | Individual values (1, 5, 7, 12...) | Class intervals (0–10, 10–20...) |
| Median method | Sort and find middle value | Interpolation formula |
| When used | Small to medium datasets | Large datasets, surveys, census |
| Precision | Exact | Approximate |
| Example | Test scores of 8 students | Age distribution of 500 people |
The calculator handles both formats automatically — enter individual values for ungrouped data, or switch to grouped mode for class interval input.
Direct answer: The median between two numbers is their midpoint — found by adding both numbers and dividing by 2.
Formula: Median = (Number 1 + Number 2) ÷ 2
| Number 1 | Number 2 | Median |
|---|---|---|
| 10 | 20 | 15 |
| 7 | 15 | 11 |
| 0 | 100 | 50 |
| 33 | 47 | 40 |
| −10 | 10 | 0 |
| 2.5 | 7.5 | 5 |
This is the same formula as the even-dataset median — when your dataset has exactly two values, you average them to find the midpoint.
| Dataset | Sorted | Count | Median |
|---|---|---|---|
| 3, 7, 2 | 2, 3, 7 | 3 (odd) | 3 |
| 2, 4, 6, 8 | 2, 4, 6, 8 | 4 (even) | 5 |
| 1, 9, 5, 3, 7 | 1, 3, 5, 7, 9 | 5 (odd) | 5 |
| 10, 30, 20, 40 | 10, 20, 30, 40 | 4 (even) | 25 |
| 15, 5, 25, 35, 10, 20 | 5, 10, 15, 20, 25, 35 | 6 (even) | 17.5 |
| 100, 200, 150, 250, 300 | 100, 150, 200, 250, 300 | 5 (odd) | 200 |
| 4, 4, 4, 4 | 4, 4, 4, 4 | 4 (even) | 4 |
This is one of the most searched sections in statistics education — and one where clarity matters enormously. Here's a complete comparison:
| Measure | Definition | Formula | When to Use | Outlier Sensitive? |
|---|---|---|---|---|
| Mean | Arithmetic average | Sum ÷ Count | Balanced, symmetrical datasets | Yes — highly |
| Median | Middle value (sorted) | Value at (n+1)/2 position | Skewed data, income, house prices | No — resistant |
| Mode | Most frequent value | Value appearing most | Categorical data, trends, preferences | No |
The gap between mean and median is one of the most informative signals in a dataset. A large gap indicates skewness:
Imagine 9 houses on a street priced at: £180k / £195k / £210k / £225k / £240k / £255k / £270k / £290k / £1,200k
Mean: £3,065,000 ÷ 9 = £340,556 Median: 5th value = £240,000
The mean is inflated by one premium property. The median tells prospective buyers what's actually typical on that street — which is why property reports use median house prices, not mean prices.
For mean calculations across any dataset, our Average Calculator handles arithmetic mean, weighted average, and percentage averaging. For mode analysis, our Mode Calculator finds the most frequent values in any dataset.
Why median income matters more than mean income:
The US Census Bureau and UK Office for National Statistics both report median household income as the primary measure of typical living standards — because mean income is distorted by high earners.
US Reference (2024–2025 estimates):
If you earn $77,000 in the US, you're at the exact midpoint — half of households earn more, half earn less. If you earn $105,000, you're above average but not in the top half of households.
Understanding this distinction helps workers assess their relative position accurately — and helps policymakers design tax and benefit systems based on what's actually typical, not what's mathematically average.
Median home prices are the standard metric in real estate reporting across all four countries in our target audience:
Estate agents, buyers, and investors use median — not mean — because a handful of luxury properties in a city can make the mean price completely unrepresentative of what most buyers will actually pay.
Example — Class exam results:
Raw scores: 45, 52, 61, 63, 68, 71, 74, 78, 82, 89, 92, 97
Sorted: 45, 52, 61, 63, 68, 71, 74, 78, 82, 89, 92, 97
n = 12 (even) → Median = (71 + 74) ÷ 2 = 72.5
A teacher using the median sees that half the class scored above 72.5 and half below — a more reliable indicator of typical class performance than the mean, which would be pulled down by the low score of 45 and up by the 97.
Example — Customer support response times (minutes):
12, 8, 45, 9, 11, 14, 7, 180, 10, 13
Sorted: 7, 8, 9, 10, 11, 12, 13, 14, 45, 180
n = 10 → Median = (11 + 12) ÷ 2 = 11.5 minutes Mean = 309 ÷ 10 = 30.9 minutes
The mean of 30.9 minutes is dominated by two long outlier cases (45 and 180 minutes). The median of 11.5 minutes tells managers what most customers actually experience — giving a more honest picture of typical service quality.
This distinction is critical in SLA (Service Level Agreement) reporting, product quality analysis, and customer experience benchmarking.
Clinical trials, patient outcome studies, and health surveys routinely use the median for:
In these contexts, median gives practitioners a meaningful "typical" patient experience rather than a number distorted by extreme cases.
Excel has a built-in median function that handles any dataset size instantly.
Formula: =MEDIAN(A1:A10)
Returns the median of all values in cells A1 through A10. Works for both odd and even counts automatically.
Formula: =MEDIAN(3, 7, 2, 9, 5)
Returns 5 — you can enter values directly without using a cell range.
Excel doesn't have a built-in MEDIANIF function. Use an array formula:
Formula: {=MEDIAN(IF(A1:A20="Category", B1:B20))}
Enter with Ctrl+Shift+Enter (not just Enter) to activate as an array formula. This returns the median of values in column B only where column A equals "Category."
To find the median excluding values above a threshold: Formula: {=MEDIAN(IF(A1:A20<100, A1:A20))}
Returns the median of only values below 100 — useful when extreme outliers should be excluded from the typical-value analysis.
To find the median of the 10 largest values in a dataset: Formula: =MEDIAN(LARGE(A1:A50, {1,2,3,4,5,6,7,8,9,10}))
In machine learning preprocessing, the median is frequently used for imputing missing values — filling in gaps in datasets where some observations weren't recorded.
Why median over mean? Because mean imputation assumes the missing values are distributed symmetrically around the average. If the data is skewed (which is common in real-world datasets), median imputation produces more representative replacements for missing observations.
Common datasets where median imputation is preferred:
The Median Absolute Deviation is a robust measure of data spread — more resistant to outliers than standard deviation.
Formula: MAD = Median(|xi − Median(x)|)
Example: Dataset: 2, 3, 5, 7, 9 Median = 5 Absolute deviations from median: |2−5|, |3−5|, |5−5|, |7−5|, |9−5| = 3, 2, 0, 2, 4 Sorted deviations: 0, 2, 2, 3, 4 MAD = 2 (middle value of sorted deviations)
MAD is used in quality control, anomaly detection, and robust regression where outliers are expected and should not dominate the spread measurement.
For related dispersion calculations, our Standard Deviation Calculator handles variance and standard deviation for both population and sample datasets.
A SaaS company has 11 customers paying monthly:
$50, $50, $99, $99, $149, $199, $299, $299, $499, $999, $5,000
Mean: $8,741 ÷ 11 = $794.64 Median: 6th value = $199
The $5,000 enterprise client inflates the mean dramatically. The median of $199 tells the product team what the typical paying customer actually pays — critical for pricing strategy, customer success resource allocation, and product tier design.
Sort your numbers from lowest to highest. If you have an odd count, the median is the middle number. If you have an even count, average the two middle numbers. Example: for 3, 7, 2, 9, 5 — sorted: 2, 3, 5, 7, 9 — median is 5 (the 3rd of 5 values).
Sorted: 1, 2, 3, 4, 5, 7, 7, 7, 8, 8. Count = 10 (even). Two middle values: 5th = 5, 6th = 7. Median = (5 + 7) ÷ 2 = 6.
The numbers 1 through 10: sorted as 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. Count = 10 (even). Two middle values: 5 and 6. Median = (5 + 6) ÷ 2 = 5.5.
For small datasets: count your numbers, identify whether the count is odd or even, find the middle position(s), and read or average the values. For speed: if you can eyeball the sorted order, the median is simply the value with equal numbers above and below it. For anything over 10 values, a calculator is faster and eliminates sorting errors.
Complete your statistics and data analysis toolkit:
Statistics Tools:
Academic Tools:
Finance Tools (where median matters):
The median is quietly one of the most important numbers in everyday data interpretation. It powers the income statistics politicians cite, the house price figures buyers rely on, the exam benchmarks schools use, and the performance metrics businesses track. In every case, it answers the same fundamental question: what does a typical observation actually look like?
Unlike the mean, it's resistant to extreme values. Unlike the mode, it applies to continuous numerical data. Unlike ranges and standard deviations, it's instantly intuitive — half the data is above it, half is below.
This calculator puts that number in your hands instantly — for any dataset, any size, ungrouped or grouped, with full step-by-step working shown.
Use it. Understand it. Bookmark it for every time a dataset needs a middle value.
All median calculations use standard statistical formulas validated for ungrouped and grouped data. Grouped data median results use linear interpolation and are appropriately precise for class-interval datasets. For full descriptive statistics including mean, mode, and standard deviation, explore the related tools above.
Helpful answers related to this calculator.
The median is the middle value of a dataset when arranged in ascending order. For odd-numbered datasets, it's the single central value. For even-numbered datasets, it's the arithmetic mean of the two central values. The median is one of three primary measures of central tendency, alongside mean and mode.
The median is important because it represents the typical value in a dataset without being distorted by outliers or extreme values. It's used for income statistics, house prices, medical data, and business analysis — anywhere a single extreme value could give a misleading picture of what's normal or typical.
The mean is the arithmetic average (sum ÷ count). The median is the middle value of a sorted dataset. They give the same result for perfectly symmetrical data. For skewed data or data with outliers, they diverge significantly — the median is more representative of what's typical in such cases.
Use the formula: Median = L + [(N/2 − CF) ÷ f] × h. Where L = lower boundary of the median class, N = total frequency, CF = cumulative frequency before the median class, f = frequency of the median class, and h = class width. First identify which class contains the N/2 observation using a cumulative frequency table.
Yes — for even-numbered datasets, the median is the average of two middle values, which may not match any value in the original data. Example: dataset 2, 4, 6, 8 has median (4+6)÷2 = 5, which doesn't appear in the list. This is mathematically correct and fully expected.
Use the median when your data is skewed, contains outliers, or follows a non-normal distribution. Classic examples: income data (where high earners inflate the mean), house prices (where luxury properties skew the average), and customer response times (where occasional long waits distort the mean). When mean and median are close, either measure is appropriate.
The median of a single number is that number itself. With n=1, the middle value is the only value. This is mathematically consistent with the formula: position = (1+1)÷2 = 1st value = the only value present.
Duplicates are treated like any other value — they're sorted into position and the middle value(s) are identified normally. If the middle value is a repeated number, the median is that number. If both middle values in an even dataset are the same, the median is that value.
In Excel, use =MEDIAN(range) where range is your data cells. Example: =MEDIAN(A1:A20). Excel automatically handles odd and even counts, returning the single middle value for odd datasets and the average of the two middle values for even datasets. Blank cells are ignored; zero values are included.
The median between two numbers is their midpoint: (Number 1 + Number 2) ÷ 2. Example: median between 14 and 26 = (14+26)÷2 = 20. This is equivalent to applying the even-dataset median formula to a two-value dataset.