Published March 21st, 2013
The following is an explanation of how the MOD 10 algorithm works. This information is useful if you wish to validate a credit card number more thoroughly than just looking for what numbers a credit card starts with and/or it’s length. It is also useful if only to better understand how credit card numbers are created. First we will start with a bogus number generated using the algorithm.
Bogus Card Number = 378282246310005
Next we will flip the card number around.
Flip Card Number = 500013642282873
Now we need to double the value for every second digit. If during the multiplication you get a double digit number add the two numbers together so if you come up with say 14 the correct value for this would be 1+4 which makes the value 5. (14 = 1+4=5)
Double the value of every second digit = 0068445
Now replace the multiplied numbers within the flipped card number.
Number after replacing every other number = 500016682484853
Next add the first and second digits together.
Total of first and second digit = 5+0=5
Now add the next two together.
Sum of the next two digits = 0+0=0
Repeat this process until you reach the end of the string.
Sum up the rest of the numbers = 1+6=7, 6+8=14, 2+4=6, 4+8=12, 8+5=13, 3+nothing=3
Then add the resulting numbers together.
5+0+7+14+6+12+13+3 = 60
In order for the number to pass the remainder must be equal to 0.
60 MOD 10 = 0 (10 goes into 60 6 times with no remainder)
The result is that the number is "good".