A Luhn check test validates whether a number string passes the Luhn algorithm, also called the modulus 10 checksum. It catches single-digit errors and most adjacent digit swaps in card-like numbers, but it does not prove that a card is real, funded, or authorized for a payment.

How the Luhn algorithm works

The test uses a fixed set of arithmetic steps. No lookup table or issuer database is needed, which is why the Luhn check test is common in form validation and data entry tools.

  1. Write the full number, including the final check digit.
  2. Starting with the second digit from the right, double every second digit as you move left.
  3. If a doubled result is greater than 9, subtract 9 from it.
  4. Add the check digit and all modified digits together.
  5. The number passes when the total is a multiple of 10.

Worked example

Take the number 79927398713. The second, fourth, sixth, eighth, and tenth digits from the right are 1, 8, 3, 2, and 9. Doubling them gives 2, 16, 6, 4, and 18. After subtracting 9 from 16 and 18, the values become 7 and 9. The full sum is 3 + 2 + 7 + 7 + 9 + 6 + 7 + 4 + 9 + 9 + 7 = 70. Because 70 is a multiple of 10, the number passes.

What a Luhn check test can and cannot tell you

  • Can detect: single-digit typing mistakes and most cases where two adjacent digits are swapped.
  • Cannot detect: every transposition, such as swapping 09 with 90, and it cannot confirm the issuer, account status, expiration date, or security code.
  • Passing result: the number is mathematically consistent with the Luhn formula. It may still be unused, closed, or fabricated.
  • Failing result: the number is invalid for any identifier that is required to use the Luhn check digit.

Common mistakes when running the test

  • Starting the doubling from the leftmost digit instead of the second digit from the right.
  • Forgetting to subtract 9 when a doubled digit is 10 or higher.
  • Applying the test to identifiers that do not use a Luhn check digit.
  • Treating a pass as proof of a live payment account rather than a format check.

Where the test fits in a workflow

Use a Luhn check test as a first-pass filter for data entry, import cleanup, and quality assurance. In payment development, use published test numbers from your processor instead of generating numbers that merely pass the checksum. The Luhn algorithm is a format check, not an authorization step, so pair it with issuer validation and normal fraud controls before any transaction is attempted.