The task how to calculate class width arises when quantitative data are grouped into equal-size classes to form a frequency table or histogram. Class width is the numerical “size” of each class interval.
Definition (most reliable form)
The class width is the difference between the upper and lower class boundaries:
When classes are written using lower class limits (for example, 50–59, 60–69, 70–79), the class width is also the difference between consecutive lower class limits:
Step-by-step: how to calculate class width from raw data
-
Find the minimum and maximum of the data, then compute the range:
\[ R = x_{\max} - x_{\min} \]
- Choose the number of classes \(k\) (common choices are 5–10 for many introductory tables; larger samples may use more).
-
Compute a preliminary class width:
\[ w_0 = \frac{R}{k} \]
-
Round up to a convenient value for readability (often to the next integer or to 1, 2, 5, 10, 20, … depending on scale):
\[ w = \lceil w_0 \rceil \quad \text{(if integer-width classes are desired)} \]
- Build classes of width \(w\), selecting a starting lower limit at or below \(x_{\min}\) so all observations are included without gaps.
Worked example (grouped frequency distribution)
Consider 20 exam scores: 52, 55, 56, 58, 61, 62, 64, 66, 67, 70, 72, 73, 75, 78, 81, 83, 85, 88, 90, 93.
1) Range
2) Choose number of classes
Take \(k = 5\) classes (a compact summary for a small dataset).
3) Compute and round class width
Round up to a convenient width \(w = 10\). This yields easy-to-read class intervals such as 50–59, 60–69, and so on.
4) Form the classes and count frequencies
| Class limits | Class boundaries | Class width | Frequency |
|---|---|---|---|
| 50–59 | \(49.5\) to \(59.5\) | \(59.5 - 49.5 = 10\) | 4 |
| 60–69 | \(59.5\) to \(69.5\) | \(69.5 - 59.5 = 10\) | 5 |
| 70–79 | \(69.5\) to \(79.5\) | \(79.5 - 69.5 = 10\) | 5 |
| 80–89 | \(79.5\) to \(89.5\) | \(89.5 - 79.5 = 10\) | 4 |
| 90–99 | \(89.5\) to \(99.5\) | \(99.5 - 89.5 = 10\) | 2 |
Visualization: class width as a repeated interval
Two quick checks that prevent mistakes
- No gaps, no overlaps: class boundaries should touch (for example, 59.5 is both the upper boundary of 50–59 and the lower boundary of 60–69).
- Width consistency: verify \(L_{2}-L_{1} = w\) across all classes (for example, \(60-50=10\), \(70-60=10\), etc.).
Summary
To calculate class width, compute the range \(R=x_{\max}-x_{\min}\), divide by the chosen number of classes \(k\) to get \(w_0=R/k\), then round up to a convenient \(w\) and build equal-size class intervals whose boundaries differ by \(w\).