Benford's Law Calculator
Free Benford's law calculator. Find the expected frequency of any leading digit with P(d) = log10(1 + 1/d), or test your data for conformity with a chi-square goodness-of-fit test and MAD.
https://hexacalculator.com/calculators/mathematics/statistics/benfords-law-calculator
Mathematics
Statistics
Benford's Law Calculator
Free Benford's law calculator. Find the expected frequency of any leading digit with P(d) = log10(1 + 1/d), or test your data for conformity with a chi-square goodness-of-fit test and MAD.
Benford's Law Calculator
What to calculate
Probability mode: pick a leading digit and read how often Benford's law says it should appear. The same rule covers the first digit and the first two digits.
Digit and position
Show the expected count in a dataset
Multiply the probability by a dataset size to get how many values should lead with this digit.
%
- P(first digit is at most d)
- %
- P(first digit is at least d)
- %
Benford's law favours small leading digits. Digits 1, 2, and 3 together lead about 60 percent of values, while 9 leads fewer than 5 percent.
Charts
The Benford's Law calculator provides two functions: it shows the expected frequency with which each digit appears as the first digit of naturally occurring numbers and allows you to check whether an actual data set conforms to this pattern. Benford's Law is a surprising observation that in many real-life data sets, numbers whose first digit is 1 are much more common than numbers whose first digit is 9. Enter your numbers to check expected frequencies or switch to test mode to analyze your own data.
What is Benford's Law?
Benford's Law, also called the law of anomalous numbers or Newcomb-Benford law, states that in many data sets, leading digits are not evenly distributed. Instead, about 30 percent of numbers have a first digit of one. The larger the number, the less likely it is to be a leading digit, and only five percent of numbers have a first digit of nine.
The astronomer Simon Newcomb noticed this phenomenon in 1881 when he observed that the first pages of logarithm tables were more worn than later pages. The physicist Frank Benford rediscovered and publicized the phenomenon in 1938, examining data such as river areas, populations, physical constants, and house numbers. This pattern is most common with datasets spanning several orders of magnitude and without artificial upper limits.
The formula for Benford's Law is:
The probability that the first digit is "d" (where "d" ranges between 1 and 9) is:
The same formula can be applied to the first two digits as well. In this case, 'd' ranges from 10 to 99. Because logarithms initially rise quickly before slowing down, smaller numbers account for most of the probabilities. Here is the entire distribution of leading digits:
Leading digit d | P(d) | Percentage |
|---|---|---|
1 | 0.3010 | 30.10% |
2 | 0.1761 | 17.61% |
3 | 0.1249 | 12.49% |
4 | 0.0969 | 9.69% |
5 | 0.0792 | 7.92% |
6 | 0.0669 | 6.69% |
7 | 0.0580 | 5.80% |
8 | 0.0512 | 5.12% |
9 | 0.0458 | 4.58% |
The sum of the nine probabilities is 1. A practical simplification is the cumulative distribution. The probability that a leading digit is less than or equal to 'd' is log base 10 of d + 1. So, the sum from 1 through 3 is log base 10 of 4, which is about 60.2%.
Why is that?
The simplest explanation is scale invariance. If the law of leading digits holds regardless of the unit of measurement - whether dollars or euros, meters or feet - then it's Benford's Law. Numbers that increase proportionally to values such as population or price will spend more time with a leading digit of 1 than they do with a leading digit of 9. This difference is greater when going from 100 to 200 than when going from 900 to 1,000. When a data set spans several orders of magnitude, the distribution of leading digits will stabilize into a Benford distribution.
Here's an example.
Suppose we have a data set of 1,000 accounting records. According to Benford's law, about 301 of them will start with the digit 1, and about 46 will start with the digit 9. By contrast, if we were to count the number of records starting with the digit 1 (say, 150) and the number of records starting with the digit 9 (say, 130), then the distribution of leading digits would be too uniform, which this calculator will detect as an anomaly.
The second digit and subsequent digits:
Benford's law can also predict the second digit, but its accuracy is lower. The percentage of numbers with a second digit of 0 is about 12%, while the percentage of numbers with a second digit of 9 is about 8.5%. This distribution is more uniform than that for leading digits. In forensic analysis, tests are sometimes done on the first two digits. These are divided into 90 intervals ranging from 10 to 99, as they are more sensitive to small anomalies.
How to Test a Dataset with Benford's Law:
In test mode the observed frequencies of leading digits are compared to the expected values according to Benford's law in two ways. The chi-square goodness-of-fit statistic sums for each of the nine digits the difference between the observed and expected frequency, divided by the expected frequency.
Since there are nine categories of numbers, the degrees of freedom is 8. At a significance level of 5%, the critical value is 15.51. If the chi-square statistic exceeds this value, then the hypothesis that the data follow Benford's law will be rejected. This test requires an expected frequency of at least 5 for each digit and usually needs at least 100 observations.
The mean absolute deviation (MAD) calculates the average of the absolute differences between observed and expected proportions for the nine digits. Unlike the chi-square test, the MAD does not tend to increase with large samples which makes it a basis for forensic analysis. Mark Nigrini has given the following ranges for fitting the leading digit:
MAD range | Conformity |
|---|---|
0.000 to 0.006 | Close conformity |
0.006 to 0.012 | Acceptable conformity |
0.012 to 0.015 | Marginally acceptable |
Above 0.015 | Nonconformity |
Applications of Benford's Law
The most known application is forensic accounting. Fake invoices, expenses and tax data often show patterns in the leading digits that deviate from natural patterns. It has also been used to check the integrity of elections, quality control of macroeconomic data, detect scientific irregularities, and general anomaly detection. A Benford's test failure is only a first screening step indicating further investigation is needed to determine if fraud exists; it does not prove fraud automatically.
Cases where Benford's law doesn't apply
Benford's Law requires that the data be naturally occurring and cover a wide range of values. It cannot be applied to numbers which are constrained by fixed parameters or upper and lower bounds, such as phone numbers, postal codes or invoice numbers, nor to numbers which fall within a narrow range, such as adult human height in centimeters. Applying the law to such data will always produce false results. Only apply the law where digits can vary freely across multiple places.
Using the calculator tool
Select the mode at top. In Probability Mode select a leading digit or pair of digits, enter values and get the Benford probability, cumulative probability and expected count for a given data set size. In Test Mode enter the number of numbers starting with each digit 1 through 9. The calculator will return the Chi-Square statistic, MAD (Mean Absolute Deviation), an assessment of goodness-of-fit, and a graph comparing observed vs expected ratios according to Benford's Law.
This calculation tool is for educational and preliminary purposes only. Deviations from Benford's law are indicative of the need for further investigation, but do not constitute a definitive conclusion. For audit or legal matters, please consult with qualified professionals.
Frequently asked questions
- What is Benford's Law?
Benford's Law states that in many real-life data sets, the leading digits are not uniformly distributed. The digit 1 occurs about 30% of the time, and as the digits get larger, they become less likely to occur. The digit 9 occurs less than 5% of the time. This law applies most often to numbers with multiple digits, such as financial data, population counts, or physical quantities.
- How to calculate the probability of a number being Benford?
We use the formula P(d), which is a logarithm with base 10 and argument of 1 + 1 ÷ d. For leading digits this gives 30.10% (for number 1), 17.61% (for number 2) and then decreases sequentially down to 4.58% (for number 9). The same formula can be applied for the two preceding digits, with the range of d in this case from 10 to 99.
- How do you determine if your data follows Benford's law?
Count the number of numbers beginning with each of the digits from 1 to 9 and enter these counts in test mode. The calculator will compute a chi-square goodness-of-fit statistic with 8 degrees of freedom, as well as the average absolute deviation between observed and expected proportions, to assess the fit. If the chi-square value exceeds 15.51, this fit is rejected at the 5% significance level.
- How do you interpret MAD?
The average absolute deviation calculates the mean of the differences between the observed ratio of numbers and the expected ratio of numbers. For leading digits, Mark Nigrini's limits are as follows: values below 0.006 indicate a very good fit, values from 0.006 to 0.012 are acceptable, values from 0.012 to 0.015 are borderline and values above 0.015 indicate a poor fit. The use of MAD is suitable for large samples as the value does not increase with sample size like in a chi-square test.
- Can a mistake in the Benford test prove fraud?
No. A departure from Benford's law is only an indication of a possible anomaly and not proof of fraud. It indicates that the data should be examined more closely. There are also cases where legal data do not conform to this rule, such as phone numbers, postal codes or invoice numbers which are limited to a restricted range.
Related calculators






Disclaimer: This calculator is provided for general informational and educational purposes only. Our calculators are under active development, and results may be inaccurate, incomplete, or unsuitable for your situation. Always verify the figures independently and seek advice from a qualified professional before relying on them. We make no warranties and accept no liability for any loss or decision arising from use of this tool.
References
- Benford's law — Wikipedia
Statement, history, the first-digit and second-digit laws, scale invariance, and applications.
- Frank Benford, The law of anomalous numbers (1938)
The original paper documenting the leading-digit frequencies across many datasets.
- Chi-square goodness-of-fit test — NIST/SEMATECH e-Handbook of Statistical Methods
How the chi-square goodness-of-fit statistic, degrees of freedom, and critical values work.
- Benford's Law: Applications for Forensic Accounting, Auditing, and Fraud Detection — Mark J. Nigrini
The forensic reference for the mean-absolute-deviation conformity thresholds.