A histogram groups your numbers into ranges and shows you how many fall into each one
A histogram is a chart that takes a set of numbers — like test scores, website load times, or customer ages — and sorts them into buckets. Each bucket covers a range (say, 0–10, 10–20, 20–30), and the height of the bar above that bucket shows how many of your numbers landed there. The result is a picture of where your data clusters and how it spreads out.
The difference between a histogram and a bar chart matters: a bar chart compares separate categories (like "sales by region"), while a histogram shows the distribution of one continuous measurement. If you're trying to understand whether your data bunches up in one spot or spreads evenly, a histogram is what you need.
Key Takeaways
- A histogram divides your data into equal-width ranges called bins and counts how many values fall into each bin.
- The number of bins you choose changes what the histogram reveals — too few bins hide detail, too many create noise.
- You can build a histogram in Excel, Google Sheets, Python, or R, each with different steps but the same underlying logic.
- The shape of your histogram — whether it peaks in the middle, leans to one side, or has multiple peaks — tells you something real about your data.
Decide how many bins your histogram needs
The first choice is how many buckets to divide your data into. Too few bins (say, three) and you lose detail — you can't see the real shape. Too many bins (say, fifty, when you only have a hundred data points) and you get noise instead of a pattern.
A rough starting point: take the square root of how many numbers you have. If you have 100 data points, try 10 bins. If you have 400, try 20. You can adjust after you see the result. Some tools let you set the bin width instead of the count — if your data ranges from 0 to 100 and you want bins of width 10, you'll get 10 bins automatically.
The goal is to see the actual shape of your data without either flattening it or fracturing it into noise. If your first attempt looks wrong, change the bin count and rebuild.
Build a histogram in Excel
Excel doesn't have a one-click histogram tool in older versions, but newer versions (Excel 2016 and later on Windows, Excel 2015 and later on Mac) include a histogram chart type. Put your data in a single column, select it, go to the Insert tab, click Charts, and look for Histogram in the list. Excel will create one with a default bin count, which you can then adjust.
If your Excel version doesn't have a histogram chart type, you can build one manually using the FREQUENCY function. Put your bin boundaries in one column (0, 10, 20, 30, and so on), then use FREQUENCY to count how many of your data points fall below each boundary. Create a bar chart from those counts, and adjust the gap between bars to zero so they touch — that visual touch is what makes it a histogram instead of a regular bar chart.
The manual route takes a few more steps, but it gives you full control over bin width and appearance.
Build a histogram in Google Sheets
Google Sheets has a histogram chart option built in. Select your data, click Insert, then Chart. In the chart editor that opens, go to the Chart Type dropdown and scroll down to find Histogram. Google will automatically set a bin count, but you can change it in the Chart Editor panel on the right — look for the Bucket Size option and enter the width you want (or leave it blank to let Google choose).
Google Sheets histograms are quick to set up and adjust. If you want to change the bin width after the chart appears, click on the chart, open the Chart Editor, and modify the Bucket Size field. The chart updates instantly.
Build a histogram in Python
If your data lives in Python, the matplotlib library makes histograms straightforward. Here's the basic pattern: import matplotlib.pyplot as plt, then call plt.hist(your_data, bins=10) where 10 is the number of bins you want. Then plt.show() displays it.
A more complete example: if your data is in a list called scores, you would write:
import matplotlib.pyplot as plt scores = [45, 67, 78, 82, 55, 88, 92, 71, 65, 79] plt.hist(scores, bins=5) plt.xlabel('Score') plt.ylabel('Frequency') plt.title('Distribution of Test Scores') plt.show()
The bins parameter controls how many buckets you get. You can also set bins to a list of boundaries instead of a count — bins=[40, 50, 60, 70, 80, 90, 100] — if you want specific ranges. Python's flexibility makes it powerful for exploring different bin choices quickly.
Build a histogram in R
R's hist() function is one of the simplest ways to create a histogram. If your data is in a vector called scores, you simply type hist(scores) and R displays it with a default bin count. To control the bins, add the breaks parameter: hist(scores, breaks=10) for 10 bins, or hist(scores, breaks=seq(0, 100, by=5)) to set specific boundaries.
R also lets you customize colors, labels, and titles easily. hist(scores, breaks=10, main="Test Scores", xlab="Score", ylab="Frequency", col="steelblue") creates a labeled histogram with a blue color. R's defaults are sensible, so you often get a useful chart with almost no code.
Read what the shape of your histogram tells you
Once you have your histogram, the shape matters. A histogram that peaks in the middle and tapers evenly on both sides suggests your data follows a normal distribution — common in nature and in many measurements. A histogram that leans heavily to one side (skewed) tells you most of your values cluster at one end. Multiple peaks suggest you might have different groups mixed together.
A histogram that looks flat across all bins might mean your data is truly uniform, or it might mean your bin count is wrong. A histogram with one very tall bar and the rest tiny might mean you need fewer, wider bins to see the real pattern. The shape is a conversation starter: it prompts you to ask why your data looks the way it does.
Frequently Asked Questions
What's the difference between a histogram and a bar chart?
A bar chart compares separate categories — like sales in different regions. A histogram shows how one continuous measurement spreads across a range. Bars in a histogram touch each other; bars in a bar chart have gaps. Use a histogram when you're looking at the distribution of a single number, not when you're comparing different things.
How do I know if I chose the right number of bins?
If the histogram looks too smooth and flat, you probably have too few bins. If it looks jagged and noisy, you have too many. Start with the square root of your data count, look at the result, and adjust up or down. There's no single "right" answer — it depends on what pattern you're trying to see.
Can I change the bin width after I create the histogram?
Yes. In Excel, Google Sheets, Python, and R, you can rebuild the histogram with a different bin count or width in seconds. Experiment with a few different values to see which one reveals the clearest picture of your data.
What if my data has outliers that make the histogram hard to read?
You have a few options: adjust your bin width to make the range wider, exclude the outliers temporarily to see the main pattern, or create two histograms — one with all data and one without — to understand both the overall shape and the bulk of the distribution.
Do I need to sort my data before making a histogram?
No. The histogram tool does the sorting and binning for you. Just feed it your raw data in any order, and it counts how many values fall into each range.