St · Statistics & Probability

How to Find Quartiles from a Histogram (Grouped Data)

Updated 12 October 2026

At a glance

  1. 1. Read the frequencies

    Take each bar height. If bars have different widths, use frequency density × width.

  2. 2. Build cumulative totals

    Keep a running total of the frequencies. The last value is the total N.

  3. 3. Find the positions

    Q1, the median and Q3 sit at positions N/4, N/2 and 3N/4.

  4. 4. Locate the class

    Find the first bar whose cumulative total reaches each position.

  5. 5. Interpolate inside it

    Apply Q = L + ((pN − F) / f) × w with that bar's lower bound, width and counts.

Try it: Quartiles calculator

A histogram doesn’t show the individual data values, only how many fall into each class (bar). So you can’t sort the data and pick the middle values. Instead, you estimate the quartiles by assuming the values inside each bar are spread evenly across its width. That is the standard method for grouped data, and it is what exam boards and textbooks expect.

The formula

For the quartile at proportion pp (p=0.25p = 0.25 for Q1, 0.50.5 for the median, 0.750.75 for Q3):

Qp=L+pN−Ff×wQ_p = L + \frac{pN - F}{f} \times w

where

  • NN is the total frequency (the sum of all bar heights),
  • LL is the lower boundary of the class that contains position pNpN,
  • FF is the cumulative frequency before that class,
  • ff is the frequency of that class,
  • ww is the class width.

The fraction pN−Ff\frac{pN - F}{f} says how far into the bar you need to go, and multiplying by ww turns that into a distance along the x-axis.

Step by step

  1. Read the frequencies off the histogram. If the bars have different widths, frequency = bar area (frequency density × width), not bar height.
  2. Build a cumulative frequency column: a running total of the frequencies.
  3. Find the positions N/4N/4, N/2N/2 and 3N/43N/4.
  4. Locate each class: the first class whose cumulative frequency reaches or passes the position.
  5. Apply the formula inside that class.

Worked example

A histogram of test scores has these bars:

ScoreFrequency ffCumulative frequency
0–1055
10–201318
20–301533
30–401245
40–50550

So N=50N = 50.

Q1. Position 0.25×50=12.50.25 \times 50 = 12.5. The cumulative frequency passes 12.5 in the 10–20 class (it goes from 5 to 18). So L=10L = 10, F=5F = 5, f=13f = 13, w=10w = 10:

Q1=10+12.5−513×10=10+5.769≈15.77Q_1 = 10 + \frac{12.5 - 5}{13} \times 10 = 10 + 5.769 \approx 15.77

Median. Position 2525, which falls in 20–30 (cumulative 18 → 33):

Q2=20+25−1815×10≈24.67Q_2 = 20 + \frac{25 - 18}{15} \times 10 \approx 24.67

Q3. Position 37.537.5, which falls in 30–40 (cumulative 33 → 45):

Q3=30+37.5−3312×10=33.75Q_3 = 30 + \frac{37.5 - 33}{12} \times 10 = 33.75

Interquartile range: IQR=Q3−Q1≈33.75−15.77=17.98\text{IQR} = Q_3 - Q_1 \approx 33.75 - 15.77 = 17.98.

You can check all three values with the calculator above (switch the input type to Histogram bins).

The graphical method: cumulative frequency curve

The formula is the algebraic version of a graph you may be asked to draw:

  1. Plot cumulative frequency against the upper class boundary: (10, 5), (20, 18), (30, 33), (40, 45), (50, 50), starting from (0, 0).
  2. Join the points with straight lines (or a smooth curve, if your course asks for one).
  3. Go across from N/4N/4, N/2N/2 and 3N/43N/4 on the y-axis to the curve, then down to read the quartiles off the x-axis.

With straight lines between the points you get exactly the values from the formula. A smooth curve gives values that are close but not identical.

Common mistakes

  • Using bar height when widths differ. If the y-axis says frequency density, multiply by the width to get the frequency.
  • Plotting at midpoints. A cumulative frequency is the count up to the end of a class, so plot it at the upper boundary.
  • Mixing up N/4N/4 and (N+1)/4(N+1)/4. For grouped data, N/4N/4 is the usual convention. (N+1)/4(N+1)/4 belongs to some raw-data methods. For large NN the difference is negligible, but follow your syllabus.
  • Forgetting the result is an estimate. The true quartiles of the raw data could be anywhere inside the class. The formula assumes the values are spread evenly.

Practice

Heights (cm): 150–155: 4, 155–160: 10, 160–165: 18, 165–170: 12, 170–175: 6.

Show answers

N=50N = 50. Q1 ≈ 155 + (12.5 − 4)/10 × 5 = 159.25; median ≈ 160 + (25 − 14)/18 × 5 ≈ 163.06; Q3 ≈ 165 + (37.5 − 32)/12 × 5 ≈ 167.29; IQR ≈ 8.04.

References

  1. Hyndman, R. J. & Fan, Y. (1996). Sample quantiles in statistical packages. The American Statistician, 50(4), 361–365.
  2. NIST/SEMATECH e-Handbook of Statistical Methods – Percentiles

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.