How to use the histogram maker
- Type or paste your numbers, separated by spaces, commas or new lines, or choose a .csv or .txt file. Press Use example scores to see how it works.
- Choose how to choose bins. Sturges, Scott and Freedman-Diaconis pick equal bins from the smallest to the largest number. Number of bins sets the count yourself, and Bin width makes bins that start on round multiples of the width, such as 0, 10, 20.
- Decide where a number that sits exactly on a bin edge belongs, in the bin to its right or its left, and whether bars show counts or percent of all values. Add a title and a label if you like.
- The histogram and a table of every bin appear as you type. Use Download PNG or Download SVG for the picture, Download CSV for the table, or Copy table for text.
Ten values in bins of width 10
Take the values 3, 7, 12, 15, 18, 21, 29, 30, 44 and 49 with a bin width of 10. The bins are 0 to 10, 10 to 20, 20 to 30, 30 to 40 and 40 to 50, and the counts are 2, 3, 2, 1 and 2. The value 30 sits exactly on an edge, so it goes into the 30 to 40 bin when edges belong to the right bin, and into the 20 to 30 bin when they belong to the left one.
The example scores have 32 values from 52 to 97, with a mean of 76.3125 and a median of 76.5. In bins of width 10 they fall into 2, 5, 13, 8 and 4 values from the 50s up to the 90s. The Sturges rule would use ceil(log2(32) + 1) = 6 equal bins for the same data.
Choosing the number of bins
Too few bins hide the shape of the data, and too many make it look ragged. The three automatic rules give a starting point. Sturges uses ceil(log2 n) + 1 bins, which suits small and fairly symmetric data. Scott's rule uses a bin width of about 3.49 times the standard deviation divided by the cube root of n. Freedman-Diaconis uses a width of 2 times the interquartile range divided by the cube root of n, which copes better with outliers. The number of bins is the range divided by that width, rounded up.
The results match numpy's histogram bin rules, checked on seven data sets. Equal bins run from the smallest to the largest value, and the last bin includes the largest value. With a set bin width, the edges are exact decimal multiples of the width, so 0.1 steps do not drift, and the tool adds bins until the largest value is inside the last bin. At most 200 bins are drawn.
Reading the chart and the table
Each bar covers one bin, and its height is the count or the share of values in it. Bars touch because the bins touch. The table lists each bin with its count, its share and the cumulative share, so you can see how many values are at or below each edge. Brackets show which edges are included: a square bracket includes the edge and a round one does not.
If you need the typical value and spread of the same data, use the descriptive statistics calculator, and for counts in a table without a chart, the frequency distribution calculator. To compare several groups side by side, the box plot maker draws one box per group.
Privacy and limits
The numbers are read and drawn in your browser. They are not uploaded. Up to 100,000 numbers are accepted, in plain decimal or exponent form. A number with thousands separators such as 1,234 is refused with a message, because a comma would otherwise split it into two numbers.
Assumptions and limits
- Bins are equal in width. Bins of different widths, and open-ended bins, are not offered.
- The automatic rules follow the formulas used by numpy, and a set number or width of bins is your own choice.
- When all values are equal, a single bin from half a unit below to half a unit above is drawn.
- Up to 100,000 numbers and 200 bins are used, and a file can be up to 1 MB.
Frequently asked questions
Which bin rule should I use?
Start with Sturges for small, tidy data and Freedman-Diaconis when there are outliers or the data is skewed. If the shape looks too lumpy or too smooth, set the number of bins yourself.
Where does a value on a bin edge go?
You choose. By default it goes into the bin to its right, so 10 falls in the 10 to 20 bin. Choose the left option for bins that include their upper edge.
Why are the first and last bins different from my range?
With a fixed bin width the edges are round multiples of the width, so the first edge can be below your smallest value, and the last edge is above your largest one.
Is my data uploaded?
No. The histogram is calculated and drawn in your browser, and the downloads are made on your device.