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
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.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Largest value: enter a number.
- Smallest value: enter a number.
- Number of classes: enter 1 or more.
- 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
| Symbol | Meaning |
|---|---|
| Largest value | |
| Smallest value | |
| Number of classes | |
| Exact class width (max − min) ÷ classes | |
| Class width, rounded up to a whole number | |
ceil(x) | the smallest whole number not below x. |
Worked example
| Largest value | 95 |
|---|---|
| Smallest value | 12 |
| Number of classes | 7 |
| Exact class width (max − min) ÷ classes | 11.8571 |
|---|
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.