Luhn Checksum Calculator

Enter a number and pick validate or compute check digit.

How it is calculated

The tool has two modes. In validate mode the last digit is treated as the check digit. Going right to left, every second digit starting with the second from the right is doubled (if the double is above 9, subtract 9). All digits are then added:

valid if sum mod 10 = 0

In check digit mode you enter the number without its check digit; the rightmost digit you typed is doubled first, and the tool returns check = (10 − sum mod 10) mod 10, the single digit to append. Input must be digits only, so spaces and dashes give no result; remove them first. The sum is shown in both modes. A pass only shows the digits are internally consistent, not that the number is a real, active account.

Worked example

Validate 79927398713. Reading from the right, the digits are 3, 1, 7, 8, 9, 3, 7, 2, 9, 9, 7. Double every second one: 1 becomes 2, 8 becomes 16 and then 7, 3 becomes 6, 2 becomes 4, 9 becomes 18 and then 9. The digits now read 3, 2, 7, 7, 9, 6, 7, 4, 9, 9, 7, which add up to 70. That is a multiple of 10, so the result is Valid. Changing the last digit to 0 gives a sum of 67 and the result Invalid.

Try this example →

Common mistakes

  • Pasting a card number with spaces or hyphens; only digits are accepted, so strip the separators first.
  • Using check digit mode on a complete number. In that mode the last digit is also doubled, so a full number returns a meaningless digit; use validate mode instead.
  • Using validate mode on a number that has no check digit yet and expecting it to pass.
  • Assuming Valid means the card or IMEI exists; the test only catches typing errors such as a wrong digit, and many random numbers pass by chance.
  • Expecting every identifier to use Luhn; many national IDs and IBANs use different check schemes.

About this calculator

The Luhn algorithm (also called the mod 10 algorithm) is a simple checksum formula used to catch accidental errors — a mistyped digit or two transposed digits — in identification numbers. Starting from the rightmost digit and moving left, every second digit is doubled; if doubling produces a two-digit number, its digits are added together (or 9 is subtracted, which is equivalent); all digits are then summed, and the number is valid only if that total is a multiple of 10.

This is the exact check built into credit and debit card numbers (ISO/IEC 7812), IMEI numbers for mobile devices, Canadian Social Insurance Numbers, and U.S. National Provider Identifiers — this calculator either validates a number you enter against the Luhn check, or, given a number missing its final digit, computes the one check digit that makes it pass.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    A Luhn pass is worth most as a typo filter before you send a number somewhere. If a form rejects a number you copied, run it here in validate mode: a failure usually points to one mistyped or swapped digit, while a pass means the problem lies elsewhere, such as the wrong number or an inactive account. The check cannot tell a real number from a made-up one. Which kinds of identifiers do you check most often?

Popular calculators

All Calculators