Skip to main content

Histogram Maker

Turn a list of numbers into a histogram and see exactly how it is built: the bin edges, the frequency of each bin, the shape of the data, and a labeled chart with every step shown. Or start from a frequency table, handle classes of unequal width with frequency density, read medians and percentiles off a cumulative frequency graph (ogive), or compare how the same data look with different numbers of bins.

Background

A histogram shows how a set of numbers is distributed. The number line is cut into equal-width intervals called bins, each value is counted into the bin it falls in, and a bar is drawn whose height is that count (the frequency). Unlike a bar chart, the bars touch, because the x-axis is a continuous scale. The key ideas are bin width = range ÷ number of bins, relative frequency = frequency ÷ n, and, for unequal classes, frequency density = frequency ÷ class width so that bar area shows how many values there are.

Set up your histogram

Step 1 — What do you want to do?

Pick a task below.

Step 2 — Enter your data

Type or paste numbers separated by spaces, commas or new lines (a column from a spreadsheet works). Use a decimal point, not a comma. 2 to 20,000 values.

Step 2b — What do you want to read off the graph?

0 to 100. The median is the 50th percentile; Q1 and Q3 are always shown.

what percent of the data is at or below this value? Leave blank to skip.

Step 2b — Which numbers of bins do you want to compare?

2 to 4 different whole numbers, from 1 to 100, separated by commas.

Step 2 — Enter your frequency table

Type the class, then its frequency: 10-20: 5 (a colon, comma, space or “to” all work). Classes can touch (10-20, 20-30) or use whole-number limits with a small equal gap (10-19, 20-29), which are joined at the true boundaries. All classes must have the same width here.

Step 2 — Enter classes of any width

Same format as the frequency table, but the widths may differ: 10-20: 30. Whole-number limits with a small equal gap (10-19, 20-29) are also understood.

1 = per single unit. Use 10 for “per 10 years”, 60 for “per hour” when classes are in minutes, and so on.

Step 3 — Choose the bins

rules of thumb for a sensible starting point

a whole number from 1 to 100

more than 0

must be at or below your smallest value

textbooks differ; this sets the convention

Step 3b — What should the bar heights show?

Percent heights let you compare data sets of different sizes; density heights make the total bar area 1.

Step 4 — Units and rounding

shown next to values and axis titles

Learning options

Result

No result yet. Enter your data above and click Calculate.

How to use this calculator

  • Choose Make a Histogram when you have a list of raw numbers. Paste them in, pick a rule for the number of bins (or set your own bin width), and get the bins, frequencies, mean, median, shape and a labeled chart with a box plot underneath. You can show the bar heights as counts, as percent of all values, or as density.
  • Choose Frequency Table when the data are already grouped into classes, for example “20-29: 8”. You get the histogram, a frequency polygon, and estimates of the mean, median, mode and standard deviation.
  • Choose Unequal Classes when class widths differ. The calculator converts frequencies to frequency density so that bar area shows the count, and shows you the misleading version next to the correct one.
  • Choose Cumulative & Percentiles to build an ogive and read off the median, quartiles, any percentile, or the percentile rank of a value, then compare those grouped estimates with the exact values from your raw data.
  • Choose Bin Width Explorer to see the same data drawn with 2 to 4 different numbers of bins, plus what the common rules of thumb (Sturges, square root, Rice, Scott, Freedman–Diaconis) would suggest.
  • Enter one value per line or separate values with spaces or commas, then click Calculate to see the result, a callout explaining what it means, a diagram built for that task and every step with your numbers substituted.

How histograms work

1

A histogram shows the distribution of one numerical variable. The number line is cut into equal-width intervals called bins, every value is counted into the bin it falls in, and each bar's height is that count, the frequency.

2

The bars touch. That is the main visual difference from a bar chart, which compares separate categories and keeps gaps between bars. A histogram's x-axis is a continuous scale, so the order and the widths matter.

3

Bin width = range ÷ number of bins, where range = largest − smallest. Rules of thumb pick the number of bins from n: Sturges uses ⌈log₂ n⌉ + 1, the square-root rule uses ⌈√n⌉, and Rice uses ⌈2·∛n⌉. Scott's and Freedman–Diaconis choose the width from the spread of the data instead.

