Median Calculator: Find the Middle Value With Steps
ByMuhammad Ali•Founder of KruskalCode
14:00
6 min read

The median is the middle value of a sorted dataset. Unlike the mean, it is not pulled by extreme outliers, which makes it a robust summary for skewed income, house-price, or test-score data. This guide walks through the odd-n and even-n rules, a sorted highlighting workflow, and the grouped-data class-interval formula used in frequency tables.
Use the free calculator
Skip the longhand math — open the matching ProMathTools calculator and get an instant result.
Use the calculator →Explanation
To find the median, sort the observations from smallest to largest. When the count n is odd, the median is the single value in position (n + 1) / 2. When n is even, there is no single middle observation, so the median is the arithmetic average of the two central values in positions n/2 and n/2 + 1. That average can be a number that does not appear in the original list (for example, the median of 1, 2, 3, 4 is 2.5). For grouped continuous data arranged in class intervals with frequencies, the median is estimated inside the median class with Median = L + ((n/2 − CF) / f) × h, where L is the lower class boundary, CF is the cumulative frequency before that class, f is the class frequency, and h is the class width. Reporting the mean alongside the median helps you see skew: if the mean is much larger than the median, the right tail is heavy.
Formula
Raw (odd n): median = x₍(n+1)/2₎ after sorting Raw (even n): median = (x₍n/2₎ + x₍n/2+1₎) / 2 Grouped: Median = L + ((n/2 − CF) / f) × h
Example
Odd raw data 3, 1, 4, 1, 5 sorts to 1, 1, 3, 4, 5. n = 5 is odd, so the median is the middle value 3. Even raw data 1, 2, 3, 4 has n = 4; the two middle values are 2 and 3, so the median is (2 + 3) / 2 = 2.5. A single observation such as [7] is already sorted; the median is 7.
How to use the related calculator
Choose raw or grouped mode. For raw data, paste numbers separated by commas, spaces, tabs, semicolons, or new lines. The calculator sorts the list, highlights the middle value(s), explains the odd/even rule, and also reports min, max, range, and mean. For grouped data, enter one class per line as lower-upper, frequency (for example 10-20, 5).
Try the related calculator
Open toolFAQ
What is the median and how is it calculated?
The median is the middle value after sorting. For an odd count it is the single middle value; for an even count it is the average of the two central values.
When should I prefer the median over the mean?
Prefer the median when the distribution is skewed or contains outliers. The mean averages every value and can shift dramatically with a few extremes; the median only depends on order.
How does grouped-data median work?
Locate the class whose cumulative frequency first reaches n/2, then apply Median = L + ((n/2 − CF) / f) × h inside that class.
Does the median have to be a data value?
Not when n is even. Averaging the two central observations can produce a halfway value that is not in the original list.
How do I enter my numbers?
Separate values with commas, spaces, tabs, semicolons, or new lines. Blank tokens are ignored; invalid tokens are reported by position.
Related articles

About the author
Muhammad Ali. Muhammad Ali is a full-stack developer and founder of KruskalCode. He builds SaaS platforms and automation systems with React and Laravel, and helps teams ship fast, scalable tools.
Need a custom calculator, dashboard, or automation workflow? Reach out to KruskalCode.