Enter the total number of observations in the dataset into the calculator to determine the optimal number of bins using sturges’ rule.

## Sturges’ Rule Formula

The following formula is used to calculate the optimal number of bins in a histogram using sturges’ rule.

OB = [log2N + 1]

• Where OB is the optimal number of bins
• N is the total number of observation in the dataset

## What is Sturges’ Rule?

Sturges’ Rule is a simple formula that describes the optimal number of bins that one should use when making a histogram given a certain number of observations in a data set.

In this case, an observation is simply a unique data point. For example, if there is a data set with many numbers but the number 10 occurs twice, then that would only count as 1 observation.

## How to calculate the optimal number of bins to use in a histogram?

The following example outlines the steps and information required to calculate the optimal number of bins in a histogram.

First, gather all of the data and count the number of observations, for example, every unique point of data.

For this example, there are 2000 unique observations.

Next, simply plug the number of observations into the formula above to calculate the optimal number of bins.

OB = [log2N + 1]

OB = [log2 2000+ 1]

OB = 11.96

Usually, the number is rounded to the nearest integer in order to get the optimal number of bins, which in this case would be 12.