Benford's Law, Explained
After reading this you can test whether the leading digits of your data follow Benford's law, read the χ² result correctly, and know when the test tells you nothing at all.
What Benford's law says
Take a large pile of naturally occurring numbers: river lengths, invoice amounts, city populations, physical constants. Look only at the first digit of each value. You might expect each digit from 1 to 9 to show up about 11.1% of the time. It does not. The digit 1 leads about 30.1% of the time, while 9 leads only about 4.6% of the time.
This lopsided pattern is Benford's law. The expected share of first digit d is:
Here d runs from 1 to 9. Plug in d = 1 and you get \log_{10}(2) \approx 0.301. Plug in d = 9 and you get \log_{10}(10/9) \approx 0.0458. The digits between fall off smoothly.
The hook: because people who fabricate numbers tend to spread first digits evenly or cluster them around round figures, faked ledgers often break this pattern. That is why auditors and forensic accountants reach for it.
The expected distribution in full
Here are the nine target proportions. Memorize the first one (30.1%) and the shape of the rest follows.
| Digit | P(d) | Percent |
|---|---|---|
| 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% |
When the test applies, and when it does not
Benford's law is not a law of all numbers. It emerges when data spans several orders of magnitude and is not artificially bounded. A rough rule: if your values run from single digits up to the thousands or more, and no rule caps them, the law tends to hold.
It fails, and gives a misleading result, in these cases:
- Assigned numbers. Phone numbers, ZIP codes, invoice IDs. These are labels, not measurements.
- Tight ranges. Adult human heights in centimeters cluster near
150to190, so the first digit is almost always 1. That is normal, not fraud. - Numbers with a floor or ceiling. Prices capped at
$9.99, or values set by a minimum threshold. - Small samples. Twenty numbers cannot fill nine categories with stable proportions.
A failed Benford test is a flag, not a verdict. Real data sometimes deviates for innocent reasons, and fraud sometimes passes. Treat a poor fit as a reason to look closer, never as proof of wrongdoing.
The χ² test behind the checker
The calculator does not eyeball the bars. It runs a chi-squared goodness-of-fit test comparing observed counts against Benford's expected counts.
Here O_d is how many of your values actually start with digit d, and E_d = n \cdot P(d) is how many Benford predicts for a sample of size n. Each squared gap is scaled by the expected count, so a shortfall in a rare digit weighs more than the same shortfall in a common one.
The statistic has 8 degrees of freedom (nine categories minus one). At the 0.05 significance level the critical value is 15.51. If \chi^2 exceeds that, the fit is poor enough that you reject the hypothesis that the data follows Benford's law. Larger \chi^2 means worse agreement.
A worked example with the demo data
Twenty values from the demo button
The demo loads these 20 numbers: 1042, 233, 87, 1580, 3021, 456, 92, 1873, 129, 764, 118, 1345, 267, 98, 152, 1120, 340, 76, 1930, 210. Strip each to its leading digit and count.
- First digits: 1,2,8,1,3,4,9,1,1,7,1,1,2,9,1,1,3,7,1,2.
- Tally: digit 1 appears 9 times, 2 appears 3, 3 appears 2, 4 appears 1, 7 appears 2, 8 appears 1, 9 appears 2. Digits 5 and 6 appear 0 times.
- Expected counts for n = 20: multiply each P(d) by 20. Digit 1 expects
6.02, digit 2 expects3.52, digit 5 expects1.58, digit 6 expects1.34. - Sum the scaled squared gaps. The two empty categories alone contribute 1.58 + 1.34 = 2.92, and the digit-1 surplus adds (9 - 6.02)^2 / 6.02 \approx 1.47.
The total \chi^2 lands near 6.5, comfortably below 15.51. So this sample does not reject Benford. But note the real lesson: with only 20 values, digits 5 and 6 are empty by chance, and no test can distinguish that from a genuine gap. The result here is weak either way.
Reading and interpreting your result
Focus on three numbers the checker reports.
- χ² statistic
- The total mismatch. Compare it against
15.51for the 0.05 level. A value near 0 means near-perfect agreement. - p-value
- The probability of a mismatch this large or larger if the data truly followed Benford. A p-value below
0.05rejects conformity. - Sample size n
- The multiplier behind every expected count. Small n makes the test insensitive; large n makes it flag even tiny deviations.
Watch the interaction between p-value and size. With n = 10{,}000, a first-digit distribution that is off by just two percentage points can produce \chi^2 \gt 30 and a p-value below 0.001. The deviation may be real but trivial. Always inspect the bar chart alongside the p-value.
Common mistakes
Four errors account for most misuse of this test.
- Testing too few values. The footnote on the calculator says it plainly: aim for 100 or more values across several orders of magnitude. Below that, the χ² approximation itself becomes unreliable when expected counts drop under 5.
- Testing data that cannot obey the law. Running the test on sequential IDs or bounded ratings guarantees a "failure" that means nothing.
- Reading a low p-value as proof of fraud. It is evidence of deviation, not of intent. Confirm with the underlying records.
- Ignoring the second digit. Sophisticated manipulation can fix first digits while distorting later ones. Benford's law extends to second and pair-of-digit tests, which this checker does not cover.
Related tools
Benford's test is one lens on a dataset. Pair it with these when you investigate suspicious data:
- Start with the Descriptive Statistics Calculator to see the range and skew, which tells you whether Benford even applies.
- Use the Outlier Detector to isolate the extreme values that a fabricator might have inserted.
- Check the spread of categories with the Shannon Entropy & Diversity Calculator when you want to measure how evenly digits or codes are distributed.
- Locate specific thresholds in your data with the Percentile Calculator.
Frequently asked questions
How many numbers do I need for a reliable Benford test?
Use at least 100 values, and prefer several hundred. The χ² test assumes expected counts of roughly 5 or more per digit. With n = 100, digit 9 expects only 4.58 values, already near the limit. More data gives every category a solid expected count.
Does a good Benford fit prove the data is honest?
No. Conformity is consistent with honest data, but a determined manipulator can match first digits. A pass reduces suspicion; it does not clear the records.
Why does my clearly-real dataset fail the test?
Likely because it does not span enough orders of magnitude, or it has a natural bound. Exam scores out of 100, temperatures in a narrow band, or padded account numbers all deviate from Benford for structural reasons unrelated to fraud.
Can I test negative numbers or decimals?
Yes. The first significant digit is what matters, so -0.0042 and 4200 both count as digit 4. The checker looks at the leading nonzero digit regardless of sign or decimal point.
What p-value should flag a dataset?
A common threshold is 0.05, matching the χ² critical value of 15.51 at 8 degrees of freedom. Some auditors use 0.01 to reduce false alarms on large datasets where tiny deviations reach significance.