Clever Quest Lab Tools

Histogram Maker

2026-10-07

Paste a list of numbers to draw a histogram. Choose the bins with a rule, a fixed number of bins or a fixed bin width, switch the vertical axis between frequency, relative frequency and density, and get a frequency table and summary statistics. The chart can be saved as a PNG or SVG file.

Data and settings

Separate the numbers with spaces, commas, semicolons, tabs or new lines – a column copied from a spreadsheet works. Use a decimal point (3.5).

Histogram

Each bin includes its lower edge and excludes its upper edge; the last bin includes both edges.

Frequency table

Bin Count Relative % Cumulative count Cumulative %

[a, b) means from a up to, but not including, b; [a, b] includes both ends. Copy table puts the rows on the clipboard separated by tabs, ready to paste into a spreadsheet.

Statistics

The standard deviation is the sample form (divisor n − 1). The median and quartiles use linear interpolation between order statistics at position (n − 1)·p – the “inclusive” quartile method of common spreadsheets. Statistics are rounded to 4 decimal places, or to 2 more than your data has when that is more.

Everything is calculated locally in your browser – your data is not sent to a server.

How to use the histogram maker

  1. Paste or type your numbers into Data values. Spaces, commas, semicolons, tabs and new lines all work as separators.
  2. Edit the chart title and the two axis labels.
  3. Choose the bins: an automatic rule, a fixed number of bins, or a fixed bin width with an optional start value.
  4. Pick the vertical axis – frequency, relative frequency or density – and switch the value labels, mean line and median line on or off.
  5. Hover over a bar or tap it to read its range, count and percentage. On a keyboard, focus a bar and use the Left and Right arrow keys; Home and End jump to the ends.
  6. Take the result with you: Copy table, Download PNG or Download SVG. Printing the page gives the chart, table and statistics without the controls.

How it works

A histogram cuts the number line into intervals called bins, counts the values in each bin and draws one bar per bin.

Let n be the number of values and range = max − min. With a chosen number of bins k, every bin has the width w = range / k. With a chosen bin width, the edges start at the start value (the smallest value if left empty) and go up in steps of w until the maximum is covered. The four rules are:

⌈ ⌉ means rounding up, s is the sample standard deviation and IQR = Q3 − Q1 is the interquartile range. Scott's rule and the Freedman–Diaconis rule give a width, not a count: the tool takes k = ⌈range / w⌉ and splits minimum to maximum into k equal bins, so the final width is usually a little smaller than w. If the IQR is 0, the Freedman–Diaconis rule cannot give a width and Sturges' rule is used instead, with a note. A rule never makes more than 100 bins.

Edge convention. Each bin includes its lower edge and excludes its upper edge, written [a, b). The last bin includes both edges, [a, b]. If all values are equal, there is a single bin.

Vertical axis. Frequency is the count. Relative frequency is count / n × 100. Density is count / (n × w), which makes the bar areas add up to 1.

Statistics. The standard deviation is the sample form, with n − 1 in the denominator. For the median and quartiles the values are sorted and the quantile p sits at position (n − 1) · p, counted from zero; a position between two values is interpolated linearly. Statistics are rounded to 4 decimal places (or 2 more than the data has, if that is more), bin edges to 2 or more.

Examples

Example 1 – Sturges' rule. The example data has 20 values from 12 to 52, a range of 40.
k = ⌈log2 20⌉ + 1 = 6 and w = 40 / 6 = 6.6667.
The edges are 12, 18.67, 25.33, 32, 38.67, 45.33 and 52; the counts are 4, 5, 4, 4, 2 and 1. The first bin holds 4 of 20 values, or 20 %, and its density is 0.2 / 6.6667 = 0.03.

Example 2 – a fixed bin width. Same data, bin width 10, start value 10. The edges are 10, 20, 30, 40, 50 and 60 and the counts are 4, 8, 5, 2 and 1. The largest value, 52, falls into the last bin, [50, 60].

Example 3 – the Freedman–Diaconis rule. Same data: Q1 = 21.75 and Q3 = 34.5, so IQR = 12.75.
w = 2 × 12.75 × 20^(−1/3) = 9.3943 and k = ⌈40 / 9.3943⌉ = 5.
The five bins are 8 wide, with counts 4, 6, 5, 3 and 2. The square-root rule gives the same bins, because ⌈√20⌉ = 5.

Example 4 – negative numbers and a value on an edge. Enter -4 -2.5 -1 0 0.5 1 1.5 2 3.5 6 and choose 4 bins. The width is 2.5, the edges are −4, −1.5, 1, 3.5 and 6, and the counts are 2, 3, 3 and 2. The value 1 lies exactly on an edge and belongs to the bin that starts there, [1, 3.5). The mean is 0.7 and the median 0.75.

How many bins should a histogram have?

There is no single correct number. Too few bins hide the shape of the data; too many turn it into noise. The rules give a starting point:

Try two or three settings: a feature that shows up under every sensible choice is real. For a chart meant for other people, use the bin width option with a round width such as 5 or 10.

Histogram or bar chart?

A bar chart compares separate categories: its bars have gaps and can be put in any order. A histogram shows how one numeric variable is distributed: the horizontal axis is a number line, the order is fixed and the bars touch. Two mistakes are common:

Frequently asked questions

What is the difference between frequency, relative frequency and density?

Frequency is the number of values in a bin. Relative frequency is that number as a percentage of all values, so the bars add up to 100 %. Density divides the relative frequency (as a fraction) by the bin width, so the bar areas add up to 1.

Why is the bin width on the chart different from Scott's formula?

The formula gives an ideal width that rarely divides the range evenly. The tool rounds the number of bins up and makes them equal from minimum to maximum, so each bin is slightly narrower. The line under the chart shows both numbers.

Why are my quartiles different from another calculator?

There are several accepted quartile methods, and they can disagree for small samples. This page interpolates at position (n − 1) · p; methods that take the median of each half of the data can give slightly different values.

Can I enter decimals, negative numbers or a large data set?

Yes. Decimals need a decimal point, and scientific notation such as 1.5e3 is accepted. Commas separate values, so write 1500 rather than 1,500. The limit is 200,000 values.

Is my data uploaded anywhere?

No. The numbers are processed in your browser and never leave your device. Data and settings are saved only in this browser's local storage.

Related tools