Class Width Calculator

Find the class width for a frequency distribution or histogram: class width = (maximum − minimum) ÷ number of classes, rounded up.

Quick Facts

Formula
Class width = ⌈(max − min) / number of classes⌉
The raw quotient is rounded UP so all classes together cover the full data range.

Your Results

Calculated
Class width (rounded up)
-
Use this as the width of each class
Data range (max − min)
-
Total spread of the data
Exact quotient
-
Range ÷ classes, before rounding

Ready

Enter the maximum, minimum, and number of classes, then click Calculate.

How class width is calculated

Class width is the size of each interval (class or bin) in a grouped frequency distribution or histogram. It tells you how wide each bar should be so that, taken together, the classes cover every value in your dataset. The formula is:

Class width = (Maximum value − Minimum value) ÷ Number of classes

The difference (maximum − minimum) is the range of the data. Dividing the range by the number of classes you want gives the raw width. That raw value is then rounded up to a convenient number — usually the next whole number for integer data, so the intervals are easy to read and still span the entire range.

Worked example

Suppose exam scores run from a minimum of 43 to a maximum of 98, and you want 5 classes. The range is 98 − 43 = 55. Dividing gives 55 ÷ 5 = 11, so the class width is 11. Your classes would be 43–53, 54–64, 65–75, 76–86, and 87–97 (using a width of 11 for each). If instead the maximum were 96, the range would be 53, and 53 ÷ 5 = 10.6, which rounds up to a class width of 11.

Why round up rather than down

Rounding up guarantees the classes cover the full range. With a width of 10.6 rounded down to 10, five classes span only 5 × 10 = 50 units — less than the 53-unit range — so the highest data values would fall outside the last class. Rounding up to 11 gives 5 × 11 = 55 units of coverage, comfortably enclosing every observation.

Choosing the number of classes

Most textbooks recommend between 5 and 20 classes. A common formula is Sturges' rule: number of classes ≈ 1 + 3.322 × log₁₀(n), where n is the sample size. For example, with n = 50 data points, Sturges' rule gives 1 + 3.322 × log₁₀(50) ≈ 1 + 3.322 × 1.699 ≈ 6.6, so you would use about 6 or 7 classes. Too few classes flatten the distribution's shape; too many produce a spiky histogram full of near-empty bins.

Frequently Asked Questions

What is the formula for class width?
Class width = (maximum value − minimum value) ÷ number of classes. The result is rounded UP to a convenient whole number (or a value matching your data's precision) so the classes together span the full range of the data.
Why do you round the class width up instead of down?
Rounding up guarantees the classes cover the entire data range. If you rounded down, the total span of all classes would be smaller than max − min and the largest values would fall outside the last class. For example, a range of 47 over 5 classes gives 9.4, which rounds up to a class width of 10.
How many classes should I use?
A common rule of thumb is 5 to 20 classes. Sturges' rule suggests classes ≈ 1 + 3.322 × log₁₀(n), where n is the number of data points. Too few classes hide the shape of the distribution; too many create a jagged histogram with many near-empty bins.
What is the difference between class width and range?
The range is the total spread of the data: maximum − minimum. The class width is how much of that range each individual class covers. Class width = range ÷ number of classes (rounded up), so the range is divided among the classes.