Histogram Calculator
Generate histogram statistics from your data. Calculate bin edges, frequencies, relative frequencies, and view an ASCII histogram visualization. See also our Frequency Distribution Calculator, Mean Calculator, and Standard Deviation Calculator.
How to Use the Histogram Calculator
A histogram is a graphical representation of data distribution using bars whose heights represent frequencies. Unlike bar charts (for categorical data), histograms display continuous data grouped into bins. The shape of a histogram reveals important properties: symmetry, skewness, modality, and the presence of outliers.
Enter your numerical data as comma-separated values and choose the number of bins. The calculator computes bin edges, counts frequencies, and generates both a frequency table and an ASCII visualization. It also calculates summary statistics (mean, median, standard deviation) to complement the visual representation.
The ASCII histogram provides a quick visual representation directly in the results. Each bar's length is proportional to the frequency of that bin. This helps you immediately see the distribution shape without needing a separate graphing tool. Compare the mean and median — if they differ substantially, the distribution is likely skewed.
Formula
Bin Width:
Width = ⌈(Max - Min) / number_of_bins⌉
Bin Edges:
Edge_i = Min + i × Width (for i = 0, 1, ..., k)
Frequency Density:
Density = Frequency / (n × bin_width)
Relative Frequency:
Rel_Freq = Frequency / n
Sturges' Rule for bins:
k = ⌈1 + log₂(n)⌉ = ⌈1 + 3.322 × log₁₀(n)⌉
Example Calculation
Data: 23, 25, 28, 30, 32, 35, 38, 40, 42, 45, 50, 55, 60, 62, 65
n=15, Min=23, Max=65, Range=42, Bins=5, Width=⌈42/5⌉=9
Bin 23-32: ████████ (4)
Bin 32-41: ██████████ (4)
Bin 41-50: ██████ (3)
Bin 50-59: ████ (2)
Bin 59-68: ████ (2)
Mean = 42.0, Median = 40, Std Dev = 13.4
Shape: Slightly right-skewed (mean > median)
Reference Table
| Shape | Skewness | Example | Description |
|---|---|---|---|
| Symmetric (Normal) | ≈ 0 | Heights, IQ scores | Bell-shaped, mean ≈ median |
| Right-Skewed | > 0 | Income, house prices | Tail extends right, mean > median |
| Left-Skewed | < 0 | Age at retirement, exam scores | Tail extends left, mean < median |
| Uniform | ≈ 0 | Die rolls, random numbers | All bins roughly equal height |
| Bimodal | Varies | Mixed populations | Two distinct peaks |
| J-Shaped | High | Word frequency, city sizes | Exponential decay pattern |
| U-Shaped | ≈ 0 | Beta(0.5,0.5) distribution | High at extremes, low in middle |
Frequently Asked Questions
What is a histogram?
A histogram is a graphical display of continuous data using adjacent rectangular bars. Each bar represents a bin (class interval), and its height shows the frequency or relative frequency of observations in that range. Unlike bar charts, histogram bars touch each other because the data is continuous. Histograms reveal the distribution shape, central tendency, spread, and any unusual features like gaps or outliers in the data.
How is a histogram different from a bar chart?
Histograms display continuous numerical data grouped into bins, with bars touching to show continuity. Bar charts display categorical data with gaps between bars. In histograms, the x-axis has a numerical scale and bin width matters; in bar charts, the x-axis has category labels and bar width is arbitrary. Histograms show distribution shape; bar charts compare quantities across categories. You cannot reorder histogram bars, but bar chart bars can be rearranged.
What does the shape of a histogram tell me?
Symmetric (bell-shaped) suggests normal distribution — mean and median are similar. Right-skewed (tail to the right) indicates most values are low with some high outliers (e.g., income). Left-skewed (tail to the left) means most values are high with some low outliers. Bimodal (two peaks) suggests two distinct groups. Uniform (flat) means all values are equally likely. The shape guides which statistical methods are appropriate.
How many bins should I use?
Too few bins oversimplify (hiding patterns); too many create noise (random spikes). Start with Sturges' rule (k = 1 + log₂(n)) for normal-ish data, or √n for a quick estimate. For 100 observations, try 7-10 bins. For 1000 observations, try 10-15 bins. The best approach is to try several values and choose the one that reveals the data's structure most clearly without creating artifacts.
What is frequency density?
Frequency density = frequency / bin width. It is used when bins have unequal widths, ensuring the area of each bar (not just height) represents the proportion of data. For equal-width bins, frequency and frequency density give the same shape. For unequal-width bins, using raw frequency would be misleading — a wider bin naturally captures more observations. Density histograms have total area = 1, making them comparable to probability density functions.
Can I identify outliers from a histogram?
Yes, partially. Outliers appear as isolated bars separated from the main body of data by empty bins. However, histograms can mask individual outliers within bins. For precise outlier detection, use box plots (IQR method) or z-scores alongside histograms. A histogram is better for seeing the overall distribution shape, while box plots and statistical tests are better for identifying specific outlier values.