What is Sturges’ Rule? (Definition & Example)


A histogram is an indispensable graphical method in the field of statistics, designed to visually represent the underlying distribution of numerical data contained within a given dataset. By systematically grouping individual data points into contiguous, defined ranges—commonly referred to as bins—histograms effectively reveal fundamental characteristics such as shape, central tendency, skewness, and the presence of potential outliers. This powerful visualization technique transforms raw numerical information into an accessible graphical narrative.

However, the successful and accurate interpretation of any histogram is profoundly dependent upon a single, critical parameter: the number of bins chosen for the visualization. Selecting an inadequate or arbitrary bin count can severely distort the visual representation of the data’s true structure, leading analysts and researchers toward potentially misleading statistical conclusions and erroneous inferential judgments.

To avoid these pitfalls, statisticians must employ established mathematical methodologies that provide an optimal balance. One of the most long-standing and widely accepted techniques for objectively determining the appropriate number of visualization categories is known as Sturges’ Rule.

The Impact of Incorrect Bin Selection

The choice of bin count dictates whether a histogram effectively communicates the data’s inherent properties or merely generates noise. When an analyst opts to use too few bins, the resulting chart suffers from extreme generalization, a phenomenon known as undersmoothing. This consolidation of data points results in bars that are excessively broad, obscuring the true underlying shape and complexity of the data’s distribution. Crucial features, such as multimodality or subtle shifts in density that could signal important patterns, are completely hidden, rendering the visualization largely ineffective for detailed analysis.

Conversely, the utilization of too many bins introduces excessive granularity, leading to oversmoothing or over-fragmentation. In this scenario, the chart frequently displays statistical “noise” rather than the meaningful signal, often highlighting irregularities caused by random sampling variation instead of genuine trends. The resulting chart appears jagged, erratic, and highly variable, making it exceptionally difficult for viewers to discern genuine trends or the overall flow of the data distribution, thereby undermining the primary purpose of the visualization.

Defining Sturges’ Rule: The Mathematical Foundation

Sturges’ Rule provides a standardized, mathematical approach for determining the optimal number of bins (k) required to represent a given dataset of size n. Introduced by statistician Herbert A. Sturges in a seminal 1926 paper, this rule is built upon the fundamental assumption that the data being analyzed is approximately following a normal distribution. This assumption allows the formula to estimate the necessary bin count based solely on the sample size, providing a reliable starting point for data exploration.

The rule’s calculation hinges on the use of the logarithm base 2 of the sample size. This logarithmic relationship ensures that the required number of bins increases at a relatively slow and controlled rate as the sample size grows. This feature is particularly advantageous, as it prevents the histogram from becoming overly fragmented when dealing with moderately sized collections of data. While Sturges’ Rule is highly effective for data that is unimodal and symmetric, its simplicity and direct reliance on n make it a popular default choice in many statistical software packages.

The core mathematical relationship utilized by Sturges’ Rule to calculate the optimal bin count (k) is formally defined as follows:

Optimal Bins (k) = ⌈log2n + 1⌉

Deconstructing the Sturges’ Formula

Understanding the components of the formula is essential for appreciating how the rule operates to balance generalization and detail in a histogram. The calculation combines a logarithmic scaling factor with a simple additive constant, ensuring the bin count is always a practical integer for visualization purposes. The primary driver of the calculation is the sample size, demonstrating that larger samples inherently require more bins to accurately resolve the underlying distribution detail.

In this formula, the variable n represents the total number of observations, or data points, present within the analyzed dataset. This count serves as the sole input parameter, emphasizing the simplicity and efficiency of the rule. The logarithmic transformation, log2(n), determines how many powers of two are contained within the sample size, which roughly corresponds to the number of distinct levels needed to group the data effectively.

Crucially, the symbols ⌈ ⌉ denote the ceiling function. Since the number of bins must always be a whole, positive integer for visualization, the ceiling function is applied to the calculated result. This mathematical operator instructs the user or software to round the value up to the nearest whole integer, guaranteeing a practical and applicable bin count (k) derived from the continuous logarithmic calculation.

Illustrative Example: Applying the Rule in Practice

To fully grasp the practical application of Sturges’ Rule, consider a hypothetical scenario involving a small to medium-sized dataset containing exactly n = 31 total observations. Determining the appropriate visual structure for these values requires a direct substitution of the sample size into the established formula, thereby providing an objective measure for histogram construction.

The sample data provides context for the size of the population we are analyzing. While the specific numerical values themselves are secondary to the sample count (n=31) for the purpose of applying Sturges’ Rule, the array confirms the scope of the data structure:

