Calculate the check-digit / Luhn Formula (Mod10)

Calculate the check-digit / Luhn Formula (Mod10)

You may not have known this but every major credit card company follows a standard for creating and distributing the physical pieces of plastic in your wallet.

For awhile now, some industries outside of Credit Card firms have adapted some of the same standards and use them in their royalty reward cards.

One of the pieces of the standard is the very last digit on your card. The last digit is sometimes considered to be the check-digit. The check-digit simply verifies that the digits before it mathematically calculate to the last digit. The arithmetic used to create and verify the check-digit is called the Luhn formula (or Mod10).

Here is how to calculate the check-digit:
Say you have a card number that reads: 4381 6487 2798 4004

The check-digit is supposedly 4. To verify, we take the digits before the check-digit and do the following mathematical steps.

1. See the numbers without the check-digit:
4 3 8 1 6 4 8 7 2 7 9 8 4 0 0

2. Write down every other number starting with the first digit.
4 8 6 8 2 9 4 0

3. Write down the other digits that were skipped from step 2.
3 1 4 7 7 8 0

4. Now multiply each digit from step 2 by two.
(4x2) (8x2) (6x2) (8x2) (2x2) (9x2) (4x2) (0x2)
8 16 12 16 4 18 8 0

5. Separate the values from step 4 so they are single digit values and add them together. (18 = 1+8)
8 + 1 + 6 + 1 + 2 + 1 + 6 + 4 + 1 + 8 + 8 + 0 = 46

6. Add the values of step 3 together.
3 + 1 + 4 + 7 + 7 + 8 + 0 = 30

7. Add the sum of steps 5 and 6 together.
46 + 30 = 76

8. Divide the sum of step 7 by ten.
76 / 10 = 7.6

9. Subtract the modulo (remainder) in step 8 from 10 and this should be the check digit.
10 - 6 = 4

Note the example number used is my old AAA Northwest Ohio membership number. 438 164 872798400 4

After learning this simple arithmetic it has given me insight of possibilities for companies. I believe this could open thoughts to a better User Experience via online and over the phone (IVR). At a business level, I think it is vital for employees to know and understand the above arithmetic. Understanding the use for the Luhn formula can bring awareness and improve security for all individuals.

If you found this post interesting, beneficial or informative I ask for you to Like, share or leave comments below.


Edits:
5/20 - Thanks Terry for the email and correction in my grammar.
6/16 - Missed Step 9, thanks Frank O. for the email and update!