Bank Deal: Earn 1.00% APY on an FDIC-insured savings account at Barclays.
As a followup to my recent post about what your credit card number means, I wanted to throw out a bit more credit card trivia and talk about how you can tell if a credit card number is valid.
As you may or may not aware, most credit card numbers are generated based on something known as the Luhn algorithm. It thus stands to reason that a credit card number is valid if (and only if) it satisfies the “Luhn check” (a.k.a., the Mod 10 check), which is a simple mathematical test that involves manipulating the credit card number, adding it up, and checking to see if it’s evenly divisible by ten.
Testing credit card numbers
Here’s how to apply the Luhn check to test whether or not a credit card number is valid:
- Step 1a. For a card number with an even number of digits (e.g., Visa or MasterCard), double alternating digits starting with the first digit in the sequence.
- Step 1b. For a card with an odd number of digits (e.g., American Express), double alternating digits starting with the second digit in the sequence.
- Step 2. If the doubling resulted in a number with two digits, add them together to get a single digit number
- Step 3. Now go back to the original credit number and replace the digits that you doubled with the new value — either the doubled value, or the doubled value with the digits added together — and add it all up.
- Step 4. Check to see if the sum is evenly divisible by 10 (you can simply look to see whether or not it ends with a zero).
If the card number does not pass this check, then it is not a valid number. If, on the other hand, it does pass, then it may be a valid number with valid credit report.
Checking validity: an example
Those steps are a bit convoluted, so here’s a real world example… The following credit card image comes from the CitiCards homepage for their Platinum Select MasterCard. The number on the card is 5424 1801 2345 6789. For starters, the fact that the number starts with a “5” indicates that it’s a MasterCard (as does the little MasterCard symbol on the card).
Since there are sixteen digits, we’ll start by doubling the 1st, 3rd, etc. digits and then summing as outlined above. I’ve highlighted the doubled (and in some cases summed) values in parentheses, below. I’ve also underlined the check digit.
(1+0) + 4 + (4) + 4 + (2) + 8 + (0) + 1 + (4) + 3 + (8) + 5 + (1+2) + 7 + (1+6) + 9
This totals up to 70, which is evenly divisible by 10. In other words, this is a potentially valid credit card number, though I’m sure it doesn’t correspond to a real account number. If it does, then L. Walker (the name on the card) probably isn’t too happy about his/her credit card number being spread around like this.