Class Width Calculator

Class Width Calculator

Calculate histogram bin width and class intervals for frequency distributions.

Last updated: March 2026

Calculate Class Width

Range
90
Raw Width (Range/k)
18.00
Class Width (Rounded)
18

Class Intervals

Class 1
1027
Class 2
2845
Class 3
4663
Class 4
6481
Class 5
8299

Guideline for Choosing Number of Classes

Sample Size (n)Square Root RuleSturges' RuleRice RuleRecommended
255555
507676–7
10010898–10
2001491210–12
500+22+1017+12–20

What is Class Width?

Class width is the size of each interval (bin) in a frequency distribution or histogram. It represents the range of values contained within each class interval. Choosing the right class width is critical for creating informative histograms and frequency distributions.

Too small a class width produces many narrow bins, making the histogram cluttered. Too large a class width produces few wide bins, losing detail from the data. The class width calculation follows the formula: Class Width = Range ÷ Number of Classes, rounded up to the next whole number.

Class intervals are typically left-inclusive and right-exclusive (e.g., [10, 15), [15, 20)) to avoid overlap. However, for the last class, the upper bound is inclusive.

How to Use Class Width

Step-by-Step Process:

Step 1: Find the minimum and maximum values in your dataset
Step 2: Calculate Range = Maximum - Minimum
Step 3: Decide on the number of classes (typically 5-20)
Step 4: Calculate Raw Width = Range ÷ Number of Classes
Step 5: Round raw width UP to the next whole number
Step 6: Create intervals starting from minimum value

Choosing Number of Classes:

  • Square Root Rule: k = √n (where n = sample size)
  • Sturges' Rule: k = 1 + 3.322 log₁₀(n)
  • Rice Rule: k = 2n^(1/3)
  • General guideline: Use 5-20 classes depending on data size

Example

Test scores range from 45 to 98. Create 6 classes.

Given:
Minimum = 45, Maximum = 98, Classes = 6
Step 1:
Range = 98 - 45 = 53
Step 2:
Raw Width = 53 ÷ 6 = 8.83
Step 3:
Class Width = ROUND UP 8.83 = 9
Classes:
[45, 54), [54, 63), [63, 72), [72, 81), [81, 90), [90, 99]

Frequently Asked Questions

Why do we round UP?

Rounding up ensures all data points fit within the class intervals. Rounding down might leave some high values without a class.

What if the raw width is already a whole number?

Use that number as-is. No rounding is needed. For example, if raw width = 10.0, use class width = 10.

Can class width be a decimal?

While mathematically possible, class widths are typically whole numbers for simplicity. Use the rounding method to convert to integers.

What's the 'Range'?

Range is the difference between the maximum and minimum values in the dataset: Range = Max - Min. It represents the total spread of your data.

How many classes should I use?

Use the Square Root Rule (k = √n), Sturges' Rule, or Rice Rule as guidelines. For most datasets, 5-20 classes works well.

What if my data has outliers?

Outliers can affect the range and thus class width. Consider the context—include them naturally or separately if they're truly anomalous.

Related Tools