How to use the benford’s law digit analyzer
- Paste the numbers separated by lines, spaces, tabs or semicolons. Dollar signs, signs and thousands commas are ignored.
- Choose to test the first digit or the first two digits.
- Read the mean absolute deviation and its conformity band first, then chi-square, its p-value and the table.
- Compare the observed share of each digit with the Benford share.
Formula
P(d) = log10(1 + 1/d) for the first digit d = 1 to 9 (or d = 10 to 99 for two digits)
expected count = n x P(d), chi-square = sum of (observed - expected)^2 / expected
MAD = average of |observed share - expected share|
Chi-square has 8 degrees of freedom for the first digit and 89 for two digits. The mean absolute deviation is compared with published conformity limits.
The first 100 Fibonacci numbers
The first digits of the first 100 Fibonacci numbers are counted as 30, 18, 13, 9, 8, 6, 5, 7 and 4 for the digits 1 to 9. Benford’s law expects 30.10, 17.61, 12.49, 9.69, 7.92, 6.69, 5.80, 5.12 and 4.58. Chi-square is 1.029 with a p-value of 0.9981, and the mean absolute deviation is 0.00636, which is in the acceptable band.
A list of the 900 consecutive integers from 100 to 999 has every first digit equally often, so it is flagged as nonconforming.
When Benford’s law applies
The law holds for data that grow across several orders of magnitude, such as invoice amounts, populations, river lengths or account balances. It does not apply to numbers assigned in a narrow range, such as ZIP codes, phone numbers or heights of adults.
A mismatch is a reason to look more closely, not proof of a problem. Rounded prices, price points and rules like approval limits all change the first digits for honest reasons.
Chi-square or MAD
Chi-square grows with the size of the list, so a very large list can fail it with differences that are tiny in practice. The mean absolute deviation does not depend on the size of the list in the same way, so the page shows both.
The conformity limits for the mean absolute deviation (0.006, 0.012 and 0.015 for the first digit; 0.0012, 0.0018 and 0.0022 for two digits) are the ones published by Mark Nigrini. They are rules of thumb. Short lists are noisy, so use at least a few hundred numbers for real work.
Assumptions and limits
- The first significant digit is read from the number itself, ignoring signs, decimal points and leading zeros.
- Zeros and entries that are not numbers are skipped, and the count of skipped entries is shown.
- At least 30 usable numbers are required.
- The p-value comes from the chi-square distribution with the degrees of freedom shown.
- Up to 50,000 numbers are read.
Frequently asked questions
What does a high p-value mean?
It means the digits are close to what Benford’s law predicts, so there is no evidence against it. It does not prove that the numbers are genuine or free of manipulation.
Why test two digits?
The first two digits give 90 groups, so a test can pick up patterns that the first digit hides, such as many amounts just under an approval limit. It needs a much larger list to be reliable.
Are negative numbers and decimals handled?
Yes. The sign is ignored and the first nonzero digit is used, so 0.0042 counts as a 4 and -1,234.50 counts as a 1.
Why are zeros skipped?
A zero has no first significant digit, so it cannot be counted. If many of your amounts are zero, consider whether the list is the right data to test.