4

Each value belongs to exactly one bin, so the frequencies add up to n. Relative frequency = frequency ÷ n shows each bin as a fraction or percent of the data, and the running total is the cumulative frequency.

5

A value sitting exactly on an edge needs a rule. Either bins include their left edge, [a, b), so 20 goes in the bin starting at 20, or they include their right edge, (a, b], so 20 goes in the bin ending at 20. The last (or first) bin also includes its outer edge so no value is dropped.

6

Read the shape: how many peaks (one is unimodal, two is bimodal), whether one tail is longer (right-skewed or left-skewed), and whether there are gaps or isolated bars far from the rest, which may be outliers. In a right-skewed set the mean is pulled above the median.

7

If classes have unequal widths, bar height must be frequency density = frequency ÷ class width, so that area (width × height) equals frequency. Reading unequal classes by height alone gives the wrong impression.

8

The picture depends on your bins. Too few bins hide features such as a second peak; too many bins make random ups and downs look like structure. Try several bin widths and trust only the features that survive.

Formulas & Equations Used

Range: range = largest − smallest

Bin width: width = range ÷ k

Number of bins (rules of thumb): Sturges k = ⌈log₂ n⌉ + 1,   square root k = ⌈√n⌉,   Rice k = ⌈2·∛n⌉

Width rules: Scott w = 3.49·s ÷ ∛n,   Freedman–Diaconis w = 2·IQR ÷ ∛n

Relative frequency: relative frequency = frequency ÷ n

Class midpoint: midpoint = (lower boundary + upper boundary) ÷ 2

Estimated mean from a table: mean ≈ Σ(f × midpoint) ÷ n

Estimated median / percentile: value ≈ L + (position − CF) ÷ f × w,   position = n × p

Estimated mode: mode ≈ L + (f₁ − f₀) ÷ (2f₁ − f₀ − f₂) × w

Estimated standard deviation: s ≈ √[ Σ f(midpoint − mean)² ÷ (n − 1) ]

Frequency density: density = frequency ÷ class width,   area = density × width = frequency

Bar height as a percent: height = frequency ÷ n × 100%

Bar height as density (raw data): height = frequency ÷ (n × bin width),   total area = 1

Relative frequency density: relative density = frequency ÷ (n × class width),   total area = 1

Percentile rank (ogive): rank ≈ cumulative frequency at x ÷ n × 100%

Example Problems & Step-by-Step Solutions

Example 1 — Where does 20 go?

Twelve values: 10, 20, 20, 25, 30, 30, 30, 40, 40, 45, 50, 50. Make a histogram with bin width 10.

Step: With left edges included, [a, b), the bins are [10, 20), [20, 30), [30, 40) and [40, 50], where the last bin also takes its right edge so the 50s are not lost. With right edges included, (a, b], they are [0, 10], (10, 20], (20, 30], (30, 40], (40, 50], where the first bin also takes its left edge.

Result: left-closed counts are 1, 3, 3, 5; right-closed counts are 1, 2, 4, 2, 3. Same data, different picture, so always state your edge convention.

Example 2 — Choosing the bins

30 quiz scores run from 52 to 100. How many bins does Sturges' rule suggest, and what are the frequencies?

Step: k = ⌈log₂ 30⌉ + 1 = ⌈4.91⌉ + 1 = 6. Range = 100 − 52 = 48, so width = 48 ÷ 6 = 8, rounded up to the round number 10. Edges 50, 60, …, 100.

Result: 5 bins with frequencies 6, 5, 10, 8, 1. The tallest bar is [70, 80) with 10 scores, and the mean (72.7) is close to the median (73.5).

Example 3 — A right-skewed shape

36 commute times (minutes) are grouped in bins of width 10. What does the histogram show?

Step: Counts from 0 upward are 2, 15, 10, 3, 2, 0, 2, 1, 1. Mean = 26.72 min; median = 20.5 min.

Result: one peak at [10, 20) with a long tail to the right. The few very long commutes (67, 68, 74, 87 min) drag the mean above the median: right-skewed.

Example 4 — Estimating from a frequency table

Ages: 20-29: 8, 30-39: 14, 40-49: 22, 50-59: 11, 60-69: 5 (n = 60). Estimate the mean, median and mode.

