Skip to content

Histogram Maker

Paste a list of numbers and get a histogram with sensible bins, every bin edge stated exactly, and a frequency table with relative and cumulative frequencies. Choose Sturges', Scott's or the Freedman–Diaconis rule — or set your own bin width — and see the arithmetic with your numbers. Free, no sign-up.

Paste a column from a spreadsheet or type the values. If your numbers use decimal commas, separate them with semicolons.

30 values

Bar height
Distribution of Exam ScoresHistogram of 30 values in 6 bins from 40 to 100. The tallest bin, [70, 80), holds 9 values.Distribution of Exam ScoresExam scoreFrequency0246810405060708090100247953

Bins and frequencies

Sturges' rule: k = ⌈log₂ 30⌉ + 1 = 6 bins, so the width is 57 ÷ 6 = 9.5.

Rounded to a convenient width of 10, starting at 40.

6 bins

BinIntervalFrequencyRelative frequencyCumulative frequency
1[40, 50)20.0672
2[50, 60)40.1336
3[60, 70)70.23313
4[70, 80)90.322
5[80, 90)50.16727
6[90, 100]30.130

Each bin includes its lower edge and excludes its upper edge, written [a, b), except the last bin, which includes both: [a, b].

Labels and style

Bar color

Takes the title out of the image and the gridlines out of the plot, and sets the figure number in bold and the title in italics above the chart — the APA 7 layout.

How to Use the Histogram Maker

  1. 1. Paste the raw values. Separate the numbers with commas, spaces or new lines — a column copied from a spreadsheet works. You do not need to build a frequency table first; the tool bins the values for you.
  2. 2. Choose how to bin. Sturges' rule is the default. Scott's rule and the Freedman–Diaconis rule suit larger or skewed data sets. Set the bin width myself takes a width and an optional first edge, for matching a textbook exercise or comparing two histograms on the same bins.
  3. 3. Read the working and the table. Under the chart, the rule's arithmetic is shown with your numbers, followed by every bin's interval, frequency, relative frequency and cumulative frequency.
  4. 4. Style and export. Switch the bars between frequency and relative frequency, add the titles, turn on APA style if the histogram is going in a paper, and download the SVG or PNG.

How the Bin Rules Work

RuleBin widthSuits
Sturges (1926)k = ⌈log₂ n⌉ + 1 bins; width = range ÷ kSmall to moderate, roughly symmetric data; gives few bins for large n
Scott (1979)h = 3.49 × s × n−1/3Roughly normal data
Freedman–Diaconis (1981)h = 2 × IQR × n−1/3Skewed data or data with outliers, since the IQR ignores the extremes
Your own widthany width greater than 0, with an optional first edgeMatching an assignment; comparing histograms on identical bins

n is the number of values, s the sample standard deviation, IQR the interquartile range (inclusive quartiles, as in Excel's QUARTILE.INC), and ⌈ ⌉ means round up. n−1/3 is one over the cube root of n.

A rule rarely produces a round width, so by default the tool replaces it with the nearest convenient width — 1, 2, 2.5 or 5 times a power of ten — and starts the first bin at a multiple of that width, the way a statistics course builds a frequency table. Untick Round the width to use the rule's exact width, starting at the minimum.

Worked Example

The example data are 30 exam scores from 41 to 98. Sturges' rule gives k = ⌈log₂ 30⌉ + 1 = ⌈4.91⌉ + 1 = 6 bins, so the width is the range divided by six: (98 − 41) ÷ 6 = 57 ÷ 6 = 9.5. Rounded to a convenient width of 10 and started at 40, the bins are:

BinIntervalFrequencyRelative frequencyCumulative frequency
1[40, 50)20.0672
2[50, 60)40.1336
3[60, 70)70.23313
4[70, 80)90.322
5[80, 90)50.16727
6[90, 100]30.130

The tallest bin, [70, 80), holds 9 of the 30 scores. The Freedman–Diaconis rule gives h = 2 × 18 ÷ ∛30 ≈ 11.59 for the same data, which also rounds to 10. Scott's rule gives about 15.38, which rounds to 20 and leaves only three bins — a reminder that the rules are starting points, not answers.

Bin Edges and the [a, b) Convention

A value that falls exactly on an edge has to go somewhere. Here each bin includes its lower edge and excludes its upper edge — written [a, b) — so a score of 70 counts in [70, 80), not [60, 70). The last bin includes both edges, [a, b], so the maximum is always counted. This is NumPy's convention. R's hist() closes bins on the right by default, (a, b], so the same value can land one bin lower there; when you compare with other software, check which side it closes.

Common Histogram Mistakes

  • Gaps between the bars. The bins cover a continuous number line, so the bars touch. Gaps belong to bar graphs of separate categories.
  • Too few or too many bins. Three bins hide the shape; thirty bins for thirty values show noise. Compare two or three widths before choosing.
  • Unequal bin widths. With unequal widths, bar height no longer shows the count fairly — a bin twice as wide collects about twice as many values. Keep the widths equal, as this tool does.
  • An unstated bin width. Readers cannot interpret a histogram without it. In an APA figure, give it in the note: Note. Bins are 10 points wide; each includes its lower limit.

Frequently Asked Questions

How many bins should a histogram have?
There is no single right number. Sturges' rule, k = ⌈log₂ n⌉ + 1, gives 6 bins for 30 values and 8 for 100; Scott's and the Freedman–Diaconis rules work from the spread of the data instead and give more bins for large samples. Start with a rule, then compare one width wider and one narrower and keep the clearest.
What is Sturges' rule?
Sturges' rule sets the number of bins to k = ⌈log₂ n⌉ + 1, where n is the number of values, and the bin width to the range divided by k. For 30 values, log₂ 30 ≈ 4.91, which rounds up to 5, so k = 6. It assumes roughly bell-shaped data and gives too few bins for very large samples.
What is the difference between a histogram and a bar graph?
A histogram shows the distribution of one numeric variable: each bar covers a range of values, the bars touch, and their order follows the number line. A bar graph compares separate categories, so its bars have gaps and can be sorted. For categories, use the Bar Graph Maker.
What is a relative frequency histogram?
It is a histogram whose bar heights are each bin's share of all the values — frequency divided by n — instead of the count. The bars then sum to 1, so histograms of samples of different sizes can be compared directly. Choose Relative frequency above the chart to switch; the shape does not change, only the y-axis.
Which bin does a value on a bin edge go into?
The upper one. Each bin includes its lower edge and excludes its upper edge, [a, b), so 70 goes in [70, 80). The only exception is the last bin, [a, b], which also includes its upper edge so that the maximum is counted.
How do I make a histogram from a frequency table?
If you only have grouped counts, enter each class midpoint as many times as its frequency — 45, 45 for a class of 40–50 with two values — then choose Set the bin width myself, with the class width as the bin width and the lowest class limit as the first edge. The bars then match your table exactly. If you have the raw data, paste it instead and the tool builds the table for you.

Related Tools

More in Charts & Diagrams

See all Charts & Diagrams