Skip to content
Press Equals

Class Width Calculator

Class width = (max − min) ÷ classes, rounded up. Data from 47 to 98 in 6 classes: 51 ÷ 6 = 8.5, so use 9.

Find the class width for a frequency table from your data or its smallest and largest values, with class limits, frequencies and the Sturges rule number of classes.

Result

Class width

7

Range ÷ classes, before rounding up
6.6
Range
33
Classes by Sturges' rule
5

Classes

ClassFrequency
12 – 183
19 – 253
26 – 323
33 – 393
40 – 463
How it’s worked out
  1. Range = largest − smallest = 33
  2. Range ÷ classes = 33 ÷ 5 = 6.6
  3. Round up to the precision of the data, adding one unit if it divides exactly so the largest value still fits: class width = 7

What this calculator does

A frequency table groups data into classes of equal width. This calculator finds the class width from your data, or from its smallest and largest values, lists the class limits and, from data, counts the frequency in each class. It also suggests a number of classes with Sturges' rule.

How to use it

  1. Choose whether to work from your data or from the smallest and largest values.
  2. Paste the data, separated by commas or spaces, or enter the smallest and largest values.
  3. Enter the number of classes you want.

How to calculate class width

  • Class width = (largest − smallest) ÷ number of classes, rounded up to the precision of the data (whole numbers for whole-number data).
  • If the division comes out exactly, add one unit. Otherwise the largest value would fall just outside the last class.
  • Sturges' rule: number of classes = 1 + log₂(n), rounded up, for n values.

Examples

Example 1: Test scores from 47 to 98. The range is 98 − 47 = 51, and 51 ÷ 6 = 8.5. Rounded up, the class width is 9, giving classes 47–55, 56–64 and so on up to 92–100.

Example 2: When the range divides evenly. 50 ÷ 5 is exactly 10, but classes 10–19 to 50–59 would leave out 60. Adding one gives a class width of 11.

Example 3: From a list of 15 values. For the 15 values from 12 to 45 in 5 classes, 33 ÷ 5 = 6.6, so the width is 7. Sturges' rule also suggests 5 classes for 15 values.

Tips

  • Each class's lower limit is the previous one plus the class width; the upper limit is one unit below the next lower limit.
  • Decimal data is rounded up to its own decimal places: data to one decimal gets a width like 1.3.
  • To summarize the same data, try the statistics calculator or the quartile calculator.

Common questions

How do you find class width?

Subtract the smallest value from the largest, divide by the number of classes and round up. For data from 47 to 98 in 6 classes: 51 ÷ 6 = 8.5, so the class width is 9.

What if the range divides evenly?

Add one unit. With values from 10 to 60 in 5 classes, 50 ÷ 5 = 10 would leave 60 outside the last class (50–59), so the width is 11.

How many classes should I use?

Textbooks often use 5 to 20. Sturges' rule suggests 1 + log₂(n) rounded up, which is 5 classes for 15 values and 9 for 200.

How we check this calculator

  • Tested against 4 reference answers worked from published sources or by hand,such as “33 ÷ 5 = 6.6, rounded up to 7”.
  • All 3 worked examples in the article above are run through this calculator, so the two can't disagree.
  • Every input is tried at its smallest and largest values and with random numbers, and must never crash or show a broken number.
  • These checks run automatically before any change goes live.

Spotted a wrong number? Tell us and we'll fix it. See how the calculators are tested.

Updated