Frequency Distribution Calculator

Frequency Distribution Calculator

Group a list of numbers into equal-width classes and get a frequency table with relative and cumulative columns, ready for a histogram or ogive.

Classes ≈ log₂ n + 1 · width = range ÷ classes

Paste or type your data to build the table

What Is a Frequency Distribution?

A frequency distribution is a table that sorts data into classes (ranges of values) and counts how many observations fall into each one. It turns a long list of numbers into a picture of where values cluster and how they spread.

Relative frequency shows each class as a share of the total, so tables of different sizes can be compared. Cumulative frequency runs a total down the table, answering questions like "how many took under 30 minutes?".

The table is the step before a histogram (bars of the counts) or an ogive (a line through the cumulative percentages). Choosing the class width is the main judgement call, and it changes the story the table tells.

How to Build a Frequency Distribution

As given in OpenStax Introductory Statistics, section 2.2, and Sturges (1926) for the number of classes. See Sources.

1. Choose the number of classes

k = ⌈log₂ n + 1⌉ (Sturges' rule)

2. Choose a tidy width

width = (max − min) ÷ k, rounded up to 1, 2, 2.5 or 5 × 10ᵐ

3. Count and accumulate

relative = f ÷ n · cumulative = running total of f

Each class includes its lower limit and excludes its upper limit, so every value lands in exactly one class.

Worked Example: 30 Commute Times

Given:
An office survey records 30 commute times in minutes, from 12 to 52.
Step 1:
Number of classes:
log₂ 30 + 1 = 5.91 → 6
Step 2:
Width, rounded to a tidy number:
(52 − 12) ÷ 6 = 6.67 → 10, starting at 10
Step 3:
Count each class:
10–<20: 7 · 20–<30: 12 · 30–<40: 7 · 40–<50: 3 · 50–<60: 1
Result:
Modal class 20–30 min (12 people)

63% of the office commutes for under 30 minutes. The single 52-minute journey sits alone in the top class, a long right tail that the table makes easy to spot.

How Many Classes to Use

Sturges' rule against the square-root rule. Both are starting points, not laws.

Suggested number of classes for several data set sizes
Values (n)Sturges√n
2065
5078
100810
5001023
1,0001132

Common Frequency Distribution Mistakes

  • Overlapping classes. 10–20 and 20–30 leave 20 in both. Use "10 to under 20" so each value has one home.
  • Unequal widths without adjusting. A class twice as wide naturally collects more values. Compare frequency densities, not raw counts.
  • Too many or too few classes. Three classes hide the shape; thirty classes for 40 values give a jagged comb of 0s and 1s.
  • Relative frequencies that don't sum to 1. Rounding can leave 0.99 or 1.01. Keep extra decimals until the end.

Frequency Distribution FAQs

What is the difference between frequency and relative frequency?

Frequency is a count; relative frequency is that count divided by the total, giving a proportion or percentage.

What is cumulative frequency?

The number of values in a class and all the classes below it. The last row always equals n.

How do I choose the class width?

Leave it blank for an automatic, rounded width from Sturges’ rule, or enter a width that makes sense for your units, such as 5 minutes.

What is the modal class?

The class with the highest frequency. If two classes tie, the first is shown.

Which class does a value on a boundary go in?

The higher one. Classes include their lower limit and exclude their upper limit, except that the last class always holds the maximum.

Can I use this for categories like colours?

No, this groups numbers. For categories, use the relative frequency calculator.

Why does the first class start below my minimum?

It starts at a multiple of the width for tidy limits. Set the first lower limit to choose your own.

Is Sturges’ rule always right?

It works well for roughly bell-shaped data up to a few hundred values. For large or skewed data sets it suggests too few classes.

Sources

Related Tools