Advertisement

Class width calculator

Plan equal-width classes before grouping numeric data. The range is the difference between the maximum and minimum.

Calculator

Class width
20.000000
Number of classes
5.000000
Minimum
0.000000
Maximum
100.000000
Range
100.000000

Advertisement

How this calculator works

Dividing the range by the desired class count gives the exact width. Optional upward rounding makes convenient boundaries but may extend coverage beyond the observed maximum. The reverse class-count calculation rounds up so the classes cover the range. Solving an extreme assumes exact coverage with no unused extension.

Formula

width = (maximum-minimum)/classes; classes = ceil((maximum-minimum)/width); maximum = minimum + classes × width.

Worked example

A minimum of 12, maximum of 47 and five classes give width 7. Rounding upward to a multiple of 2 gives width 8 and coverage through 52.

Advertisement

Frequently asked questions

Do I add one to the range for integers?

Not in this continuous-boundary convention. If you need integer-centred bins, choose half-unit outer boundaries first.

Is there one best class count?

No. The choice balances detail against noise and depends on the purpose of the display.

What if every observation is equal?

There is no positive data range to divide. Choose a meaningful display width separately.

Sources

Advertisement