# Benford’s Law Calculator

URL: https://speedycalculator.com/calculators/statistics/benfords-law/
Last updated: 2026-10-30

> The Benford's law calculator counts the leading digits of your numbers (or takes the digit counts you already have), compares them with the frequencies Benford's law predicts and runs a chi-square goodness-of-fit test and Nigrini's mean absolute deviation check.

## Inputs

- What do you have?
- Data set (numbers) — Paste numbers separated by commas, spaces or new lines. Zeros are skipped.
- Values starting with 1
- Values starting with 2
- Values starting with 3
- Values starting with 4
- Values starting with 5
- Values starting with 6
- Values starting with 7
- Values starting with 8
- Values starting with 9

## Results

- p-value of the chi-square test
- Conclusion
- Observed vs Benford frequencies
- First-digit table
- Chi-square statistic (df = 8)
- Mean absolute deviation (percentage points)
- Nigrini conformity (by MAD)
- Digit with the largest gap
- Share of values starting with 1
- Numbers counted
- Zeros skipped

## Formula

```
P(first digit = d) = log₁₀(1 + 1/d), d = 1 … 9 · χ² = Σ (Oᵢ − Eᵢ)² / Eᵢ with 8 degrees of freedom · MAD = Σ |observed share − expected share| / 9
```

## Explanation

Benford's law (also called the first-digit law or Newcomb–Benford law) says that in many real-world collections of numbers the leading digit is far more often small than large. About 30.1% of values start with 1, 17.6% with 2, and only 4.6% with 9 – not the 11.1% each you might expect. The pattern shows up in populations of towns, river lengths, stock prices, invoice amounts, physical constants and the Fibonacci numbers.

The reason is scale: data that spread over several orders of magnitude and grow multiplicatively spend more of their "logarithmic time" between 1 and 2 than between 9 and 10. The distribution is the only one that stays the same when you change units (dollars to euros, metres to feet).

Auditors and forensic accountants use the law as a quick screen. Made-up or manipulated numbers rarely follow it, so a large gap at a particular digit is a reason to look closer – not proof of fraud. Data with a narrow range (heights of adults), assigned numbers (phone numbers, ZIP codes) or prices set to psychological thresholds should not be expected to follow Benford.

### How to use the Benford's Law Calculator

- **What do you have?**
- **Data set (numbers)** — Paste numbers separated by commas, spaces or new lines. Zeros are skipped.
- **Values starting with 1**
- **Values starting with 2**
- **Values starting with 3**
- **Values starting with 4**
- **Values starting with 5**
- **Values starting with 6**
- **Values starting with 7**
- **Values starting with 8**
- **Values starting with 9**

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

### How it works

Each non-zero value is written in scientific notation and its first significant digit is counted (signs and decimal points are ignored). The observed share of each digit is compared with log₁₀(1 + 1/d), the chi-square statistic is turned into a p-value with 8 degrees of freedom, and the mean absolute deviation is graded against Nigrini's thresholds for first-digit tests.

### Worked example

An auditor counts the first digits of 500 invoice amounts: 152, 86, 64, 49, 39, 33, 29, 26 and 22 for digits 1 to 9. Benford's law expects 500 × 0.30103 = 150.5 ones, 88.0 twos, 62.5 threes and so on. Adding (O − E)²/E over the nine digits gives χ² = 0.16 with 8 degrees of freedom, a p-value above 99.9%. The mean absolute deviation is 0.18 percentage points – close conformity – so these invoices show no warning signs.

Switch to raw numbers and the first 30 Fibonacci numbers give 9 ones (30.0%, expected 30.1%) and 5 twos (16.7%, expected 17.6%), but with only 30 values the test has little power.

### Expected first-digit frequencies

DigitBenford shareExpected in 1,000 values130.10%301217.61%176312.49%12549.69%9757.92%7966.69%6775.80%5885.12%5194.58%46

## Worked example

Inputs — What do you have?: Counts of each leading digit; Values starting with 1: 152; Values starting with 2: 86; Values starting with 3: 64; Values starting with 4: 49; Values starting with 5: 39; Values starting with 6: 33; Values starting with 7: 29; Values starting with 8: 26; Values starting with 9: 22.

Results — **p-value of the chi-square test = 100 %**; Conclusion = No significant departure from Benford's law (p ≥ 0.05).; First-digit table = Digit Count Observed Benford Expected count Diff (pts)
────────────────────────────────────────────────────────────────
1 152 30.4% 30.1% 150.51 +0.3
2 86 17.2% 17.61% 88.05 −0.41
3 64 12.8% 12.49% 62.47 +0.31
4 49 9.8% 9.69% 48.46 +0.11
5 39 7.8% 7.92% 39.59 −0.12
6 33 6.6% 6.69% 33.47 −0.09
7 29 5.8% 5.8% 29 +0
8 26 5.2% 5.12% 25.58 +0.08
9 22 4.4% 4.58% 22.88 −0.18; Chi-square statistic (df = 8) = 0.162; Mean absolute deviation (percentage points) = 0.177; Nigrini conformity (by MAD) = 0.

## Key terms

- **Leading (first significant) digit**: The first non-zero digit of a number, e.g. 3 for 0.0372 and 1 for 1,948.
- **Goodness-of-fit test**: A test of whether observed counts match the counts a model predicts.
- **Mean absolute deviation (MAD)**: The average absolute difference between observed and expected digit shares.
- **Scale invariance**: The property that a distribution looks the same after multiplying every value by a constant.

## FAQ

**What does Benford's law predict for each digit?**
1: 30.1%, 2: 17.6%, 3: 12.5%, 4: 9.7%, 5: 7.9%, 6: 6.7%, 7: 5.8%, 8: 5.1%, 9: 4.6%. Each value is log₁₀(1 + 1/d).

**How many numbers do I need?**
At least 50, and preferably several hundred. With 30 values a single number moves a digit's share by 3.3 percentage points, so random noise dominates.

**Does a failed test prove fraud?**
No. It shows the digits are unusual. Many honest data sets – narrow ranges, rounded values, prices like 9.99 – fail too. Use it to choose what to audit.

**Which data follow Benford's law?**
Data spanning several orders of magnitude that arise from growth or multiplication: populations, sales, account balances, stock volumes, physical constants, Fibonacci and powers of 2.

**Which data do not?**
Human heights and test scores (narrow range), identification numbers, lottery numbers, values with a fixed minimum or maximum, and anything assigned rather than measured.

**What is the MAD test?**
Mark Nigrini's mean absolute deviation: the average gap between observed and expected shares. For first digits, below 0.6 points is close conformity, 0.6–1.2 acceptable, 1.2–1.5 marginal and above 1.5 nonconformity.

**Why is the chi-square test so strict with big data?**
With thousands of values even tiny, harmless departures become statistically significant, which is why auditors also look at the MAD.

**Do negative numbers and decimals count?**
Yes – the sign is ignored and the first significant digit is used, so −0.0453 counts as a 4.


## Sources

- [Wolfram MathWorld – Benford's law](https://mathworld.wolfram.com/BenfordsLaw.html)
- [NIST/SEMATECH e-Handbook of Statistical Methods](https://www.itl.nist.gov/div898/handbook/)
