Median Calculator - Raw, Frequency & Grouped Data

Statistics, data and probability tool

Find the median from raw numbers, a discrete frequency table, weighted values or grouped class intervals. The calculator orders or aggregates your data, identifies the middle position and shows the exact rule or grouped-data estimate step by step.

Last Updated: July 27, 2026
Odd and even datasets
Frequency and weighted data
Grouped median estimate
Fractions and scientific notation

Median Calculator with Steps

Select the format that matches your data. The tool validates complete entries and keeps all calculations in your browser.

Runs in your browser
Choose your data format
Separate values with commas, spaces, semicolons, pipes or new lines. Examples: -4.5, 1/2 and 2e3.
Do not add currency signs, percent signs, units, headers or formulas. A comma separates entries or columns, so do not use commas as thousands separators.

Median result

Calculated from unrounded values

Enter a valid dataset

The middle position and calculation will appear here.

Observations-
Middle rank-
Middle value(s)-
Result type-

Calculation details

MeasureValueMeaning

Ordered data

A bounded preview keeps large inputs responsive.
Position Value Role

Calculation steps

  1. Enter data and calculate a valid median.

Recent calculations

Your six latest calculations will appear here for this page session.

How to Use This Median Calculator

  1. Select Raw values, Frequency, Weighted or Grouped to match the information you have.
  2. Enter the values in the displayed box. Raw values may use commas, spaces, semicolons, pipes or new lines. Table modes require one row per line.
  3. Choose the display precision. This changes displayed rounding only. It does not change the stored inputs or median calculation.
  4. Press Calculate median. Review the result type, middle rank, source values, bounded data table and substituted steps.
  5. Use Copy summary for a plain-text record, or load an example to see the required input format.

Raw data accepts negative numbers, decimals, scientific notation and simple fractions. For example, -4.5; 1/2; 2e1 becomes -4.5, 0.5 and 20. Repeated values remain separate observations. Table modes merge duplicate values or identical class rows without expanding a large frequency table into millions of browser elements.

The calculator rejects incomplete tokens, labels and executable text. It does not silently turn invalid entries into zero or remove a row without telling you. Your entries stay on the current page and are not sent by this calculator to a server.

What the Median Represents

The median is the center of an ordered numerical dataset. It is also the second quartile, Q2, and the 50th percentile under the usual ordered-data interpretation. At least half of the observations are equal to or below the median, and at least half are equal to or above it. This wording remains accurate when several observations equal the median.

Position and value are different ideas. In the ordered list 3, 7, 9, 12, 15, the middle position is 3 and the value at that position is 9. With an even count, there are two central positions. Their arithmetic midpoint becomes the median, so the answer does not need to appear in the original data.

Sorting is essential. Selecting the visual center of an unsorted input gives a result based on typing order, not the distribution. This tool always sorts raw values and discrete table values numerically before locating the middle.

Median Formula for Odd and Even Data Sets

Write the ordered observations as x1 ≤ x2 ≤ ... ≤ xn. When n is odd, one observation occupies the middle position. When n is even, two observations surround the center.

Odd n: Median = x(n+1)/2
Even n: Median = [xn/2 + x(n/2)+1] ÷ 2

Odd-count example

Enter 12, 7, 3, 9 and 15. Sorting gives 3, 7, 9, 12, 15. The count is 5, so the position is (5 + 1) ÷ 2 = 3. The third ordered value is 9. Therefore, the median is 9.

Even-count example

For 2, 5, 8, 14, 21 and 30, n = 6. The middle positions are 6 ÷ 2 = 3 and 4. Their values are 8 and 14. The median is (8 + 14) ÷ 2 = 11. The value 11 was not an observation, but it correctly marks the numerical midpoint between the two central values.

The engine uses a stable midpoint calculation for very large, very small and opposite-sign values. It calculates with unrounded numbers, then applies your selected display precision to the result.

How to Find the Median from a Frequency Table

A discrete frequency table records a value once and states how many times it occurs. Enter one value and one nonnegative whole-number frequency per line. The tool merges duplicate value rows, sorts values and uses cumulative frequency to locate the middle rank without creating an expanded list.

ValueFrequencyCumulative frequency
1022
2035
3049
40110

The total frequency is 10, so the middle ranks are 5 and 6. Cumulative frequency shows that rank 5 has value 20 and rank 6 has value 30. The median is (20 + 30) ÷ 2 = 25. This is a frequency-table median based on observation counts. Decimal frequencies belong in weighted mode, where a separate 50 percent rule applies.

Weighted Median and the 50 Percent Tie Rule

A weight describes relative importance, exposure or mass rather than a repeated integer count. After values are sorted and duplicate values are combined, the weighted median is the first value whose cumulative weight passes half of the total weight.

If cumulative weight equals exactly 50 percent at a value, every point from that value to the next positively weighted value satisfies a common weighted-median definition. Different software may choose the lower endpoint, upper endpoint or another point in that interval. This calculator reports the full interval and uses its midpoint as the primary result. It labels the choice midpoint convention so the result is reproducible.

For values 10 and 20 with equal weights of 1, cumulative weight reaches exactly half at 10. The weighted-median interval is 10 to 20, and the displayed midpoint is 15. If value 20 instead has weight 3 while 10 and 30 each have weight 1, cumulative weight passes half at 20, so the weighted median is 20.

