Math formula
How to calculate median
The median is the center of a sorted data set.
Direct answer
Formula
median = middle sorted value, or average of the two middle sorted values
Use the table below to match each symbol with the right input. Keep units consistent before you start.
Median formula
Start here when you only need the equation and variable names.
Formula
median = middle sorted value, or average of the two middle sorted values
The median is the center of a sorted data set.
Variable meanings
Check each symbol, meaning, and unit before you calculate.
| Symbol | Name | Description | Unit |
|---|---|---|---|
| n | Count | Number of values in the sorted data set. | Depends on inputs |
| middle values | Middle values | The center one or center two values after sorting. | Depends on inputs |
When to use this formula
Check that your situation matches the formula before you trust the result.
- Choose it when very large or very small outliers would pull the average away from the middle.
Step-by-step method
Follow these steps when you are solving it by hand.
- 1Sort the values from smallest to largest.
- 2If the count is odd, take the middle value.
- 3If the count is even, average the two middle values.
Examples
These sample numbers show the order of operations and units.
Odd count
values
4, 9, 2, 7, 11
- 1.Sort: 2, 4, 7, 9, 11
- 2.The middle value is 7
Result
The median is 7.
Even count
values
12, 8, 15, 20
- 1.Sort: 8, 12, 15, 20
- 2.Average the two middle values: (12 + 15) / 2
- 3.median = 13.5
Result
The median is 13.5.
Mistakes to avoid
Small input or unit errors can change the answer a lot.
- Putting the wrong value in the numerator or denominator of the median formula.
- Skipping signs, order, or sorting rules that change the result.
- Rounding before the last step.
- Assuming a formula applies when the needed input is zero or missing.
Open the Mean, Median & Mode Calculator
Open the calculator for the answer without rewriting the formula.
Enter your values in the related calculator, then compare the output with the hand method above.
Open Mean, Median & Mode CalculatorFAQs
Short answers for common formula questions.
Can I calculate Median by hand?
Yes. Write the units next to each value, convert rates or measurements first, and round only the final answer.
Why does my Median result differ from another calculator?
Most differences come from rounding, unit conversions, rate timing, or a slightly different version of the formula.
When is the Mean Median Mode Calculator better than hand math?
Open the Mean Median Mode Calculator to check several scenarios or skip the hand arithmetic.