Step: True boundaries are 19.5, 29.5, …, 69.5 (width 10). Midpoints 24.5, 34.5, 44.5, 54.5, 64.5, so mean = 2580 ÷ 60 = 43. Median: 39.5 + (30 − 22) ÷ 22 × 10 = 43.14. Mode: 39.5 + (22 − 14) ÷ (44 − 14 − 11) × 10 = 43.71.

Result: mean 43, median 43.14, mode 43.71 years, all estimates because the exact ages are hidden inside the classes.

Example 5 — Unequal class widths

Classes 0-5: 10, 5-10: 15, 10-20: 30, 20-40: 40, 40-80: 40. Which class is most densely packed?

Step: Widths 5, 5, 10, 20, 40. Density = frequency ÷ width = 2, 3, 3, 2, 1. Check areas: 2 × 5 = 10, 3 × 5 = 15, 3 × 10 = 30, 2 × 20 = 40, 1 × 40 = 40, total 135.

Result: the densest classes are 5-10 and 10-20 (density 3). The classes with the most people, 20-40 and 40-80 (40 each), are wide, so their density is only 2 and 1.

Example 6 — Median and quartiles from an ogive

Use the 30 scores in bins of width 10 (cumulative frequencies 6, 11, 21, 29, 30 at 60, 70, 80, 90, 100). Estimate the median and Q1.

Step: Median position = 30 × 0.5 = 15, in [70, 80) with 11 before and 10 inside: 70 + (15 − 11) ÷ 10 × 10 = 74. Q1 position 7.5, in [60, 70) with 6 before and 5 inside: 60 + (7.5 − 6) ÷ 5 × 10 = 63.

Result: median ≈ 74, Q1 ≈ 63. The exact values from the raw scores are 73.5 and 66.5, so grouping changes the answers a little.

Example 7 — Percentile rank

On the same ogive, what percentile rank does a score of 85 have?

Step: 85 is halfway through [80, 90). Cumulative frequency = 21 + 0.5 × 8 = 25, so rank ≈ 25 ÷ 30 = 83.33%.

Result: about 83.33% from the ogive. In the raw data 28 of the 30 scores are 85 or below, which is 93.33%: the bin assumed the 8 scores were spread evenly, but most are in the lower half of [80, 90).

Example 8 — Too few, too many

The same 50 waiting times (12 to 51 minutes) are drawn with 3, 6 and 12 bins. What changes?

Step: 3 bins of width 13: 16, 21, 13. 6 bins of width 6.5: 14, 2, 12, 9, 10, 3. 12 bins of width 3.25: 5, 9, 1, 1, 11, 1, 5, 4, 6, 4, 1, 2.

Result: 3 bins show one hump, 6 bins reveal two peaks with a dip between them, and 12 bins add a spurious third peak that is just noise. A moderate number of bins is best.

Frequently Asked Questions

What is a histogram?

A histogram is a bar graph of a numerical data set in which the number line is divided into equal-width bins and each bar's height shows how many values fall in the bin. It shows the shape, centre and spread of the data at a glance.

What is the difference between a histogram and a bar chart?

A bar chart compares separate categories (like favorite foods), so its bars have gaps and can be reordered. A histogram shows a numerical variable on a continuous scale, so its bars touch and must stay in numerical order.

How many bins should I use?

There is no single right answer. Sturges' rule, the square-root rule and the Rice rule are quick starting points based on n; Scott's and Freedman–Diaconis choose a width from the data's spread. Try a few values and keep the one where the shape stays stable.

How do I find the bin width?

Divide the range (largest minus smallest) by the number of bins, then, if you like, round up to a round number such as 2, 5, 10 or 25 so the edges are easy to read. Or choose the width first and let the number of bins follow.

Which bin does a value on an edge go in?

It depends on the convention. Most software and many textbooks include the left edge, [a, b), so 20 belongs to the bin that starts at 20. Some courses include the right edge, (a, b]. Use the “A value on an edge goes…” setting to match yours.

What are relative and cumulative frequency?

Relative frequency is the frequency divided by n, the share of the data in a bin. Cumulative frequency is the running total of the frequencies up to and including a bin, and cumulative % is that total as a percent of n.

