A histogram calculator takes a raw list of measurements and answers one question: what shape is this data? It does that by chopping the number line into equal-width intervals called bins, counting how many values land in each bin, and drawing a bar whose height is that count. The tool above does the binning, counting, table and chart in one pass.
Arb Digital built this page because binning is the one step where two people analysing identical data can honestly reach different conclusions. Software packages disagree on default bin counts, on where the first bin starts, and on which side of a boundary a value belongs to. This calculator exposes every one of those choices instead of hiding them behind a default.
What This Histogram Calculator Does
Paste any list of numbers and the tool sorts them, finds the minimum and maximum, builds equal-width bins across that range, and counts the values in each. It reports the modal bin as the headline result, together with the number of values, the bin count, the bin width and the range. Below that it draws a proportional bar for every bin and prints a frequency table with counts, relative frequency and a running cumulative total.
It is deliberately different from our frequency distribution calculator, which tallies how often each distinct value or category occurs without grouping anything into intervals; this page groups continuous measurements into bins you control and draws the resulting chart. If you want the centre and spread of the same data rather than its shape, the descriptive statistics calculator produces the full summary in one go.
How to Use It
- Paste your data. Commas, spaces, tabs and line breaks all work, so a column copied straight out of a spreadsheet pastes cleanly. Non-numeric text is skipped rather than treated as zero.
- Choose what drives the bins. Pick "bin count" if you want a set number of bars, or "bin width" if the width has to be a meaningful unit — 5 marks, 10 years, one second.
- Set the number or the width. The field you are not using is recalculated and displayed, so you always see both.
- Optionally force a starting edge. Entering 50 for exam marks gives you bins of 50–60, 60–70 and so on instead of bins that begin at whatever the lowest score happened to be.
- Or let a rule choose. The two buttons apply Sturges' rule and the Freedman-Diaconis rule. They will usually give you different answers, which is the point of the section below.
The Formula: How Bins Are Calculated
With a chosen bin count k, the bin width is simply the range divided by the number of bins: width = (max − min) ÷ k. The edges are then min, min + width, min + 2×width, and so on up to the maximum. With a chosen bin width w, the count runs the other way: k = ceiling((max − min) ÷ w), so the final bin may extend slightly past the largest value, which is normal and harmless.
Assigning a value to a bin is one division and one floor: bin index = floor((x − start) ÷ width). That single line encodes the convention that every bin is closed on the left and open on the right, written [lower, upper). A value on a boundary falls into the bin above it. The exception is the last bin, closed on both sides so the maximum value has somewhere to go.
Sturges vs Freedman-Diaconis: Why the Two Rules Disagree
Sturges' rule sets the bin count from the sample size alone: k = ceiling(log₂ n) + 1. Forty-one values give ceiling(5.36) + 1 = 7 bins. It is quick, it is what most introductory courses teach, and it never looks at the data itself — only at how many numbers there are. That is its weakness. It was derived by assuming the data is roughly normal, so on strongly skewed or long-tailed data it systematically asks for too few bins, and on large samples it grows so slowly that a dataset of ten thousand points gets only fifteen bars.
The Freedman-Diaconis rule sets the bin width instead, from the interquartile range: width = 2 × IQR ÷ n^(1/3). Because it uses the IQR rather than the full range or the standard deviation, it is barely affected by a few extreme values, which makes it the safer default on messy real data. The default dataset loaded above shows the disagreement plainly. Sturges asks for 7 bins; Freedman-Diaconis produces a width of about 12.76, which across a range of 44 works out to 4 bins.
Those two answers tell genuinely different stories. At 7 bins the data shows two clear humps with an empty bin between them — a bimodal distribution, which for exam marks usually means two distinct groups of students. At 4 bins that gap is swallowed inside a wide bar and the distribution looks almost flat. Neither rule is wrong: Freedman-Diaconis optimises the average error of the density estimate and will smooth away a narrow gap to do it. Treat both as starting points, not answers.
The [lower, upper) Convention, and Why Software Disagrees
Take a value of exactly 70 with bins 60–70 and 70–80. Does it belong to the lower bin or the upper one? This calculator, like most statistical software, puts it in the upper bin: intervals are half-open, [60, 70) and [70, 80), so 70 goes with the second. R's hist() function does the opposite by default, closing intervals on the right — (60, 70] and (70, 80] — so R would place that same 70 in the lower bin. Excel's older Analysis ToolPak histogram also uses "less than or equal to" bin edges, matching R rather than this page.
On continuous measurements recorded to several decimal places the convention almost never matters, because exact ties on a boundary are rare. On rounded data — whole-number test scores, ages in years, prices ending in .00 — it matters a great deal, and it is the single most common reason two people binning the same spreadsheet get different bar heights. Confirm the convention before assuming anyone made an arithmetic mistake, and state it in the caption.
Bin Count Changes the Story You Tell
Too few bins and the histogram becomes a blunt instrument. Real structure — two peaks, a gap, a cluster at the bottom of the range — is averaged inside bars wide enough to hide it, and a genuinely bimodal distribution can be flattened into something that looks unremarkable. This failure is dangerous precisely because the resulting chart looks clean and confident.
Too many bins and you get the opposite problem. Every bar is one or two observations high, the outline turns into a comb of spikes and empty gaps, and you start explaining random sampling noise as if it were a pattern. With 41 values, asking for 30 bins guarantees this. Step the count up and down from the rule-based suggestion and keep only the features that survive several nearby settings.
Histogram vs Bar Chart: Not the Same Chart
A histogram shows the distribution of one continuous numeric variable. A bar chart compares counts or totals across separate categories. The difference is not cosmetic and it is not about whether the bars touch, though the touching is a useful signal: in a histogram the bars are adjacent because the underlying scale is continuous and there is no gap between 60–70 and 70–80.
Three practical consequences follow. Histogram bars cannot be reordered, because the x-axis is a number line — sorting a histogram tallest-first destroys it, while sorting a bar chart is often an improvement. Histogram bars can be merged into a coarser histogram, whereas merging two unrelated bar chart categories is meaningless. And an empty histogram bin is real information, while a missing bar chart category usually just means the category was not measured.
Frequency or Density on the Y-Axis
With equal-width bins, plotting raw counts is fine, and that is what this tool draws. The moment bins are unequal, raw counts start lying. A bin twice as wide as its neighbours collects roughly twice as many values simply by covering twice as much of the number line, so it grows a tall bar that reflects the bin's width rather than any concentration in the data.
The fix is to plot density instead: bar height = count ÷ (n × bin width). Every bar's area then represents its share of the observations, and the total area comes to 1. This makes wide and narrow bins comparable, which is why density plots use that scale. It also means the y-axis on a density histogram is not a count and should never be read as one. Unequal bins are common in published income and age bands, so check which scale a chart uses before comparing bar heights.
Reading Skew, and When a Box Plot Is Better
Shape is the reason to draw the chart at all. A right-skewed (positively skewed) histogram has its bulk on the left and a tail stretching right, typical of incomes and waiting times; there the mean sits above the median, so quoting a mean overstates the typical case. A left-skewed histogram reverses this. A symmetric single peak means mean and median agree. Two peaks almost always mean two mixed populations, and the useful next step is to find the variable that separates them. Our mean, median and mode calculator and the standard deviation calculator give you the numbers to pair with the shape you see.
A histogram is the wrong tool for two jobs. Comparing several groups side by side gets unreadable fast, because overlapping histograms are hard to separate visually — the box plot calculator handles that far better, since a row of box plots compares medians and spreads at a glance. And a histogram is poor at pinpointing extreme values, since a single distant point becomes a bar one unit high; to test specific values against a rule, use the outlier calculator. The NIST/SEMATECH e-Handbook of Statistical Methods treats the histogram as a core exploratory graphic for exactly this reason: it is the fastest way to see shape. The underlying density estimation theory behind the binning rules is covered in the open course material published by MIT OpenCourseWare.
Arb Digital publishes hundreds of free calculators covering statistics, algebra, geometry and finance — all of them free to use, with no sign-up and no limits on how often you run them.
Browse All Free Tools Suggest a ToolCommon Mistakes to Avoid
- Accepting the software's default bin count. Every package picks a different default, and none of them has seen your research question. Always try two or three settings.
- Using unequal bins with a frequency y-axis. Wide bins then look important purely because they are wide. Switch to density, or keep the bins equal.
- Leaving the boundary convention unstated. Half your readers will assume [lower, upper) and half will assume the opposite, and on rounded data they will get different bar heights.
- Reading a histogram as a time series. The x-axis is a measurement scale, not a sequence. A histogram of daily sales tells you nothing about trend over time.
- Binning too few observations. Below about twenty values a histogram is mostly noise; a dot plot or the raw sorted list is more honest at that sample size.
Related Free Tools From Arb Digital
Pair the shape you see here with the numbers behind it: the centre from the mean, median and mode calculator, the spread from the standard deviation calculator, distinct-value counts from the frequency distribution calculator, and a five-number view from the box plot calculator. More are listed in the free tools hub.
Frequently Asked Questions
There is no single correct number. Sturges' rule gives ceiling(log2 n) + 1, which suits roughly normal data of modest size. The Freedman-Diaconis rule sets a width of 2 times the IQR divided by the cube root of n and copes better with skew and outliers. Try both, then adjust until the features you can see survive several nearby settings.
This calculator uses half-open intervals written as lower to upper with the upper edge excluded, so a value equal to a boundary falls into the higher bin. The last bin is closed on both sides so the maximum value is included. R's hist function closes intervals on the right by default, which is why it can produce different bar heights on the same data.
A histogram shows the distribution of one continuous numeric variable across intervals, so the bars touch and cannot be reordered. A bar chart compares separate categories, so the bars are usually separated and can be sorted freely. Using one in place of the other answers a different question than the one you asked.
The modal bin is the interval containing more values than any other, and it is the histogram equivalent of the mode. It gives the most common range rather than a single most common value, which is the useful summary when the data is continuous and exact repeats are rare.
Three things usually differ: the default bin count, the position of the first bin edge, and the boundary convention. Excel's Analysis ToolPak treats bin values as upper limits with less-than-or-equal-to matching. Set the bin count, the starting edge and the width explicitly in both tools and the charts will agree.
Yes, and a gap is real information. An empty bin means no observations fell in that interval, which often signals two separate groups mixed into one dataset. That is different from a bar chart, where a missing bar usually just means the category was not recorded.
Use density whenever the bins are not all the same width. Density is the count divided by n times the bin width, which makes each bar's area rather than its height represent its share of the data. With equal-width bins the two scales have the same shape, so plain counts are fine.
This calculator is provided for study and for checking your own working. It is not a substitute for showing the binning steps your course or assessment requires.