Benford’s Law First-Digit Test Calculator (Expected Share & Z-Test per Digit)

Audit financial ledgers against Benford’s Law P(d) = log₁₀(1 + 1/d) (30.1% for digit 1 down to 4.6% for digit 9).

Benford Expected Probability for Digit 1 30.103 %
Expected Count Out of 1000 301.03 records
Observed Proportion (%) 26.5 %
Forensic Deviation Z-Statistic 2.484 Z-score
Inputs
Try:
digit d
Leading non-zero digit d (1 through 9).
records
Total number of financial/ledger records audited (N).
observed
Observed count of records starting with digit d.
Results & Graph
Benford Expected Probability for Digit 1
30.103 %
Expected Count Out of 1000
301.03 records
Observed Proportion (%)
26.5 %
Forensic Deviation Z-Statistic
2.484 Z-score

Benford Expected Probability for Digit 1

Graph 1 • How the inputs feed Benford’s Law First Digit
Benford’s Law First-Digit Probability log₁₀(1 + 1/d) & Forensic Z-Score Calculator • Custom Domain Schematic (Econometrics & Regression) μ / Critical Cutoff (leadingD, totalAud) Leading Digit1to9: 1 digit d • Total Audit Records N: 1.0k records BENFORD EXPECTED PROBABILI 30.103 % • Expected Count Out of : 301.03 records • Observed Proportion (%: 26.5 % Eq: P(d) = log₁₀(1 + 1 / d); Z = |
Graph 2 • Benford Expected Probability for Digit 1 as Leading Digit1to9 changes (40% to 160% of current)
0 % 26.49 % 52.98 % 12.04 0.400 18.06 0.600 24.08 0.800 30.10 1 36.12 1.20 42.14 1.40 48.16 1.60
Graph 3 • Leading Digit1to9 and Total Audit Records N together Compares Benford Expected Probability for Digit 1 when Total Audit Records N is shifted +25% (solid) vs. −25% (dashed).
0 % 21.52 % 43.05 % --- Total Audit Records N @ 75% 21.07 -30% 25.59 -15% 30.10 +0% 34.62 +15% 39.13 +30%
Summary: Digit 1 has a Benford expected frequency of 30.1% (301 of 1000 records); observing 265 (26.5%) gives a Z-score of 2.48.
Summary: Digit 1 has a Benford expected frequency of 30.1% (301 of 1000 records); observing 265 (26.5%) gives a Z-score of 2.48.
Interactive chart & math engine powered by CalculatorGraph

Formula: Benford’s Law First Digit Formula

P(d) = log₁₀(1 + 1 / d)
Z = |ObservedProp − P(d)| / P(d)(1 − P(d)) / N
P(d) = log₁₀(1 + 1 / d); Z = |ObservedProp − P(d)| / √[ P(d)(1 − P(d)) / N ]
  • leadingDigit1to9: Leading Digit1to9 (digit d)
  • totalAuditRecordsN: Total Audit Records N (records)
  • observedDigitCount: Observed Digit Count (observed)

Frequently Asked Questions

How does the Benford’s Law First-Digit Probability log₁₀(1 + 1/d) & Forensic Z-Score Calculator compute the solution?

It evaluates P(d) = log₁₀(1 + 1 / d); Z = |ObservedProp − P(d)| / √[ P(d)(1 − P(d)) / N ] directly in your browser and updates three custom SVG visualizations in real time.

Does a Z of 2.484 mean the default ledger has been manipulated?

No. It means the share of ones, 26.5% instead of about 30.1%, is unlikely to be pure chance if the ledger followed Benford's law exactly, with a two sided p-value near 0.013. Business reasons such as fixed fees or approval limits can produce the same result. Treat it as a pointer to transactions worth examining, not a finding.

Why does the calculator test only one digit at a time?

The engine takes a single digit, its observed count and the total, and returns that digit's expected share and Z. It does not store the other eight. To test the whole distribution, run each digit in turn and combine the nine (observed minus expected) squared over expected terms into a chi-square with eight degrees of freedom. Writing the nine rows into a small table as you go makes the final sum easy to check.

Is the Z here the same as a chi-square test?

For one digit against all others, yes. Squaring the Z gives the two cell chi-square with one degree of freedom. At the default, 2.484 squared is about 6.17, above the 3.84 critical value at 5%. The nine digit chi-square is a different test with eight degrees of freedom and must be built from all nine counts.

How many records do I need for a meaningful Benford test?

More than most small audits have. With a quarter as many records as the default, a 26.5% share of ones gives a Z of only 1.28. Detecting a gap of three or four percentage points reliably takes around a thousand records or more. With small files, only extreme distortions will show up as significant. A larger file also lets you look at the first two digits, which is a sharper test.

Should I include negative amounts and refunds?

Usually analyse them separately. Credits and refunds come from different processes than invoices and can follow their own digit pattern. Take the absolute value if you want them in the same test, but then mixing two populations may create or hide anomalies. Whatever you decide, keep N consistent with the records counted. Many auditors simply run the test on debits and credits as two files.

Why does the Z ignore whether the digit is over or under its expected share?

The formula uses the absolute gap, so the Z is always positive. You find the direction by comparing the observed proportion line with the headline expected percentage. In the default, 26.5% observed is below 30.103% expected, so ones are underrepresented. For digit 9 with 70 records, 7% is above 4.576%.

Why does the calculator refuse a digit of 0 or 10?

Only the whole digits 1 to 9 can lead a number, so the engine asks you to check the inputs for anything else, including fractions. A zero can never be a leading digit under Benford's law. The second digit test, which does include zero and has its own expected shares, is a different calculation that this page does not perform.

Does Benford's law apply to rounded amounts?

Rounding to whole currency units hardly affects the first digit for amounts above ten or so. Heavy rounding, such as to the nearest hundred, can distort the pattern for smaller amounts. A ledger full of round figures is itself worth investigating, but use a round number test for that rather than this one. Most spreadsheet software can count round amounts in seconds.

Can I use this to test my own data outside accounting?

Yes, as long as the data spans several orders of magnitude and comes from a growth or multiplicative process. Populations of towns, file sizes and physical constants often fit well. Assigned numbers, measurements in a narrow band, or values with hard limits will not follow Benford, and a large Z on them means nothing. Plot the nine observed shares against the expected curve before trusting any statistic.

Why does my Z jump when I add more records with the same share?

Because the standard error shrinks with the square root of N. Keeping 26.5% ones while making the default ledger ten times larger moves the Z from 2.484 to 7.85. The deviation itself has not grown at all. With very large files, judge the size of the gap in percentage points as well as the Z.

Where 30.103% for the digit 1 comes from

Benford's law says that in many naturally occurring sets of numbers, the first digit is far more often small than large. The probability that the leading digit is d is log10(1 + 1/d). For d = 1 that is log10(2), which is 0.30103, the 30.103% the calculator shows as its headline answer.

The full set of nine probabilities runs downhill: about 30.1% for 1, 17.6% for 2, 12.5% for 3, 9.7% for 4, 7.9% for 5, 6.7% for 6, 5.8% for 7, 5.1% for 8 and 4.6% for 9. They add up to exactly 100% because the logarithms telescope to log10(10).

The intuition is that numbers which grow by percentages spend longer with a leading 1 than with a leading 9. An account balance that grows 10% a year takes about seven years to double from one thousand to two thousand, but just over a year to climb from nine thousand to ten thousand. On a logarithmic scale, the stretch from 1 to 2 is wider than the stretch from 9 to 10, and Benford's law is what you get when numbers are spread evenly on that scale.

The calculator turns the probability into an expected count by multiplying by your number of records. With the default 1000 records it expects 301.03 to start with a 1. That is the yardstick your real count is measured against.

Reading the Z-statistic of 2.484 for 265 ones

The default ledger has 1000 records and 265 of them start with a 1, an observed proportion of 26.5% against the expected 30.103%. The gap is 3.6 percentage points. Whether that gap is large depends on how much random variation you would expect in a sample of 1000 records.

The engine answers that with a binomial standard error: the square root of p times (1 minus p) divided by N. For digit 1 and N of 1000 that is about 0.0145, or 1.45 percentage points. The gap of 3.6 points divided by 1.45 gives the Z-statistic of 2.484.

A Z of about 1.96 corresponds to a two sided 5% significance level, so 2.484 is beyond it. The two sided p-value is roughly 0.013. In plain terms, if the ledger truly followed Benford's law, a shortfall of ones this large or larger would turn up only about one time in 77.

Notice that the Z is an absolute value. The calculator does not tell you whether there are too many or too few records starting with that digit; you have to compare the observed proportion with the expected one yourself. Here 26.5% is below 30.1%, so ones are underrepresented. For contrast, the close to Benford preset observes 300 ones out of 1000 records, a 30% share, and returns a Z of just 0.07.

The single-digit chi-square equals Z squared

The page is built around one digit at a time, but the same numbers give you a chi-square statistic. Split the ledger into two cells: records starting with a 1, and records starting with anything else. The observed counts are 265 and everything else; the expected counts are 301.03 and everything else, which is 1000 minus 301.03 records.

Sum (observed minus expected) squared over expected across both cells and you get about 4.31 plus 1.86, which is 6.17. That is exactly 2.484 squared. For a two cell table, the chi-square test with one degree of freedom and the Z test without continuity correction are the same test written two ways.

The one degree of freedom critical value at 5% is 3.84, the square of 1.96, so 6.17 leads to the same conclusion: the shortfall of ones is statistically significant at that level.

A full Benford chi-square uses all nine digits at once and has eight degrees of freedom. To run it, enter your total N once, then step the digit field from 1 to 9 with each observed count, note the expected count each time, and add up (observed minus expected) squared over expected across the nine rows. The 5% critical value for eight degrees of freedom is about 15.51.

Why bigger ledgers flag smaller deviations

Sample size drives the Z much more than most people expect. I ran the same 26.5% share of ones on a ledger a quarter of the size, 66 ones out of a quarter as many records. The Z drops to 1.28, not significant. Keeping 26.5% but making the ledger ten times larger pushes the Z to 7.85.

The proportion is identical in all three runs. Only the standard error changes, shrinking with the square root of N. A tiny audit cannot detect anything except gross manipulation, and a very large data set will flag deviations far too small to matter.

Forensic accountants deal with this in practice by paying attention to the size of the deviation as well as its significance. A difference of 0.3 percentage points might give a large Z in a file of millions of transactions and still mean nothing worth investigating. Look at the observed and expected percentages side by side before you look at the Z.

The engine will not run with fewer than 10 records and asks you to check the inputs if you try. Even at a few dozen records, Benford testing has almost no power, so treat the minimum as a technical limit rather than a sensible sample size.

Data that should and should not follow Benford

Benford's law fits data that spans several orders of magnitude and arises from multiplying or compounding processes: invoice amounts, expense claims, populations, river lengths, stock prices over time. It does not fit data with a narrow range or with numbers that are assigned rather than measured.

Telephone numbers, invoice numbers, postcodes and employee IDs have nothing to do with Benford. Nor do prices that cluster at set points, or amounts with a fixed minimum or maximum. A file of expense claims capped by policy, for example, will have too many first digits just below the cap for perfectly innocent reasons.

Human heights or adult ages are also poor candidates, since nearly all values share the same one or two leading digits. Before running the test, check that the largest values in your data are at least a hundred times the smallest. If they are not, a mismatch says little about fraud.

Even where Benford should apply, a ledger with strong business reasons for certain amounts, such as a standard monthly fee, will show a spike at that amount's first digit. Part of the job is to explain spikes before treating them as suspicious.

Checking digit 9 and the middle digits

Fraud often shows up not in the ones but at the high end. People inventing numbers tend to spread first digits more evenly than nature does, so the higher digits get too many records. Someone keeping claims just below an approval limit can also inflate a particular digit.

Set the digit to 9 and the expected probability falls to 4.576%. On the default 1000 records that is about 46 records. I ran 46 observed and got a Z of 0.04, a perfect fit. Raising it to 70 observed records gives 7% and a Z of 3.67, a strong signal for such a rare digit.

Middle digits behave the same way. Digit 5 has an expected share of 7.918%, or 79.181 records out of the default 1000 records. Observing 79 gives a Z of only 0.02. The digit 5 preset observes 120 records, a 12% share, and the Z jumps to 4.78, a clear excess worth tracing back to the transactions behind it.

Because each digit is a separate test, running all nine raises the chance of at least one false alarm. At a 5% level per digit, nine digits give a noticeably higher family error. Either use the full eight degrees of freedom chi-square, or apply a correction such as Bonferroni across the nine Z values.

Entering the digit and counts correctly

The digit field takes a whole number from 1 to 9. A 0, a 10 or a fraction such as 1.5 brings up a request to check the inputs rather than a result. The heading on the result names the digit being tested, which is a quick check that you are looking at the row you meant.

The observed count must be the number of records starting with that digit, not a percentage. Entering 26.5 in the count field is refused, because the observed count must be a whole number. Convert any percentage back to a count first: 26.5% of 1000 records is 265 records.

The observed count cannot be larger than N, and the engine says so if you try. When that message appears, the usual cause is that the two count fields have been swapped, or that N was taken after filtering while the count was taken before.

Count only records whose leading digit is meaningful. Most analysts drop zero and negative values and often exclude very small amounts, such as anything under ten, because they have only one digit to look at. Whatever you exclude, take it out of N too, so the denominator matches the numerator.

The Z here has no continuity correction. Some forensic texts subtract 1/(2N) from the absolute gap before dividing. At the default that would lower the Z from 2.484 to about 2.45, which changes nothing here but can matter near the cut off.

What a significant result justifies in an audit

A large Z is a reason to look closer, not proof of fraud. It tells you the distribution of first digits is unusual for the data as a whole. The next step is to find out which transactions are causing it: sort by amount, look for repeated values, check who entered them and when.

Many perfectly honest ledgers fail a Benford test because of how the business works. Recurring fixed charges, rounding conventions and approval thresholds all leave digit patterns. Equally, a clever fraudster who knows about Benford can pass the first digit test easily.

Use the calculator as one screening tool among several, alongside duplicate checks, round number checks and tests on the first two digits. Document your N, the digit, the observed count and the Z so another reviewer can reproduce the figure.