When do I need frequency density?

Whenever the classes are not all the same width. Bar area must then equal frequency, so height = frequency ÷ class width. If you plot raw frequencies for unequal classes, wide classes look more important than they are.

How do I describe the shape of a histogram?

Say how many peaks it has (one, two or more), whether it is symmetric or skewed (the side with the longer tail), and whether there are gaps or isolated far-away bars. Add the typical value and the spread: mean and standard deviation, or median and IQR for skewed data.

How can I estimate the mean from a frequency table?

Multiply each class midpoint by its frequency, add these products and divide by n. This treats every value as if it sat at its class midpoint, so it is an estimate; the exact mean needs the raw data.

What is an ogive and how do I read a percentile from it?

An ogive is a cumulative frequency graph, with points at each class's upper boundary. To find a percentile, go across from p% of n on the vertical axis to the curve, then down to the horizontal axis. The median is the 50% point.

What if my classes are written 10-19, 20-29?

Those are whole-number class limits with a gap of 1. The true boundaries lie halfway across each gap (9.5, 19.5, 29.5, …), so the bars can touch. This calculator makes that adjustment automatically and tells you when it does.

What is a relative frequency histogram?

It has the same bars as an ordinary histogram, but each height is the frequency divided by n (often shown as a percent), so the heights add to 100%. Use it to compare two data sets of different sizes, where raw counts would not be comparable.

What is the difference between a percentile and a percentile rank?

A percentile is a value: the 90th percentile is the number that 90% of the data fall at or below. A percentile rank is a percentage: the percentile rank of a score of 85 is the percent of scores at or below 85. Use the ogive to go from one to the other.

Why does my histogram look different from Excel or my teacher's?

Different bin widths, different starting points, and different edge conventions all change the picture. Match the first bin start, the width and the edge rule, and the counts will agree. Software often picks the bins automatically, so compare settings first.

Frequency Distributions
2. Describing Data with Tables and Graphs
5 problems
Topic
Laura
Histograms
2. Describing Data with Tables and Graphs
5 problems
Topic
Brendan
Frequency Polygons
2. Describing Data with Tables and Graphs
3 problems
Topic
Mean
3. Describing Data Numerically
4 problems
Topic
Ernest
Median
3. Describing Data Numerically
7 problems
Topic
Zachary
Mode
3. Describing Data Numerically
5 problems
Topic
Zachary
Standard Deviation
3. Describing Data Numerically
7 problems
Topic
Jonathan
Percentiles & Quartiles
3. Describing Data Numerically
5 problems
Topic
Jonathan
Boxplots
3. Describing Data Numerically
5 problems
Topic
Brendan
2. Describing Data with Tables and Graphs - Part 1 of 2
5 topics 11 problems
Chapter
Brendan
2. Describing Data with Tables and Graphs - Part 2 of 2
5 topics 8 problems
Chapter
Jonathan
3. Describing Data Numerically - Part 1 of 2
5 topics 15 problems
Chapter
David-Paige
3. Describing Data Numerically - Part 2 of 2
3 topics 8 problems
Chapter
Jonathan
Frequency Distributions
2. Describing Data with Tables and Graphs
10 problems
Topic
Justin
Histograms
2. Describing Data with Tables and Graphs
10 problems
Topic
Jonathan
Histograms w/ Graphing Calculator
2. Describing Data with Tables and Graphs
10 problems
Topic
Frequency Polygons
2. Describing Data with Tables and Graphs
10 problems
Topic
Median
3. Describing Data Numerically
10 problems
Topic
Jonathan
Mean
3. Describing Data Numerically
10 problems
Topic
Brendan
Mode
3. Describing Data Numerically
5 problems
Topic
David-Paige
Boxplots
3. Describing Data Numerically
5 problems
Topic
Ernest
Standard Deviation
3. Describing Data Numerically
10 problems
Topic
Jonathan
Percentiles & Quartiles
3. Describing Data Numerically
10 problems
Topic
Jonathan
2. Describing Data with Tables and Graphs
10 topics 15 problems
Chapter
David-Paige
3. Describing Data Numerically
8 topics 19 problems
Chapter
Jonathan
Back to all calculatorsAll calculators