Benford's Law Calculator
Expected Benford Distribution
| Digit | Probability | Percentage |
|---|
First Two Digits Lookup
Enter any two-digit prefix from 10 to 99 to see its individual expected probability under Benford's Law, using P(N) = log₁₀(1 + 1/N).
Run an analysis in the Analyze My Data tab first, then return here to see the full worked solution.
No data yet — paste a dataset and click Analyze Data in the Analyze My Data tab first.
What Is Benford's Law?
Benford's Law describes the expected distribution of leading digits in certain naturally occurring numerical datasets, where smaller leading digits occur far more often than larger ones. Instead of digits 1 through 9 each appearing about 11.1% of the time, as a uniform distribution would suggest, the digit 1 leads roughly 30.1% of numbers in a Benford-conforming dataset, while the digit 9 leads only about 4.6% of the time.
The pattern was first noticed by astronomer and mathematician Simon Newcomb in 1881, after he observed that the early pages of a book of logarithm tables were far more worn than the later pages, suggesting people looked up numbers beginning with 1 much more often than numbers beginning with 9. The physicist Frank Benford rediscovered and documented the same pattern in 1938 across more than 20,000 values drawn from rivers, populations, physical constants, and other unrelated sources, and the law now carries his name.
Benford's Law First-Digit Distribution
The table below is the permanent reference distribution used throughout this page and inside the calculator above. The nine probabilities sum to 1 (100%).
| Digit | Probability | 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% |
Benford's Law Formula
The first-digit Benford probability formula is P(D = d) = log₁₀(1 + 1/d), which can also be written as log₁₀((d+1)/d), for d = 1 through 9. Plugging in d = 1 gives log₁₀(2) ≈ 0.3010, or 30.10%. Plugging in d = 9 gives log₁₀(10/9) ≈ 0.0458, or 4.58%.
First-Digit Formula
P(D=d) = log₁₀(1 + 1/d)
Where:
D = first significant digit
d = 1, 2, 3, ... 9
Second-Digit Formula
P(D2=d) = Σ(k=1 to 9) log₁₀(1 + 1/(10k+d))
Where:
d = 0, 1, 2, ... 9
k ranges over the possible
leading digits
The second-digit formula sums over every possible leading digit that could come before the second digit, since a second digit of, say, 5 could belong to numbers starting 15, 25, 35, and so on through 95. The same logic extends to third digits and beyond, and to combinations such as the first two digits together, which the calculator's lookup tool above computes directly with P(N) = log₁₀(1 + 1/N) for any two-digit prefix N from 10 to 99.
Why Does 1 Appear More Often Than 9?
Digit 1 leads more often than digit 9 because Benford-conforming data behaves as if it were spread evenly across a logarithmic scale rather than a linear one. On a logarithmic scale, the distance from 1 to 2 is the same size as the distance from 5 to 10, or from 50 to 100.
Think of a number that grows steadily, such as a population or an account balance compounding over time. To go from a leading digit of 1 (say, 100) to a leading digit of 2 (200), the number has to grow by 100%. But to go from a leading digit of 9 (900) to the next order of magnitude (1,000), it only has to grow by about 11%. Numbers spend a much longer stretch of their growth with a leading 1 than with a leading 9, simply because doubling from 1 takes far more relative growth than inching up from 9 to 10. That asymmetry, repeated across every order of magnitude, is what produces the logarithmic first-digit distribution.
How to Calculate Benford's Law
Take the absolute value of each number and find its first nonzero digit, ignoring sign, decimal point, and any leading zeros.
Tally how many values begin with 1, how many with 2, and so on through 9.
Divide each digit's count by the total number of valid values in the dataset.
Apply P(D=d) = log₁₀(1 + 1/d) for each digit from 1 to 9.
Line the two sets of percentages up side by side and note the differences.
A chi-square goodness-of-fit test and mean absolute deviation (MAD) both put a number on how far apart the two distributions are.
Consider sample size and whether the data is the kind Benford's Law should even apply to before drawing any conclusion.
How the Calculator Handles Your Data
Benford's Law is based on the first significant digit, so leading zeros never change the result. A value like 0.00456 has a first significant digit of 4, and a value like 000123 (parsed as the number 123) has a first significant digit of 1. Scientific notation is handled the same way: 3.2 × 10⁶ has a first significant digit of 3, because the exponent only shifts the decimal point and does not change the digits themselves.
Negative values are analyzed using their absolute value, since Benford's Law concerns the digits of a number's magnitude rather than its sign; if your dataset should not include negative numbers at all, remove them before pasting. A value of exactly zero has no first significant digit and is excluded from the count, not treated as a tenth category. Rows that cannot be parsed as a number at all, such as stray text, are also excluded and reported separately so nothing is silently miscounted.
Observed vs. Expected Frequencies
Once the calculator has counted how often each digit appears in your dataset, it converts each count into a percentage and places it beside the corresponding expected Benford percentage. The difference column in the Analyze My Data tab shows, in percentage points, how far your data's digit 1 through digit 9 counts sit from the textbook values. A handful of digits sitting a point or two off expected is normal even in well-behaved data; it is the overall pattern, together with the statistics below, that matters more than any single cell.
Chi-Square Test for Benford's Law
A chi-square goodness-of-fit test compares your observed first-digit counts with the counts you would expect if the dataset followed Benford's Law exactly. The statistic is calculated as:
χ² = Σ (O − E)² / E
Where:
O = observed count for a digit
E = expected count for that digit
= n × p (sample size × Benford probability)
For the standard first-digit test there are 9 categories (digits 1 through 9), giving 8 degrees of freedom, since all nine expected probabilities are fixed by the formula rather than estimated from the sample. For a second-digit test there are 10 categories (digits 0 through 9), giving 9 degrees of freedom. A larger chi-square value indicates a wider gap between your data and the Benford distribution; a value near zero indicates a very close match.
What Does the Benford's Law p-value Mean?
A p-value assesses how compatible the observed digit distribution is with the specified Benford distribution, under the assumptions built into the chi-square test. For first-digit tests with 8 degrees of freedom, a chi-square value around 15.5 corresponds to a p-value near 0.05, and a chi-square value around 20.1 corresponds to a p-value near 0.01.
Mean Absolute Deviation for Benford's Law
Mean absolute deviation (MAD) is the average of the absolute differences between each digit's observed proportion and its expected Benford proportion:
MAD = Σ |Observed proportion − Expected proportion| / k
Where k = number of digit categories
(9 for first digit, 10 for second digit)
Unlike chi-square, MAD does not automatically grow as sample size increases, which makes it useful for comparing conformity across datasets of different sizes. Mark Nigrini, who popularized Benford's Law in forensic accounting, published a commonly cited set of first-digit MAD ranges. These are heuristic guidelines drawn from professional practice, not a formal statistical test with an associated p-value, so they should be read as a rough descriptive label rather than a pass-or-fail cutoff.
| MAD Range (First-Digit Test) | Heuristic Label |
|---|---|
| 0.000 – 0.006 | Close conformity |
| 0.006 – 0.012 | Acceptable conformity |
| 0.012 – 0.015 | Marginally acceptable conformity |
| Above 0.015 | Nonconformity |
Worked Benford's Law Example
Consider this small, deliberately artificial dataset with exactly one value assigned to each leading digit:
The first digits are 1, 1, 2, 3, 4, 5, 6, 7, 8, and 9, for n = 10 values. Digit 1 appears twice (from 12 and 18); every other digit from 2 through 9 appears exactly once.
| Digit | Observed Count | Observed % | Expected % | Difference |
|---|---|---|---|---|
| 1 | 2 | 20.00% | 30.10% | −10.10 |
| 2 | 1 | 10.00% | 17.61% | −7.61 |
| 3 | 1 | 10.00% | 12.49% | −2.49 |
| 4 | 1 | 10.00% | 9.69% | +0.31 |
| 5 | 1 | 10.00% | 7.92% | +2.08 |
| 6 | 1 | 10.00% | 6.69% | +3.31 |
| 7 | 1 | 10.00% | 5.80% | +4.20 |
| 8 | 1 | 10.00% | 5.12% | +4.88 |
| 9 | 1 | 10.00% | 4.58% | +5.42 |
Running these counts through the calculator gives χ² ≈ 2.35 (df = 8, p ≈ 0.968) and MAD ≈ 0.045. The high p-value and the small chi-square value might look reassuring at first glance, but this example is not evidence that the dataset follows Benford's Law. With only 10 observations, several expected counts fall well below 5, which violates a standard assumption of the chi-square approximation, and the MAD of 0.045 is well into the "nonconformity" range in the table above. A dataset this small cannot establish whether a process follows Benford's Law one way or the other; it is included here only to walk through the mechanics of the calculation.
What Types of Data Follow Benford's Law?
Benford's Law tends to apply more closely when a dataset has these characteristics:
- Values span multiple orders of magnitude rather than a narrow band.
- The numbers arise from a natural or multiplicative process, such as growth, compounding, or measurement, rather than being artificially constrained.
- The dataset is not dominated by assigned identifiers.
- There are enough observations for random noise to average out.
- Values are not heavily rounded or truncated in a way that clusters digits artificially.
Even so, not every naturally occurring dataset follows Benford's Law closely, and conformity should always be checked rather than assumed.
When Should You Not Use Benford's Law?
Benford's Law is a property of certain distributions, not a universal rule that applies to every collection of numbers. It is generally not appropriate for:
- Phone numbers, ZIP codes, and Social Security numbers
- Product IDs, account numbers, and other randomly assigned identifiers
- Data restricted to a narrow range, such as ages of registered voters or shoe sizes
- Artificially generated or fixed-price lists, such as items priced at $9.99, $19.99, and $29.99
- Data with a strong built-in minimum or maximum threshold
- Very small or highly selective samples
Can Benford's Law Detect Fraud?
Benford's Law can work as a screening or anomaly-detection technique, but it does not prove fraud. Mark Nigrini's 1999 article in the Journal of Accountancy introduced the idea of using digit-pattern analysis to flag general ledger entries and other accounting records worth a closer look, and the approach has since become a standard, if limited, part of some audit toolkits.
An unusual first-digit pattern can justify additional investigation, but on its own it is not evidence of wrongdoing. Deviations from Benford's Law can also come from entirely legitimate sources: business processes with round pricing, deliberate data selection, accounting rules that set minimum reporting thresholds, rounding conventions, the way a dataset was constructed, or simply a small sample size. Treating a failed Benford test as proof of fraud, without further review of the underlying records, is a misuse of the technique.
Benford's Law in Accounting, Auditing, and Tax Analysis
In accounting, Benford's Law is sometimes used to screen expense reports, invoice amounts, transaction values, and general ledger data for unusual digit patterns that might warrant closer review. For the analysis to be meaningful, the underlying figures need to be the kind of naturally varying data Benford's Law applies to; a report made up mostly of fixed fees or round-number allocations is unlikely to conform regardless of whether anything is wrong.
Auditors typically treat Benford analysis as one analytical procedure among many, not a standalone conclusion. A flagged pattern usually leads to a closer look at specific transactions, supported by contextual and substantive evidence, rather than an automatic finding. Tax authorities and researchers have explored similar digit-pattern screening on tax filings for the same reason: it can help direct limited investigative resources toward records that look statistically unusual, but it is a starting point for review rather than proof of underreporting or evasion.
First-Digit vs. Second-Digit Benford Analysis
Benford's Law extends beyond the first digit. The second-digit distribution is flatter than the first-digit distribution, ranging from about 12.0% for a second digit of 0 down to about 8.5% for a second digit of 9, rather than the steeper 30.1%-to-4.6% spread seen for first digits.
| Digit | Expected First-Digit % | Expected Second-Digit % |
|---|---|---|
| 0 | — (not valid as a first digit) | 11.97% |
| 1 | 30.10% | 11.39% |
| 2 | 17.61% | 10.88% |
| 3 | 12.49% | 10.43% |
| 4 | 9.69% | 10.03% |
| 5 | 7.92% | 9.67% |
| 6 | 6.69% | 9.34% |
| 7 | 5.80% | 9.04% |
| 8 | 5.12% | 8.76% |
| 9 | 4.58% | 8.50% |
Because the second-digit distribution is flatter, deviations tend to be smaller and require larger samples to detect reliably. The calculator's Expected Distribution and Analyze My Data tabs both support switching to the second digit using the same underlying data you have already entered.
Benford's Law for the First Two Digits
The first-two-digits test looks at combinations from 10 through 99 rather than single digits. The probability of any specific two-digit prefix N is:
P(N) = log₁₀(1 + 1/N), for N = 10, 11, 12, ... 99
For example, P(19) = log₁₀(1 + 1/19) ≈ 2.23%, and P(50) = log₁₀(1 + 1/50) ≈ 0.86%. Because there are 90 possible two-digit prefixes rather than 9 single digits, this test needs a considerably larger sample before the observed and expected percentages can be compared reliably, but it can reveal patterns, such as a spike at a specific two-digit combination, that a first-digit-only test would miss entirely. Use the First Two Digits Lookup tool in the Expected Distribution tab above to check any individual prefix.
Why Benford's Law Is Logarithmic and Scale-Invariant
Benford's Law can be derived by assuming that a dataset's values are roughly uniformly distributed on a logarithmic scale rather than a linear one. On a linear scale, the interval from 100 to 200 looks the same size as the interval from 900 to 1,000. On a logarithmic scale, the interval from 100 to 200 is much wider than the interval from 900 to 1,000, because log₁₀(200) − log₁₀(100) ≈ 0.301, while log₁₀(1000) − log₁₀(900) ≈ 0.046. That gap in log-scale width is exactly where the 30.1% and 4.6% first-digit probabilities come from.
This same logic explains why Benford-conforming data is scale-invariant: multiplying every value in a suitable dataset by a positive constant, say converting a currency or a unit of measurement, shifts every value's position on the logarithmic scale by the same fixed amount, which does not change the shape of the leading-digit distribution. A dataset of populations recorded in thousands and the same dataset recorded in individual people will show essentially the same first-digit pattern, which is part of why Benford's Law shows up across so many unrelated fields, from city sizes to scientific constants to hadron decay widths studied in particle physics.
Benford's Law vs. Uniform Distribution
| Feature | Benford Distribution | Uniform First Digit |
|---|---|---|
| Digit 1 | Most common (30.1%) | Same frequency as every other digit (11.1%) |
| Digit 9 | Least common (4.6%) | Same frequency as every other digit (11.1%) |
| Underlying shape | Logarithmic | Equal probability for each digit |
| Typical setting | Naturally varying data spanning multiple magnitudes | Values chosen or generated with equal likelihood, such as lottery draws or random integer generators |
Does Random Data Follow Benford's Law?
Not automatically. A common misconception is that "random" numbers should follow Benford's Law simply because they are unpredictable. In practice, a set of integers generated uniformly over a fixed range, such as random whole numbers between 1 and 100 from our Random Number Generator, generally does not match the Benford distribution, because a uniform distribution on a linear scale is a fundamentally different shape than a uniform distribution on a logarithmic scale. What determines whether a dataset conforms is the process that generated it, not whether individual values were chosen at random.
How Many Numbers Do You Need for Benford's Law?
There is no single, universally correct minimum sample size. Very small datasets, like the 10-value worked example above, can swing wildly between the observed and expected percentages purely by chance, and several expected category counts can fall below the level where the chi-square approximation is considered reliable (conventionally, an expected count of at least 5 per category). Larger samples generally give both chi-square and MAD more statistical stability, but a bigger sample of unsuitable data, such as assigned account numbers, will still fail to conform no matter how many values you add. Sample size and data suitability are separate questions, and both need to be considered before drawing a conclusion from any result.
How to Interpret Your Benford's Law Results
When reviewing the calculator's output, look at more than a single number:
- Sample size: how many valid observations were actually analyzed, and whether any expected counts fall below 5.
- Data suitability: whether the dataset is the kind of naturally varying, multi-magnitude data Benford's Law is meant to describe.
- Observed vs. expected differences: which specific digits deviate most, and by how much.
- Chi-square and p-value: an overall measure of statistical compatibility with Benford's Law.
- MAD: a sample-size-independent measure of average deviation, read against heuristic conformity ranges.
Avoid reducing any of this to a simple pass-or-fail label. Rather than "fraud detected" or "dataset is fraudulent," a responsible summary reads more like: "the observed distribution differs noticeably from Benford's expected distribution in digits 7 through 9, which warrants a closer look at those transactions," or "the data show relatively close agreement with the Benford distribution, though the sample may not be large enough to be conclusive." The calculator's built-in interpretation text follows this same cautious phrasing.
Related Topics and Calculators on Statistics Fundamentals
Sources and Further Reading
Sources referenced in this guide:
- Wikipedia. Benford's Law. en.wikipedia.org
- Nigrini, Mark J. (2022). "Using Benford's Law to Reveal Journal Entry Irregularities." Journal of Accountancy. journalofaccountancy.com
- Diekmann, A. (2011). "Benford's Law and Fraud Detection: Facts and Legends." Related discussion in: "Benford's Law and articles of scientific journals." National Center for Biotechnology Information. ncbi.nlm.nih.gov
- Shao, Lijing & Ma, Bo-Qiang. "First Digit Distribution of Hadron Full Width." Modern Physics Letters A, via arXiv. arxiv.org
Frequently Asked Questions
Benford's Law describes how often each digit shows up as the leading digit in many naturally occurring numerical datasets. Instead of each digit from 1 to 9 appearing about 11% of the time, the digit 1 tends to lead about 30% of the time, and the frequency drops as the digit gets larger, down to about 4.6% for the digit 9. The pattern was first noted by astronomer Simon Newcomb in 1881 and later documented in detail by physicist Frank Benford in 1938.
A Benford's Law calculator either computes the theoretical probability for each leading digit using P(D=d) = log₁₀(1+1/d), or it takes a dataset you provide, extracts the first or second significant digit of each value, tallies how often each digit occurs, and compares that observed distribution with the expected one. Most calculators, including this one, also report a goodness-of-fit statistic such as chi-square and a measure of average deviation such as MAD.
The first-digit formula is P(D = d) = log₁₀(1 + 1/d) for d = 1 through 9, which can also be written as log₁₀((d+1)/d). Second-digit and first-two-digit probabilities use related but different sums of logarithms, since they account for every possible combination that could precede the digit in question.
About 30.1% under an ideal Benford distribution. That is roughly six and a half times more often than the digit 9, which appears as the leading digit only about 4.6% of the time.
Because Benford-conforming data is roughly uniform on a logarithmic scale rather than a linear one. Going from a leading 1 to a leading 2 (say, 100 to 200) requires 100% growth, while going from a leading 9 to the next order of magnitude (900 to 1,000) requires only about 11% growth. Numbers spend proportionally longer with a leading 1 than with a leading 9 as they grow.
Extract the first significant digit of every value, count how many times each digit from 1 to 9 appears, convert the counts to percentages, and compare them with the expected Benford percentages. A chi-square goodness-of-fit test and the mean absolute deviation (MAD) both give a numeric sense of how far the observed distribution sits from the expected one. The Analyze My Data tab above automates all of these steps.
For first digits: 1 = 30.10%, 2 = 17.61%, 3 = 12.49%, 4 = 9.69%, 5 = 7.92%, 6 = 6.69%, 7 = 5.80%, 8 = 5.12%, 9 = 4.58%. These nine percentages sum to 100% and form the baseline that observed data is measured against.
It is a goodness-of-fit test that compares observed digit counts with the counts you would expect if the data followed Benford's Law exactly. The statistic is χ² = Σ(O − E)² / E, calculated across all nine first-digit categories, with 8 degrees of freedom. A larger chi-square value means a bigger gap between what was observed and what Benford's Law predicts.
The p-value describes how compatible the observed digit distribution is with the Benford distribution, given the assumptions of the chi-square test. A small p-value means the observed data would be unusual if it truly followed Benford's Law; it does not, by itself, mean the data was manipulated. A large p-value means the observed pattern is consistent with Benford's Law, but it does not prove the data is genuine or error-free.
MAD stands for mean absolute deviation. It is the average of the absolute differences between each digit's observed proportion and its expected Benford proportion, summed and divided by the number of digit categories. Unlike chi-square, MAD does not grow automatically with sample size, so some analysts use published heuristic ranges, not formal statistical thresholds, to describe how closely a dataset conforms.
It can flag numerical patterns worth a second look, which is why auditors sometimes use it as a screening tool. It cannot prove fraud on its own. Deviations from Benford's Law can also come from rounding, minimum or maximum thresholds, pricing conventions, data selection, or a small sample, so any unusual result needs further investigation rather than an automatic conclusion.
Data that spans several orders of magnitude and arises from a naturally varying or multiplicative process tends to fit best: town and city populations, many financial statement line items, scientific measurements, and river lengths are classic examples. The fit tends to weaken for data confined to a narrow range or generated by a process with a built-in minimum or maximum.
Numbers that function as identifiers rather than measurements, such as phone numbers, ZIP codes, Social Security numbers, or account numbers, are not expected to follow Benford's Law because they are assigned rather than generated by a natural or multiplicative process. Fixed price lists, data restricted to a narrow range, and very small samples are also poor candidates.
There is no single universal cutoff. Small datasets can show large, misleading swings between the observed and expected percentages simply due to chance, so a result from a few dozen values deserves much more caution than one from several thousand. More observations generally give the chi-square and MAD statistics more stability, but the data still has to be the kind of data Benford's Law applies to in the first place.
Not automatically. Numbers drawn uniformly from a fixed range, such as random integers between 1 and 100, generally produce a leading-digit distribution that looks quite different from Benford's Law, because a uniform distribution on a linear scale is not the same as a uniform distribution on a logarithmic scale. What matters is the process that generated the numbers, not randomness by itself.
Yes. The Expected Distribution tab lets you switch between the first-digit and second-digit probabilities, and includes a lookup for any two-digit prefix from 10 to 99. The Analyze My Data tab can run the same comparison, chi-square test, and MAD calculation using either the first or the second significant digit of your dataset.
Conclusion
Benford's Law describes a genuine, well-documented pattern in the leading digits of many naturally occurring datasets, with digit 1 leading roughly six and a half times more often than digit 9. The calculator on this page lets you check the theoretical distribution for first, second, or first-two digits, and lets you test your own data with a chi-square statistic, p-value, and MAD, all computed locally in your browser. Not every dataset should follow Benford's Law, and a deviation from it, however large, is never proof of fraud or error by itself. Use the result as a starting point for further review, keep sample size and data suitability in mind, and treat the interpretation guidance above as a floor for caution rather than a ceiling.