A Luhn check test passes when the digits of a number satisfy the Luhn mod-10 formula: double every second digit starting from the right, add the digits of each result, and the grand total must divide by 10 with no remainder. Any other total means at least one digit is wrong or two digits are swapped.

What the test checks

The Luhn algorithm is a checksum published by IBM engineer Hans Peter Luhn and standardized in ISO/IEC 7812-1 for identification card numbers. It catches single-digit typos and most adjacent transpositions. It does not confirm that an account exists, that a card is active, or that any issuer produced the number.

Card issuers, IMEI registries, and several national ID systems use the same arithmetic, so one procedure covers all of them. The method is public and deterministic: the same input always returns the same verdict.

Prerequisites

  • The number as plain text, with spaces, dashes, and prefixes removed
  • The digit count, so you can sanity-check the result against the expected length
  • A calculator, spreadsheet, or short script for long inputs

Run the test by hand

  1. Strip every character except the digits 0 through 9.
  2. Write the digits in order and label the rightmost digit as the check digit.
  3. Moving right to left, mark every second digit for doubling, starting with the digit left of the check digit.
  4. Double each marked digit. If a result is 10 or greater, subtract 9 from it.
  5. Add the unmarked digits and the reduced doubled digits into one total.
  6. Divide the total by 10. A remainder of 0 is a pass; any other remainder is a fail.

Worked example

Take the payload 7992739871 and append a check digit. Doubling alternate digits from the right gives 7, 18, 9, 4, 7, 6, 9, 16, 7, 2. Reduce the two-digit results to 7, 9, 9, 4, 7, 6, 9, 7, 7, 2. That sums to 67, so the check digit is 3 and the full number reads 79927398713.

Run the complete number a second time: 7 + 9 + 9 + 4 + 7 + 6 + 9 + 7 + 7 + 2 + 3 = 70. Seventy divides by 10 exactly, so the test passes.

Common reasons a correct-format number fails

  • A digit typed twice or skipped during entry
  • Two adjacent digits swapped, unless the pair is 0 and 9
  • Letters left in the string and read as numbers
  • A prefix or separator counted as a digit and shifting the doubling pattern

What a pass does not prove

A passing Luhn check only says the digits are internally consistent. About one in ten random digit strings passes by chance. Use the result as a format filter that runs before any real validation step, and never as evidence that a number is live, funded, or assigned to anyone.