HomeMath › Class Width Calculator

Class Width Calculator

Enter a data set, or just the minimum and maximum, plus how many classes you want, to get the class width for a frequency table or histogram, along with the range and the first class limits.

Example: with I have... A data set · Data set (comma or space separated) 12, 18, 22, 25, 30, 33, 41, 47, 52, 58 · Minimum value (min/max mode) 0 · Maximum value (min/max mode) 100 · Number of classes 5 → Class width: 10.

  • Range (max - min)46
  • Range ÷ classes9.2 before rounding up
  • First classFirst class: 12 to 21

Computed by the calculator below using its default values. Change any input to see your own numbers.

Class width
Range (max - min)
Range ÷ classes
First class

Class width = range ÷ number of classes, rounded up so the bins cover every value.

Where class width comes from

Before you can build a frequency table or histogram, you have to slice the data into equal bins, and class width is the size of each bin. You take the range, the distance from the smallest value to the largest, and divide by how many classes you want: width = (max - min) / k. Because a fraction of a unit cannot hold the top value neatly, you round up to the next whole number so the classes stretch far enough to cover everything.

Choosing the number of classes

There is no single right count. Too few classes hide the shape of the data; too many leave gaps and noise. Common guidance is five to twenty classes, often near the square root of the sample size or set by Sturges' rule. Once you fix k and compute the width, the lower limit of the first class is usually the minimum value, and each class starts one width above the last.

How it’s calculated

Class width = ceil((max - min) / k), where max and min bound the data and k is the number of classes. The result is rounded up to the next whole number so the classes span the full range. The first class shown starts at the minimum value and spans one width.

Assumes equal-width classes over integer-style data. If your data are continuous or you prefer round limits, you may round the width up further to a convenient number.

Class width, worked

Data rangeClassesRange ÷ classesClass width
12 to 58 (46)59.210
0 to 100 (100)714.2915
1 to 20 (19)53.84
0 to 50 (50)68.339

Class width = range / number of classes, always rounded up to the next whole number.

Common mistakes

  • Rounding the width down. Always round up, or the top values fall outside your last class.
  • Forgetting that when the range divides evenly, many instructors still bump the width up so the maximum is not stranded on a class boundary.
  • Mixing up range and class width. Range is the full spread; class width is that spread split across k classes.

Frequently asked questions

How do I find the class width?

Divide the range by the number of classes and round up: class width = ceil((max - min) / number of classes). For values from 12 to 58 in 5 classes, that is 46/5 = 9.2, rounded up to 10.

Why do you round the class width up?

Rounding up guarantees the classes cover the entire range. If you rounded 9.2 down to 9, five classes would span only 45 units and miss the largest value.

How many classes should I use?

There is no fixed rule, but five to twenty is typical. The square root of the sample size or Sturges' rule (1 + 3.322 log n) are common starting points; adjust so the histogram looks neither too spiky nor too flat.

What is the difference between range and class width?

Range is max minus min, the total spread of the data. Class width is that range divided among your chosen number of classes and rounded up, giving the size of each bin.

Where does the first class start?

Usually at the minimum value. Each following class begins one class width higher, so with a width of 10 starting at 12 the classes are 12-21, 22-31, and so on.