🧮
🧮 Math & statistics

Class Width Calculator (histogram classes, boundaries & midpoints)

Results update as you type.

Your numbers

Understanding the class width calculator — concept and principle

This calculator finds the class width for a frequency table or histogram from the smallest and largest data values and the number of classes. It also lists the class boundaries and midpoints. Use it when grouping data for statistics homework or a report.

8 classes from 60 to 748 classes from 60 to 7459.9575.95width 2data 60 to 74, 8 classesRange14Raw width14.1 ÷ 8 = 1.7625First class59.95 – 61.95Class widthround up → 2
Round the width up so the classes always cover the largest value.

How it is calculated

Start = smallest value − half a unit of the most precise decimal place

End = largest value + the same half unit

Raw width = (end − start) ÷ number of classes, then rounded up to the chosen multiple

Boundaries: start, start + width, start + 2 × width, …

Midpoint of a class = (lower + upper) ÷ 2

The principle

Classes must cover every value without gaps or overlaps, and no value should sit exactly on a boundary, where it would be unclear which class it belongs to. Starting half a unit below the smallest value achieves that: the boundaries carry one more decimal place than the data. The width is rounded up, never down, so the last class still reaches past the largest value. Midpoints represent each class when you draw a frequency polygon or estimate a mean from grouped data.

Worked example

Default inputs: smallest 60, largest 74, 8 classes, 1 decimal place, round up to a multiple of 1.

  1. Start = 60 − 0.05 = 59.95; end = 74 + 0.05 = 74.05.
  2. Raw width = (74.05 − 59.95) ÷ 8 = 14.1 ÷ 8 = 1.7625; simple width = 14 ÷ 8 = 1.75; range 14.
  3. Rounded up to a multiple of 1: class width 2.
  4. Boundaries: 59.95 – 61.95, 61.95 – 63.95, …, 73.95 – 75.95; last upper boundary 75.95.
  5. Midpoints: 60.95, 62.95, 64.95, 66.95, 68.95, 70.95, 72.95, 74.95.
How Class width (rounded up) changes with Number of classesHow Class width changes with Number of c…024682468101216Example: 2Number of classes
Each point is the calculator re-run with only “Number of classes” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
Number of classesClass width (rounded up)
28
44
63
82
102
122
161

How to read the result

Too few classes hide the shape of the data; too many leave most classes nearly empty. Between 5 and 15 classes is a common guide, and √n classes is a quick starting point for n data values. A round width, such as 2, 5 or 10, makes the table easier to read even if it leaves a little spare room at the top.

Common mistakes

Keep in mind: The choice of classes changes how a histogram looks. Try more than one width before drawing conclusions about the shape of the data.

Frequently asked questions

How do you calculate class width?

Divide the range (or end − start) by the number of classes and round up.

How many classes should a histogram have?

Usually between 5 and 15; √n is a common starting point.

Why add or subtract half a unit?

So that no data value falls exactly on a class boundary.

Sources: OpenStax, Introductory Statistics 2e (2023), §2.2 Histograms, Frequency Polygons, and Time Series Graphs

Checked 9 Nov 2026. OpenStax, Introductory Statistics 2e (2023), §2.2 Histograms, Frequency Polygons, and Time Series Graphs — Example 2.7 (start 60 − 0.05 = 59.95, end 74 + 0.05 = 74.05, (74.05 − 59.95) ÷ 8 = 1.76, rounded up to 2) and Example 2.8 (whole numbers: subtract and add 0.5); 5 to 15 classes and the √n rule of thumb.

🧮 All math & statistics tools →🌍 Calculators by country →