Class width formula
Class width = (max − min) ÷ k, rounded up
where k is the number of classes.
Worked example
The smallest value is 12, the largest is 87, and you want 6 classes.
- Range = 87 − 12 = 75.
- 75 ÷ 6 = 12.5.
- The data is whole numbers, so round up to 13.
- Classes: 12–24, 25–37, 38–50, 51–63, 64–76, 77–89. The last class contains 87, so the width works.
| Class limits | Boundaries | Midpoint |
|---|---|---|
| 12–24 | 11.5–24.5 | 18 |
| 25–37 | 24.5–37.5 | 31 |
| 38–50 | 37.5–50.5 | 44 |
| … | … | … |
Choosing the number of classes
- Sturges’ rule: k = log₂(n) + 1. For 50 values, k ≈ 6.6, so 7 classes.
- Square-root rule: k = √n. For 50 values, √50 ≈ 7.1, so 8 classes.
- Rice rule: k = 2·∛n. For 50 values, 2 × 3.68 ≈ 7.4, so 8 classes.
With the classes ready, count your data into them with the frequency distribution table maker, or skip straight to a histogram, which picks classes automatically.
Common mistakes to avoid
- Rounding down. The classes then stop short of the maximum value. Always round up.
- Not matching the data’s precision. For data to one decimal place, the width should have one decimal place too (e.g. 2.4, not 2.37).
- Starting the first class far below the minimum. Start at the minimum or a convenient number just below it.
- Using a width that leaves the maximum out. Check that the last class’s upper limit is at least the maximum value.
Related tools: Frequency Distribution Table Maker, Histogram Maker, Grouped Data Calculator, Histogram from a Frequency Table and Descriptive Statistics Calculator.