Skip to content
FiftyCalc Free calculators for all 50 states

Class Width Calculator

Test cases replayed : 3 of 3 match · Methodology · No outside source listed

Enter the largest and smallest values of your data and the number of classes you want.

Result

Sample figures

Class width, rounded up to a whole number—

Exact class width (max − min) ÷ classes —

Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.

Class Width Calculator

Largest value: enter a number. Prefilled example: 95.

Smallest value: enter a number. Prefilled example: 12.

Number of classes: enter 1 or more. Prefilled example: 7.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. Largest value: enter a number.
  2. Smallest value: enter a number.
  3. Number of classes: enter 1 or more.
  4. Read the result: Class width, rounded up to a whole number; the panel also shows Exact class width (max − min) ÷ classes.

How this calculator works

Class width = (largest value − smallest value) ÷ number of classes, then rounded up so that the classes cover the whole range.

When the division comes out exact, some textbooks add 1 so that the largest value falls inside the last class; check the convention your course uses. A common starting point for the number of classes is Sturges' rule, 1 + log₂(n).

The formula

  1. Raw=max−mink
  2. W=ceil⁡(Raw)
Symbols used in the formula
SymbolMeaning
maxLargest value
minSmallest value
kNumber of classes
RawExact class width (max − min) ÷ classes
WClass width, rounded up to a whole number
ceil(x)the smallest whole number not below x.

Worked example

Largest value95
Smallest value12
Number of classes7
Exact class width (max − min) ÷ classes11.8571
  1. Raw=95−127=11.8571
  2. W=ceil⁡(11.8571)=12

Class width, rounded up to a whole number 12

Each step uses the unrounded value of the step before it; figures on this page are rounded for display.

Frequently asked questions

What is the class width for data from 12 to 95 in 7 classes?

(95 − 12) ÷ 7 ≈ 11.857, rounded up to 12.

Should all classes have the same width?

Yes for a standard frequency table or histogram; equal widths make the class frequencies comparable.

Questions answered

Related calculators