Histogram Maker
Paste raw data and get a labelled histogram with its frequency table. Change the bin width or starting point and the chart redraws instantly.
Choosing a bin width
The same data can look smooth, lumpy or flat depending on the bins. Too few bins hide structure such as a second peak; too many turn sampling noise into fake spikes. The rules offered above give a sensible starting point:
- Sturges (1926): k = 1 + log₂ n classes. Good for small, near-normal samples; too few bins for large data.
- Square root: k = √n. Simple, and often what textbooks and spreadsheet tools use.
- Freedman–Diaconis (1981): width = 2 × IQR ÷ ∛n. Robust to outliers, and a good choice for skewed data.
Widths are rounded to a “nice” number (1, 2, 2.5 or 5 times a power of ten) so class limits are easy to read. For small data sets, a stem-and-leaf plot shows the same shape while keeping every value visible; for comparing groups, a box plot is more compact.
Frequently asked questions
How do I make a histogram?
Sort the data into equal-width classes (bins), count how many values fall in each, and draw touching bars whose heights are those counts. Paste your numbers above and the bins, counts and chart are produced for you; change the bin width to see how the picture changes.
How many bins should a histogram have?
There is no single right answer. Sturges’ rule (1 + log₂ n) suits small, roughly normal data; the square-root rule (√n) is a common classroom default; the Freedman–Diaconis rule uses the IQR and copes better with skew and outliers. Try two or three widths: real features survive every reasonable choice.
What is the difference between a histogram and a bar chart?
A histogram shows the distribution of one numerical variable, so the bars touch and the x-axis is a continuous number line. A bar chart compares separate categories, so the bars have gaps and could be reordered without changing the meaning.
Which bin does a value on a boundary go into?
Here each class includes its lower limit and excludes its upper limit, [lower, upper), except the last class, which also includes its upper limit. This is the convention used by most textbooks and by R’s hist() with right = FALSE.
How do I describe the shape of a histogram?
Comment on centre, spread, shape (symmetric, skewed left or right, unimodal or bimodal) and any outliers or gaps. The page gives a skewness value as a guide; a value between about −0.5 and 0.5 is usually called roughly symmetric.
What is a frequency polygon or ogive?
A frequency polygon joins the tops of the bars at their midpoints. An ogive plots cumulative frequency at each upper class boundary, which makes it easy to read off medians and percentiles. Both can be overlaid on the chart above.