Free calculator

Class Width Calculator

Work out the class width for a frequency table, then get every class limit, boundary and midpoint, ready to fill in with your data.

  • Step-by-step working
  • Limits & boundaries
  • Sturges' rule
  • Free

What do you know?

Data range

Number of classes

Result

Class limits

ClassLimitsBoundariesMidpoint
112 – 2411.5 – 24.518
225 – 3724.5 – 37.531
338 – 5037.5 – 50.544
451 – 6350.5 – 63.557
564 – 7663.5 – 76.570
677 – 8976.5 – 89.583

Count how many values fall in each class with the frequency distribution table maker.

Step-by-step solutionShow
  1. 1

    Find the range

    range = max − min = 87 − 12

    = 75

  2. 2

    Divide by the number of classes

    (max − min) ÷ k = 75 ÷ 6

    = 12.5

  3. 3

    Round up to the data’s precision (whole numbers)

    Always round up, never down, so the classes cover all the data.

    = 13

  4. 4

    Build the classes

    Start at 12 and add the width 13 to get each next lower limit. Upper limits end one unit (1) below the next lower limit; boundaries sit halfway between.

Class width formula

Class width = (max − min) ÷ k, rounded up

where k is the number of classes.

Worked example

The smallest value is 12, the largest is 87, and you want 6 classes.

  1. Range = 87 − 12 = 75.
  2. 75 ÷ 6 = 12.5.
  3. The data is whole numbers, so round up to 13.
  4. Classes: 12–24, 25–37, 38–50, 51–63, 64–76, 77–89. The last class contains 87, so the width works.
Class limitsBoundariesMidpoint
12–2411.5–24.518
25–3724.5–37.531
38–5037.5–50.544
………

Choosing the number of classes

  • Sturges’ rule: k = log₂(n) + 1. For 50 values, k ≈ 6.6, so 7 classes.
  • Square-root rule: k = √n. For 50 values, √50 ≈ 7.1, so 8 classes.
  • Rice rule: k = 2·∛n. For 50 values, 2 × 3.68 ≈ 7.4, so 8 classes.

With the classes ready, count your data into them with the frequency distribution table maker, or skip straight to a histogram, which picks classes automatically.

Common mistakes to avoid

  • Rounding down. The classes then stop short of the maximum value. Always round up.
  • Not matching the data’s precision. For data to one decimal place, the width should have one decimal place too (e.g. 2.4, not 2.37).
  • Starting the first class far below the minimum. Start at the minimum or a convenient number just below it.
  • Using a width that leaves the maximum out. Check that the last class’s upper limit is at least the maximum value.

Related tools: Frequency Distribution Table Maker, Histogram Maker, Grouped Data Calculator, Histogram from a Frequency Table and Descriptive Statistics Calculator.

Frequently asked questions

What is the formula for class width?

Class width = (maximum − minimum) ÷ number of classes, rounded up to a convenient number with the same precision as the data.

Why do you always round the class width up?

Rounding down could leave the largest values outside the last class. Rounding up guarantees the classes cover all the data.

What if the class width comes out as a whole number?

Many textbooks then increase it by one unit. Otherwise, with whole-number class limits (e.g. 10–17), the last class can stop just short of the maximum. The calculator checks this and adds one unit only when it's needed.

How many classes should I use?

Typically 5 to 15. If you're not told, use Sturges' rule (k = log₂ n + 1, rounded up), which needs the number of values n. Paste your raw data and pick the rule.

How do I find class boundaries and midpoints?

Boundaries sit half a unit beyond the class limits: for 10–17 with whole-number data, the boundaries are 9.5 and 17.5. The midpoint is (lower limit + upper limit) ÷ 2, here 13.5.

Related tools