By applying Sturges’ Rule to this sample size (n=31), we calculate the optimal number of bins required to construct a meaningful histogram for this distribution. The calculation proceeds sequentially: first, determine the logarithm base 2 of n, then add 1, and finally apply the ceiling function to ensure an integer result: Optimal Bins = ⌈log2(31) + 1⌉ = ⌈4.954 + 1⌉ = ⌈5.954⌉ = 6. According to this standardized calculation, the histogram used to visualize this specific distribution of values should utilize exactly 6 bins.

Using Sturges' rule to determine the number of bins to use in a histogram

The resulting visualization, constructed with the prescribed 6 bins, successfully captures the core underlying shape and distribution of the values. It provides enough separation to highlight the main features without introducing excessive fragmentation or unduly smoothing over subtle but important variations in the data density.

Alternative Approaches to Bin Determination

While Sturges’ Rule is highly valued for its simplicity and historical significance, particularly when data is anticipated to exhibit near-normal characteristics, it does have specific limitations. It often performs sub-optimally when applied to highly skewed datasets or to extremely large samples, where it tends to suggest too few bins, resulting in a loss of fine detail. Because of these constraints, statisticians frequently rely on alternative, more robust bin selection methods that offer greater precision across different data types.

Simpler alternatives often serve as efficient heuristics. The Square-root Rule is perhaps the most straightforward; it suggests that the number of bins should be the square root of the number of observations (n), rounded up. Similarly, the Rice Rule provides a slightly higher bin count than Sturges’ Rule, often giving the histogram a bit more detail. Although these methods are easy to compute and implement, they share the limitation of relying exclusively on the sample size (n), meaning they remain sensitive to issues of skewness and heavy tails.

For scenarios involving non-normal or highly skewed distributions, methods that incorporate measures of data spread are preferred. The Freedman-Diaconis’ Rule is considered a highly robust approach because it incorporates the Interquartile Range (IQR) into its calculation. Since the IQR is resistant to the influence of extreme outliers, this rule provides a bin width that is less sensitive to erratic data points than rules based purely on sample size or standard deviation, offering a superior visual representation for complex data structures.

  • The Square-root Rule:

    Number of bins (k) = ⌈√n

  • The Rice Rule:

    Number of bins (k) = ⌈2 * 3n

  • The Freedman-Diaconis’ Rule:

    Number of bins (k) = (Max – Min) / Bin Width, where Bin Width = (2*IQR) / 3n

Sturges’ Rule: Quick Reference and Automation

Given the logarithmic nature of Sturges’ Rule, the increase in the required number of bins (k) is quite slow relative to the growth of the total number of observations (n). This characteristic makes it practical to maintain a quick reference table for common sample sizes, enabling faster decision-making during the initial phases of data analysis without requiring repeated calculations.

The following image provides a useful reference chart, illustrating the optimal number of bins suggested by Sturges’ Rule across a range of typical sample sizes encountered in statistical work:

Sturges's rule for different sample sizes

For efficiency in routine data preparation, utilizing specialized tools, such as automated scripts or online calculators, can significantly streamline the visualization process. While a firm grasp of the underlying formula is foundational for statistical literacy, automating the application of Sturges’ Rule allows analysts to instantly determine the appropriate visualization parameters based on input data size, ensuring the prompt creation of meaningful and informative histograms.

Cite this article

Mohammed looti (2025). What is Sturges’ Rule? (Definition & Example). PSYCHOLOGICAL STATISTICS. Retrieved from https://statistics.arabpsychology.com/what-is-sturges-rule-definition-example/

Mohammed looti. "What is Sturges’ Rule? (Definition & Example)." PSYCHOLOGICAL STATISTICS, 6 Nov. 2025, https://statistics.arabpsychology.com/what-is-sturges-rule-definition-example/.

Mohammed looti. "What is Sturges’ Rule? (Definition & Example)." PSYCHOLOGICAL STATISTICS, 2025. https://statistics.arabpsychology.com/what-is-sturges-rule-definition-example/.

Mohammed looti (2025) 'What is Sturges’ Rule? (Definition & Example)', PSYCHOLOGICAL STATISTICS. Available at: https://statistics.arabpsychology.com/what-is-sturges-rule-definition-example/.

[1] Mohammed looti, "What is Sturges’ Rule? (Definition & Example)," PSYCHOLOGICAL STATISTICS, vol. X, no. Y, ص Z-Z, November, 2025.

Mohammed looti. What is Sturges’ Rule? (Definition & Example). PSYCHOLOGICAL STATISTICS. 2025;vol(issue):pages.

Download Post (.PDF)
Scroll to Top