EN
Back to the archive

The encyclopedia · Engineering & Operations · Technical decision · 1960

Luhn's mod-10 check digit catches a keyed number's typos and transpositions

IBM's Hans Peter Luhn, in 1960, appended a check digit computed by doubling alternately so it catches nearly any single error or transposition.

IBM

the move

Numbers keyed by hand — account, card, licence and identifier numbers — are prone to a single wrong digit or two swapped digits, and a transposition often passes a plain sum check.

Hans Peter Luhn's 1960 algorithm, patented while he was at IBM, adds a check digit that is a doubling-based sum. Doubling every second digit makes the check sensitive to position, so it catches all single-digit errors and nearly all adjacent transpositions.

A checker only recomputes the total and confirms it is divisible by ten; no database or extra data is needed.

why it works

  • Doubling every second digit makes the check position-sensitive, not just sum-sensitive.
  • It catches all single-digit errors and nearly all adjacent transpositions.
  • Verification is a single arithmetic step, so any device or person can do it.
  • The check digit is short, so it costs one character of the identifier.
the payoffAppend one digit that is a function of all the othersneat

what transfers

Make the record verify itself. Append a value computed from all the other digits, so a reader or machine can catch a mis-entry without any lookup or extra information.

what came after

The Luhn algorithm became the check for credit-card and many identifier numbers worldwide. Its low cost and simple math let a phone or a machine catch a bad number instantly, and the idea seeded the whole family of modulus checksums.

references

spotted an error? The archive wants to know.

same kind of clever