Interactive Histogram Generator
Histogram Calculator
| Bin Interval | Frequency | Relative Freq. | Percentage |
|---|
What Is a Histogram?
The x-axis on a histogram carries numerical values, not categories. The bars represent adjacent intervals, so they touch for continuous data. That is the main visual difference from a bar graph, which displays categorical data with separated bars.
Histograms are one of the most common tools in descriptive statistics. They let you see the overall shape of a dataset at a glance: whether observations cluster in the center, whether there is a long tail on one side, and whether any gaps or unusual clusters exist.
A histogram groups numerical observations into bins and draws a bar for each bin. Bar height = frequency. Bars touch because the intervals are continuous. That is the whole mechanism.
Parts of a Histogram
Each component of a histogram carries specific meaning. Knowing what each part represents makes reading and building one much more straightforward.
| Component | What It Shows | Example |
|---|---|---|
| X-axis | The numerical values or intervals of the variable being measured | Exam scores from 0 to 100 |
| Y-axis | Frequency, relative frequency, or percentage for each bin | Count of students per score range |
| Bar | One bin; height = count of observations in that interval | A bar from 70 to 80 with height 12 means 12 scores fell there |
| Bin width | The span of each interval | A bin width of 10 means each bar covers a 10-unit range |
| Bin boundary | The exact cut-point between adjacent bins | [70, 80) means 70 is included, 80 is not |
| Touching bars | Visual signal that the data is continuous, not categorical | No gaps between bars for a height dataset |
How to Make a Histogram
Collect the data
Gather your numerical observations. Each value will go into exactly one bin. There is no minimum sample size required by definition, but very small samples (fewer than about 10 values) rarely produce informative histograms.
Find the range
Range = Maximum − Minimum. This tells you the span of values your bins need to cover. For example, if scores run from 42 to 98, the range is 56.
Choose the number of bins
A rough starting point is Sturges' rule: k = 1 + log2(n). For 50 observations that gives about 7 bins. The section below explains other rules and why this choice matters.
Calculate bin width
Bin width = Range / Number of bins. Round up slightly so the bins cover all values. If range = 56 and k = 7, bin width = 56/7 = 8. You might round to 10 for clean labels.
Set the bin boundaries
Start the first bin at or below the minimum. Use a consistent convention: [lower, upper) means the lower boundary is included and the upper is not. Stick to that rule for all bins so no observation falls into two bins.
Count observations per bin
Go through each value and mark which bin it belongs to. The sum of all bin frequencies must equal n. If it does not, recheck your boundaries and counts.
Draw the bars
Draw a rectangle for each bin with width equal to the bin span and height equal to the frequency (or relative frequency). Bars should touch: no gaps between adjacent bins for continuous data.
Label the axes and add a title
The x-axis shows the variable name and the numerical scale. The y-axis shows "Frequency," "Relative Frequency," or "Percentage" depending on which you chose. A clear title names the variable and the dataset.
Histogram Bins and Bin Width
Bins are the intervals that divide the data's range into sections. Each observation falls into exactly one bin, and the bin's frequency is the count of observations it contains. Bin width is the span of each interval.
Range = Maximum − Minimum
k = number of bins
Automatic Binning Rules
No single rule produces the best histogram for all datasets. The goal is a bin count that shows the distribution's real shape without so many bins that the chart looks like noise.
| Rule | Formula | Good For |
|---|---|---|
| Sturges' rule | k = 1 + log2(n) | Approximately normal data; simple starting point |
| Square root rule | k = √n | Very quick estimate; tends toward more bins than Sturges |
| Scott's rule | h = 3.49 × s × n−1/3 | Approximately normal data; uses standard deviation |
| Freedman-Diaconis | h = 2 × IQR × n−1/3 | Skewed or heavy-tailed data; more robust to outliers |
The calculator above uses Sturges' rule by default and Freedman-Diaconis as an alternative. If the IQR is zero (all values identical), it falls back to a single bin and reports the issue.
Effect of Bin Width on What You See
The same dataset can look symmetric, bimodal, or nearly uniform depending purely on how many bins you choose. Always try a few different values before drawing conclusions about shape.
Too few bins merge distinct groups into a single blob. Too many bins turn a clean distribution into an irregular spike chart. The sweet spot is usually where you can see the overall shape clearly without the bars becoming so narrow that random gaps appear between adjacent counts.
Frequency, Relative Frequency, and Percentage
The y-axis of a histogram can show three related quantities. All three describe the same data; they just express it on different scales.
n = total number of observations
Sum of all frequencies = n
Sum of relative frequencies ≈ 1
Relative frequency histograms are especially useful when you want to compare two groups of different sizes, because the y-axis puts both groups on the same 0-to-1 scale regardless of how many observations each contains.
How to Read a Histogram
Reading a histogram means assessing four things: center, spread, shape, and any unusual features like gaps or isolated bars.
Center
The center is where observations are most concentrated. You can read a rough center visually by finding the approximate midpoint of the distribution. For a symmetric, unimodal histogram, the center is near the tallest bar. For a skewed distribution, the mean and median differ, with the mean pulled toward the longer tail. Keep in mind that a histogram does not directly show the exact mean or median; those require calculation from the raw data or from the frequency table.
Spread
Spread refers to how widely observations are distributed across the axis. A narrow histogram means values are concentrated; a wide one means they vary substantially. The full width of the histogram gives a rough sense of the interquartile range and overall standard deviation, though those metrics require direct calculation.
Shape
| Shape | What You See | Common Context |
|---|---|---|
| Symmetric | Left and right sides roughly mirror each other; one central peak | Heights, measurement errors |
| Right-skewed | Tail extends to the right; most values are on the left | Income, waiting times |
| Left-skewed | Tail extends to the left; most values are on the right | Exam scores when most students do well |
| Uniform | Bars are roughly equal in height across the range | Dice rolls, random number generators |
| Bimodal | Two distinct peaks | Mixed populations, shift work hours |
| Multimodal | Three or more peaks | Multiple subgroups in one dataset |
Skewness
A right-skewed histogram has a longer tail pointing toward larger values. The mean is typically pulled toward that tail and sits above the median. A left-skewed histogram has a longer tail pointing toward smaller values, pulling the mean below the median. These are common patterns, not absolute rules; always check the actual statistics rather than relying entirely on a visual impression. You can learn more about skewness and kurtosis in our dedicated guide.
Peaks and Modes
The tallest bin is the modal bin. It is not necessarily the statistical mode of the raw data, especially when bin width is large relative to the data's variation. A bimodal histogram has two prominent peaks, which often suggests the data comes from two distinct groups or processes. Bimodality deserves investigation rather than assumption.
Gaps and Clusters
A gap is a bin with zero or very few observations. It can indicate that the variable has a natural break, that there are two separate populations, or simply that the sample is small and the gap is random. Clusters are regions where observations bunch together. Neither gaps nor clusters confirm anything on their own; they guide further questions about the data.
Outliers in a Histogram
A histogram can hint at possible outliers when a small bar appears isolated far from the main distribution. However, a histogram alone does not establish outliers according to any formal rule. For that you need the raw data and a criterion such as the IQR rule or a box plot. A distant bar might reflect a genuine unusual value, a data entry error, or simply a sparse region of the distribution.
Worked Histogram Examples
Example 1: Basic Histogram from Raw Data
Data: 2, 3, 4, 5, 5, 6, 7, 8, 8, 9 (n = 10)
Range: 9 − 2 = 7
Bins (Sturges): k = 1 + log2(10) ≈ 1 + 3.32 ≈ 4 bins. Bin width = 7/4 = 1.75; round to 2 for clean labels.
Bin boundaries:
| Bin | Values Included | Frequency | Rel. Freq. | % |
|---|---|---|---|---|
| [2, 4) | 2, 3 | 2 | 0.20 | 20% |
| [4, 6) | 4, 5, 5 | 3 | 0.30 | 30% |
| [6, 8) | 6, 7 | 2 | 0.20 | 20% |
| [8, 10] | 8, 8, 9 | 3 | 0.30 | 30% |
| Total | 10 | 1.00 | 100% |
Interpretation: the distribution is roughly bimodal, with concentrations in the [4, 6) and [8, 10] bins. The data is not strongly skewed in either direction. With n = 10, the histogram provides a rough picture; a larger sample would give a clearer shape.
Example 2: Exam Score Histogram (Right-Tailed)
25 illustrative exam scores: 42, 48, 51, 55, 57, 58, 60, 62, 63, 65, 67, 68, 70, 72, 74, 75, 78, 80, 82, 85, 88, 91, 94, 97, 99
n = 25, Min = 42, Max = 99, Range = 57
Bins (Sturges): k = 1 + log2(25) ≈ 6 bins. Bin width ≈ 57/6 = 9.5; round to 10 for clean intervals.
| Bin | Frequency | Rel. Freq. | % |
|---|---|---|---|
| [40, 50) | 2 | 0.08 | 8% |
| [50, 60) | 4 | 0.16 | 16% |
| [60, 70) | 6 | 0.24 | 24% |
| [70, 80) | 5 | 0.20 | 20% |
| [80, 90) | 4 | 0.16 | 16% |
| [90, 100] | 4 | 0.16 | 16% |
| Total | 25 | 1.00 | 100% |
Interpretation: the histogram is roughly bell-shaped with a peak in the 60s. There is a slight upper tail (four scores in the 90-100 range). This is fairly typical of exam score distributions where most students cluster in the middle range. The data are illustrative and do not represent any real class.
Example 3: Right-Skewed Data (Waiting Times)
Illustrative waiting times (minutes): 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 7, 9, 12, 15, 22, 35
n = 20, Min = 1, Max = 35, Range = 34
Bins (Sturges): k ≈ 5. Bin width = 34/5 ≈ 7; use width 7.
| Bin | Frequency | % |
|---|---|---|
| [1, 8) | 16 | 80% |
| [8, 15) | 2 | 10% |
| [15, 22) | 1 | 5% |
| [22, 29) | 0 | 0% |
| [29, 36] | 1 | 5% |
| Total | 20 | 100% |
Interpretation: most waiting times are short (under 8 minutes), and the distribution has a long right tail. This pattern is characteristic of right skew. The mean will be pulled above the median because the few large values stretch the average upward. Such a shape is common for service waiting times, where most customers are served quickly but an occasional long wait occurs.
Example 4: Bimodal Histogram
Illustrative heights (cm) from a mixed group: 152, 154, 155, 156, 158, 159, 160, 161, 162, 163, 172, 173, 174, 175, 176, 177, 178, 179, 180, 182
n = 20, Min = 152, Max = 182, Range = 30
Bins: 6 bins with width 5. Boundaries: 152, 157, 162, 167, 172, 177, 182.
| Bin | Frequency |
|---|---|
| [152, 157) | 3 |
| [157, 162) | 6 |
| [162, 167) | 1 |
| [167, 172) | 0 |
| [172, 177) | 5 |
| [177, 182] | 5 |
Interpretation: two clusters appear: one around 157-162 cm and one around 172-182 cm, with a gap between them. This bimodal pattern often indicates the data comes from two distinct groups, for example, a mixed sample of men and women measured separately and then combined. The histogram prompts the question "are there two subgroups here?" rather than answering it; checking the raw data or grouping variable would be the next step.
Histogram vs Bar Graph
This comparison trips up a lot of students. The two charts look similar but represent fundamentally different types of data.
| Feature | Histogram | Bar Graph |
|---|---|---|
| Data type | Numerical (quantitative) | Categorical |
| Bars | Touch (continuous intervals) | Separated (distinct categories) |
| X-axis | Numeric scale with bin boundaries | Category labels in any order |
| Bar width | Represents the interval span | Arbitrary; carries no data meaning |
| Bar order | Fixed by numerical order | Can be reordered without distorting meaning |
| Purpose | Show the distribution of one numeric variable | Compare quantities across categories |
The most reliable test: if you could reorder the bars and the chart would still make sense, it should be a bar graph. If reordering would destroy the meaning, it belongs as a histogram.
Histogram vs Box Plot
A histogram and a box plot describe the same data but emphasize different things. They are commonly used together.
A histogram shows distribution shape in detail. A box plot shows the five-number summary compactly and makes outliers easy to spot. Together they give a fuller picture than either alone.
| Comparison | Histogram | Box Plot |
|---|---|---|
| What it shows | Full distribution shape | Quartiles, median, and potential outliers |
| Modes visible? | Yes | Not directly |
| Skewness visible? | Yes | Yes, but less precisely |
| Outliers visible? | Sometimes, as isolated bars | Explicitly plotted as dots |
| Best for | Understanding overall shape | Comparing distributions across groups |
See our complete guide to data visualization for more comparison tools.
Real-World Applications
Education
Exam score distributions, grade distributions, time-on-task measurements for students.
Business
Sales transaction amounts, customer purchase values, order processing times.
Healthcare
Blood pressure readings, cholesterol levels, patient age distributions in clinical trials.
Manufacturing
Component measurements, defect counts, process variation around a target value.
Finance
Daily returns, transaction amounts, loan repayment periods.
Research
Survey response distributions, experimental measurements, time-series values.
Advantages and Limitations
Advantages
- Shows distribution shape at a glance: symmetric, skewed, bimodal, or uniform
- Handles large datasets well, where dot plots become cluttered
- Reveals where observations concentrate and where they are sparse
- Can suggest whether a normal distribution might be plausible
- Frequency tables that underlie histograms are easy to audit and reproduce
Limitations
- The appearance depends on bin choice; different bins can imply different shapes
- Individual observations are not visible in the chart
- Very small samples rarely produce informative histograms
- Two histograms with different bin boundaries cannot be compared directly
- A histogram does not prove that data follow a normal or any other named distribution
- It shows only one variable; it cannot show the relationship between two variables
Common Histogram Mistakes
| Mistake | What Goes Wrong | What to Do Instead |
|---|---|---|
| Using a histogram for categories | The bars have no numeric meaning, so the chart is misleading | Use a bar graph for categorical data |
| Leaving gaps between continuous bins | Implies there are no values between the bars, which is false for continuous data | Make bars touch for continuous numerical data |
| Calling the tallest bar the mean | The modal bin and the arithmetic mean are different quantities | Calculate the mean from raw data or the frequency table |
| Assuming the histogram proves normality | A bell-shaped histogram is consistent with normality but does not confirm it | Use a formal normality test such as the Shapiro-Wilk test or QQ plot |
| Using different bins when comparing two datasets | Different boundaries make visual comparison invalid | Synchronize bin boundaries before putting histograms side by side |
| Automatically labeling a distant bar as an outlier | A small isolated bar might not meet any formal outlier criterion | Apply the IQR rule or box plot before deciding |
| Truncating the y-axis | Makes small differences look large; distorts visual comparison | Start the y-axis at zero for frequency histograms |
Practice Problems
Frequently Asked Questions
Summary
A histogram groups numerical observations into bins and draws a bar for each one. Bar height equals frequency. The x-axis is a numeric scale with bin boundaries, and bars touch for continuous data. That structure makes histograms distinct from bar graphs, which show categorical comparisons.
Reading a histogram means looking at center (where observations concentrate), spread (how wide the distribution is), and shape (symmetric, right-skewed, left-skewed, bimodal, or uniform). Bin width changes what you see, so trying a few values before drawing conclusions is good practice.
The Histogram Calculator above accepts any numerical data you paste in, applies automatic or manual binning, and shows the frequency table alongside the chart. For related tools, see the Descriptive Statistics section, the Mean, Median, and Standard Deviation guides, or the Descriptive Statistics Calculator for a full summary of any dataset.