Overview
Class width is the size of each group in a frequency table or histogram. This works it out from the data range and the number of classes, and suggests a class count with Sturges' rule.
Enter your data's minimum and maximum, the number of classes, the number of observations and a value to place in a class.
Worked examples
| Inputs | Result |
|---|---|
| Minimum Value0Maximum Value100Number of Classes8Total Observations240Target Value47 | Class width: 12.5Suggested number of bins (Sturges): 9 |
Show 2 more examples
| Minimum Value0Maximum Value50Number of Classes5Total Observations100Target Value22 | Class width: 10Suggested number of bins (Sturges): 8 |
| Minimum Value150Maximum Value200Number of Classes10Total Observations60Target Value171 | Class width: 5Suggested number of bins (Sturges): 7 |
Class width by number of classes
With the calculator's starting values, the class width is 12.5. The table shows how it changes with the number of classes.
| Number of Classes | Class width |
|---|---|
| 4 | 25 |
| 5 | 20 |
| 6 | 16.67 |
| 7 | 14.29 |
| 8starting value | 12.5 |
| 9 | 11.11 |
| 10 | 10 |
| 11 | 9.09 |
| 12 | 8.33 |
Other inputs: Minimum Value: 0 · Maximum Value: 100 · Total Observations: 240 · Target Value: 47. Change them in the calculator above for your own numbers.
How it works
Class width is the range ÷ the number of classes. Sturges' rule suggests 1 + log₂(n) classes, rounded up. Round the width up to a friendly number so the class boundaries are easy to read.
The formula
Practical tips
- A range of 0 to 100 with 8 classes gives a width of 12.5.
- For 240 observations, Sturges' rule suggests 9 classes.
- Round 12.5 up to 15 for cleaner boundaries, adjusting the class count if needed.
Frequently asked questions
How many classes should I use?
Usually 5 to 20. Sturges' rule is a common starting point.
Should class width be a whole number?
It's easier to read if it is, but it doesn't have to be.
Where do boundary values go?
Into the higher class, by the usual convention.