Grouped Data Median Formula

Grouped data gives class intervals and frequencies but does not retain each original value. Its median is therefore an estimate found by interpolation inside the class containing the halfway frequency. Enter true lower and upper class boundaries, not text labels or assumed boundary corrections.

Grouped median ≈ L + [(N/2 − C) / f] × h

Here, L is the lower boundary of the median class, N is total frequency, C is cumulative frequency before the median class, f is the median-class frequency and h is class width. For classes 0 to 10 with frequency 5, 10 to 20 with frequency 9, and 20 to 30 with frequency 6, N = 20 and N/2 = 10. The median class is 10 to 20. Substitution gives 10 + [(10 - 5) / 9] × 10 = 15.5556, approximately.

Overlapping classes are invalid and are rejected. Gaps are permitted but disclosed because a halfway point exactly between separated classes does not identify a unique raw-data median. Unequal class widths are allowed because the formula uses the width of the selected median class.

Median vs Mean vs Mode

Median, mean and mode all describe center, but they answer different questions. Consider 2, 3, 3, 4 and 100.

MeasureRuleResultUseful when
MedianMiddle ordered value3Data is skewed or includes extreme values.
MeanSum divided by count22.4Every magnitude should affect the center.
ModeMost frequent value3The most common observed value matters.

The value 100 pulls the mean far above most observations, while the median remains 3. This resistance to a small number of extremes makes the median useful for household income, property prices, salaries, waiting times and other right-skewed data. Resistance does not mean immunity. Adding or removing observations can move the central ranks and change the median.

Need mean, mode, quartiles, variance, standard deviation and distribution analysis together? Use the broader Statistics Calculator.

Exact Results, Estimates and Limits

Raw values: exact for the entered finite observations after numerical sorting.
Discrete frequency: exact for the supplied integer counts, without expanding the table.
Weighted values: follows the stated cumulative-weight and midpoint tie convention.
Grouped classes: an interpolation estimate because within-class observations are unknown.

An empty dataset has no median. Zero-frequency or zero-weight rows do not affect a result and are disclosed when ignored. The calculator accepts up to 50,000 raw observations or 10,000 table rows. Large frequency totals remain efficient because rank lookup uses cumulative counts.

Do not mix measurement units. Convert all observations to the same unit first. Keep the original available precision and round the final display, not the input. For academic, regulated or high-stakes work, retain your source data and reproduce the method required by your course, organization or software standard.

Common Median Mistakes

  • Forgetting to sort: the middle of the typed order is not necessarily the middle of the values.
  • Using one middle value for an even count: average both central ordered values.
  • Removing duplicates: every repeated observation occupies a position and can change the median.
  • Confusing counts and weights: discrete frequencies must be whole observation counts. Use weighted mode for decimal weights.
  • Calling a grouped estimate exact: class intervals hide the original within-class positions.
  • Using class labels as boundaries: enter continuous lower and upper boundaries used by your source.
  • Using commas inside numbers: write 12500, not 12,500, because commas separate values or columns.
  • Ignoring context: the median summarizes position. It does not describe every distance, tail or subgroup.

Calculation Method and Review Sources

The raw-data definition and location measures were reviewed against the NIST measures of location. The ordered-data, quartile, cumulative-frequency and outlier context was checked against OpenStax guidance on measures of data location.

The tool shows the values or table rows used to locate the median. It identifies whether the answer is exact, convention-based or estimated. It never removes a potential outlier automatically and does not infer observations that are absent from grouped data.

Related Calculators

Frequently Asked Questions

What is the median in math?

The median is the middle value of a dataset after the numbers are arranged from smallest to largest. It separates the ordered observations into lower and upper halves.

How do you calculate the median?

Sort the values and count them. For an odd count, select the single middle value. For an even count, add the two middle values and divide by two.

How do you find the median of an odd number of values?

For n ordered values, use position (n + 1) divided by 2. If there are seven values, the median is the fourth ordered value.

How do you find the median of an even number of values?

Find the two central ordered values, add them and divide by two. The result does not need to be one of the original values.

Do numbers need to be sorted to find the median?

Yes. The median depends on position, so values must be arranged in numerical order before the middle observation or observations are selected.

Is the median the same as the average?

Not usually. Average often means the arithmetic mean. The median uses the middle ordered position, while the mean uses the sum divided by the count.

Can the median be negative, decimal or a fraction?

Yes. The median depends on the data. An even dataset can also produce a decimal or fraction when its two middle values are averaged.

Do repeated numbers count when calculating the median?

Yes. Every occurrence occupies one position in the ordered dataset. Removing duplicates changes the data and may change the median.

Do outliers affect the median?

An extreme value usually influences the median less than the mean. However, adding or removing any observation can shift the middle ranks and change the median.

How do you find the median from a frequency table?

Add frequencies to get the total count, identify the middle rank or ranks, and use cumulative frequency to locate their values. Average two middle values when the total is even.

Calculation and Financial Disclaimer

This calculator provides educational and general informational results. Verify important academic, financial or professional calculations using the original data and the method required by an appropriate expert or organization.

Post a Comment

0Comments

Post a Comment (0)