Want a Custom tool for Yourself?

Need a Custom Tool? We build custom tools that can save hours per employee per day.

Class Width Calculator

Find class width for a frequency table or histogram. Enter min, max, and number of classes to get a clean bin size for grouping your data.

Enter the Details





Result will appear here...


Last updated: March 17, 2026

Created by: Eon Tools Dev Team

Reviewed by: Ankit Khatiwada



What the class width calculator does

When you group data into a frequency table or a histogram, you split its range into equal bands called classes. The class width is how wide each of those bands is. This calculator works it out from the smallest value, the largest value, and how many classes you want.

Getting the width right is what makes a grouped table readable, with the data spread sensibly across the bands rather than crammed into a few. Below is how it works and the one step to take after.

How to use it

  1. Enter the maximum value in your data, and the minimum value.
  2. Enter the number of classes you want to split the data into.
  3. Press Calculate for the class width, or Reset to clear it.

How the class width is worked out

It is one division. Take the range of the data, which is the largest value minus the smallest, and divide it by the number of classes you want:

Class width = (maximum minus minimum) ÷ number of classes

So spreading a range of 50 across 5 classes gives a class width of 10. The calculator does this division and shows the result, which is the starting point for setting up your bands.

Why you round the answer up

Here is the step that trips people up. When the division does not come out even, you round the class width up to a convenient whole number, not down. This calculator gives you the exact quotient, and rounding it up is the move that follows.

The reason is simple. If you round down, the classes together do not quite cover the full range, and the largest value falls outside the last band with nowhere to go. Rounding up makes the bands stretch a little past the data, which guarantees every value has a home. It is always safer to have the classes reach slightly beyond your data than to leave a value stranded.

Choosing the number of classes

The calculator asks how many classes you want, which raises the question of how to choose. There is no single right answer, but the usual aim is between 5 and 20, few enough to summarise and many enough to show the shape. Too few classes hide the detail, and too many scatter the data so thinly that patterns disappear.

A common rule of thumb for a starting point is Sturges' rule, which suggests roughly 1 plus 3.322 times the logarithm of the number of data values. It is only a guide, and it is worth trying a couple of choices to see which gives the clearest table for your data.

A worked example

Suppose your data runs from a minimum of 42 to a maximum of 95, and you want 6 classes.

The range is 95 minus 42 = 53, and dividing by 6 gives a class width of about 8.83. Since that is not tidy, you round it up to 9. With a width of 9 starting at 42, your classes would run 42 to 50, 51 to 59, and so on, comfortably covering the 95 at the top.

Entering your values

Enter the maximum, the minimum, and the number of classes. The maximum must be larger than the minimum for the range to make sense. The calculator shows the exact class width to two decimal places, which you then round up to a convenient number to build your table.

Questions people ask

What is class width?

The width of each equal band, or class, when data is grouped into a frequency table or histogram. It is the range of the data divided by the number of classes.

Do I round the class width up or down?

Up. Rounding down would leave the largest value outside the last class. Rounding up makes the bands cover the whole range with room to spare.

How many classes should I use?

Usually between 5 and 20. Sturges' rule, about 1 plus 3.322 times the log of the number of values, gives a reasonable starting point.

What if my values are not whole numbers?

The formula works just the same. Divide the range by the number of classes and round the width up to a convenient value for your data.

References

A quick note on where the methods here come from. Class width, class intervals, and rules for choosing the number of classes are set out in the NIST/SEMATECH e-Handbook of Statistical Methods, the US government's public statistics reference. OpenStax Introductory Statistics is a free, widely used textbook covering grouped frequency tables and histograms.

  1. NIST/SEMATECH e-Handbook of Statistical Methods (histograms and class intervals). https://www.itl.nist.gov/div898/handbook/
  2. OpenStax, Introductory Statistics (histograms, frequency polygons, and grouping data). https://openstax.org/details/books/introductory-statistics-2e


Ankit Khatiwada

Ankit Khatiwada is a researcher and graduate student in Computer Science at Saarland University, with strengths in statistics, data analysis, data engineering, and full stack development. His work sits at the intersection of quantitative reasoning and applied technology, making him a strong fit for tools that depend on clear numerical logic. At Eon Tools, he reviews number and statistical tools.