Class Width Calculator

This class width calculator gives the width you need for a frequency table or histogram. Example: data running from 12 to 98 in 8 classes have an exact width of 10.75, rounded up to 11.

Example: Number of classes: Choose the number of classes · Smallest value (minimum) 12 · Largest value (maximum) 98 · Number of classes k 8 · Round up to a multiple of 1 → Result: Class width = 11 (range 86, 8 classes, exact 10.75). Source: Wikipedia – Histogram (number of bins and width). Updated: .

k ≥ 1
For example 1 for whole numbers or 0.5.
My ToolboxYour inputs are saved in this browser only.

Result

Result
Class width = 11 (range 86, 8 classes, exact 10.75)
All values
Classfromup to (excl.)
11223
22334
33445
44556
55667
66778
77889
889100
Calculation steps
  • Range = maximum − minimum = 98 − 12 = 86.
  • Exact width = range / k = 86 / 8 = 10.75.
  • Rounded up to a multiple of 1: class width = 11; the last class ends at 100, so it covers the maximum 98.
Classes are closed on the left and open on the right: a value exactly on a limit belongs to the upper class; the largest value may sit on the last limit.

How it is calculated

The class width is the distance between the lower and upper limit of a class in a frequency table or histogram. It follows from the range of the data and the number of classes you want.

Formula and steps

First compute the range: maximum minus minimum. Dividing it by the number of classes k gives the exact width. Because class limits should be tidy, the result is rounded up to a multiple of a step, to the next whole number for integer data. You either choose the number of classes yourself or estimate it with Sturges’ rule, k = ⌈1 + log₂ n⌉.

Worked example

The data run from 12 to 98, so the range is 86. For 8 classes 86 / 8 = 10.75, rounded up to 11. The classes are 12 up to 23, 23 up to 34 and so on to 89 up to 100; the last limit 12 + 8 · 11 = 100 lies above the maximum 98. With n = 100 values Sturges gives k = ⌈7.64⌉ = 8, so the same grouping.

Frequently asked questions

How do you calculate class width?

Divide the range (maximum − minimum) by the number of classes and round up to a convenient number. For 12 to 98 in 8 classes: 86 / 8 = 10.75, so 11.

How many classes should I use?

As a rule of thumb use Sturges’ k = ⌈1 + log₂ n⌉. For n = 100 that is 8 classes. Check the histogram to see whether the shape of the distribution stays visible.

Why is the class width rounded up?

So the largest data point still falls into the last class. With the exact width 10.75 the limits would be awkward, and rounding error could cut off the maximum.

Sources and legal basis

As of: · Editorial policy

Related tools