help-calc

06 Statistics and Data

Class Width Calculator for Frequency Tables

Card 06-0030 · Updated · Standard formula, shown below

Class width (rounded up) 8
Exact width
7.857
Result, rounded to 3 decimal places
Largest value
97
Input
Smallest value
42
Input
You enter
Largest value, Smallest value, Number of classes (classes)
You get
Class width (rounded up), Exact width
Rounding
0 dp · 3 dp

This calculator finds the class width for a grouped frequency table. Enter the largest and smallest values in the data and the number of classes you want; you get the exact width and the width rounded up to a whole number, which is what most textbooks use.

Formula

Class width = (largest − smallest) ÷ number of classes, rounded up to the next whole number (or to a convenient unit for decimal data).

Worked Example

Data from 42 to 97 in 7 classes.

  1. Range = 97 − 42 = 55
  2. 55 ÷ 7 = 7.857
  3. Rounded up: class width = 8
  4. Classes: 42-49, 50-57, 58-65, 66-73, 74-81, 82-89, 90-97

How to read the result

Start the first class at the smallest value (or a little below it) and add the width each time. Rounding up makes sure the classes cover the whole range. Some textbooks say to add 1 when the division comes out exact, so that the largest value is not on a boundary; check your course.

Limits and common mistakes

  • The largest value must be greater than the smallest.
  • 5 to 20 classes is usual; too few hide the shape, too many leave empty classes.

Frequently Asked Questions

Why round up?

So that the classes together reach the largest value.

How many classes should I use?

Often 5-20; Sturges’ rule suggests 1 + 3.3 log₁₀ n.

What if the width comes out exact?

Some courses add 1 to it; follow your textbook.

What are class limits?

The smallest and largest values that can go in each class.

Formula used
in mx | Largest value | - | 97 | -
in mn | Smallest value | - | 42 | -
in k | Number of classes | classes | 7 | 1 | 100
out cw | Class width (rounded up) | - | ceil(round((mx - mn) / k, 6)) + 0 * sqrt(mx - mn) | 0
out raw | Exact width | - | (mx - mn) / k | 3

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More on this shelf

The whole Statistics and Data shelf →