Saved

Press the star next to a tool's name to save it.

All my tools

Benford's Law Calculator

Use this Benford's law calculator to see the expected shares of leading digits, in any base, and to test whether your own list of numbers follows the law.

Restored your last values ·

Choose leading digits to see the expected shares of 1 to 9, second digits for the shares of 0 to 9, or test to paste a list of numbers and compare their first digits with the law. The test shows the chi-squared statistic with 8 degrees of freedom and the mean absolute deviation.

Everything is worked out in your browser. Nothing you type is sent anywhere.

–

–

Choose what to do, then press Calculate.

A Benford's law calculator shows how often each digit should appear first in many real-world sets of numbers, and tests whether your own list follows that pattern. In Benford's law, 1 leads about 30 percent of the time and 9 only about 5 percent.

How to use the Benford's law calculator

  1. Choose leading digit probabilities for the first-digit table. Enter a base other than 10 if you need one.
  2. Choose second digit probabilities for the table of the digits 0 to 9.
  3. Choose test my numbers, paste at least 10 numbers and press Calculate to compare their first digits with the law.

The first-digit law

The Wikipedia article on Benford's law gives the probability of leading digit d as P(d) = log10(d + 1) − log10(d) = log10(1 + 1/d), for d from 1 to 9.[1] The table it lists is 1: 30.1%, 2: 17.6%, 3: 12.5%, 4: 9.7%, 5: 7.9%, 6: 6.7%, 7: 5.8%, 8: 5.1% and 9: 4.6%.[1] The calculator gives the same values with more digits, for example 17.61% for digit 2 and 4.576% for digit 9. The nine values add to exactly 100 percent.

Other bases

The page states that the law generalizes to any integer base b of 2 or more, with P(d) = log base b of (1 + 1/d).[1] In base 2 the leading digit is always 1, so the probability is 100 percent. In base 3 the digit 1 leads about 63.09 percent of the time and 2 about 36.91 percent. The calculator accepts bases from 2 to 36 and writes the digits in that base.

A way to see why

The page explains that the law holds when the logarithm of the data is uniformly distributed.[1] If the logarithms of the numbers spread evenly, the numbers beginning with 1 occupy a wider stretch of the log scale than those beginning with 9, so 1 appears more often. It also says that when the distribution of first digits is scale-invariant, it is always given by Benford's law.[1] That is why changing the units, from dollars to euros, say, does not break the pattern.

When the law applies

The page says the law tends to apply most accurately to data that span several orders of magnitude, and that distributions within a single order of magnitude, such as IQ scores or adult heights, are unlikely to satisfy it very accurately, if at all.[1] It adds that multiplicative processes tend to fit while additive ones, such as normal distributions, do not.[1] Populations of cities, invoice amounts and river lengths are typical candidates, while house numbers or test scores from 0 to 100 are not.

The second digit

The probability of second digit d is the sum over the first digit k from 1 to 9 of log10(1 + 1/(10k + d)). The calculator gives 0: 11.97%, 1: 11.39%, 2: 10.88% and so on down to 9: 8.50%. These values are much closer to uniform than the first-digit shares. We checked in our tests that the ten values add to 100 percent, but the page text for this section reached us only as a summary, so treat this formula as our own working. The page does say that Mebane's second-digit test is a simple, though not foolproof, method of identifying irregularities in election results.[1]

Testing your own numbers

In test mode the calculator takes the first non-zero digit of each number, counts how often each digit from 1 to 9 appears, and compares the shares with the law. It reports a chi-squared statistic with 8 degrees of freedom, the nine categories minus one, and the mean absolute deviation of the shares. These two summaries are our own working; the page text we read gives no chi-squared cut-offs or a conformity threshold for the mean absolute deviation. A small chi-squared value means a good fit. With only a few hundred numbers, small departures are normal.

What a poor fit means

A poor fit does not prove fraud. It may mean the data do not span enough orders of magnitude, that amounts have a built-in minimum or cap, or that people chose the numbers, such as fixed prices. It can also be a data entry problem. Use the result to decide where to look, not as a verdict. The law is used in forensic auditing, and a list of numbers that departs strongly from it is one reason an auditor may look more closely. That use is general practice that we did not verify on the page.

A short worked check

Take a list of twenty invoice totals with leading digits spread as in the table: six start with 1, four with 2, two or three each with 3 and 4, and one or two each with the higher digits. The shares come close to 30 percent for digit 1 and fall steadily, so the chi-squared value is small. Now take twenty prices that all start with 9, such as 9.99, 99 and 949. Digit 9 holds 100 percent against an expected 4.6 percent, and the chi-squared value is very large. Real checks need many more numbers than twenty, but the idea is the same: the calculator measures how far the observed shares are from the expected ones.

Using the table in an audit or a study

Auditors sometimes compare the first digits of ledger amounts with the expected table, and researchers use the second-digit table for election counts. In both cases the sensible use is as a screening step. If the first digits of many amounts fit, nothing is flagged. If one digit is far too common, the entries starting with that digit are sorted out and examined. The calculator gives the expected shares so you can build that comparison in a spreadsheet as well.

Common mistakes

  • Testing data in a narrow range. Heights and exam marks are not expected to fit.
  • Including zeros. A zero has no leading digit, so the calculator skips it.
  • Using too few numbers. Samples of under 100 can look odd by chance.

What next

Use this often? Add Benford's La to your Home screen.

Frequently asked questions

What is a Benford's law calculator?

A tool that shows the expected share of each leading digit, 1 to 9, under Benford's law and can test a list of numbers against those shares.

What is the formula for Benford's law?

P(d) = log10(1 + 1/d) for the first digit d from 1 to 9. In another base b, use the logarithm to base b.

What percentage of numbers start with 1?

About 30.1 percent, then 17.6 percent for 2 and 12.5 percent for 3, falling to 4.6 percent for 9.

Which data follow Benford's law?

Data that span several orders of magnitude and arise from multiplicative processes, such as populations. Heights and IQ scores do not fit well.

Does a poor fit prove fraud?

No. It only shows that the first digits differ from the law. The data may not suit the law, or may have a minimum or maximum.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Math Tools