princemil
14th August 2005, 13:45
You Do the Math
Credit card numbers are a string of numeric digits from 13 to 16 characters long. Validation ignores any spaces or dashes, so it's good to get in the habit of entering numbers without them -- it makes everyone's life easier. Here are the rules for how to see if a credit card number is valid.
Starting at the rightmost position, multiply each individual digit by 1 if its position (from the right) is odd, or by 2 if its position is even.
If the product of this multiplication is greater than 9, add the individual digits of the product together. For example, if the result was 16, you would add 1 + 6 = 7. (If the result was 17, you need to go back to second grade.)
Add the resulting single-digit numbers together. If the final sum is a multiple of 10 then the credit card number is valid. If not... guess again.
For example here's a seemingly random 15 digit number... 378765981401955
position
odd even odd even odd even odd even odd even odd even odd even odd
number
3 7 8 7 6 5 9 8 1 4 0 1 9 5 5
multiply
3 14 8 14 6 10 9 16 1 8 0 2 9 10 5
add
3 5 8 5 6 1 9 7 1 8 0 2 9 1 5
total
3+5= 8 16 21 27 28 37 44 45 53 53 55 64 65 70
Which means what? It might be a valid credit card number! Hmmm... now what was that hot chat 800 number again?
But Which Kind of Credit Card Number Is It?
Now hold on thar, Bubba!
Just because a random string of digits passes the check-digit validation, that's no guarantee that it's a good number. Each of the issuing authorities assigns credit cards in a designated sequence. Here are the general rules of thumb:
Mastercard numbers are 16 digits long and start with 51, 52, 53, 54, or 55.
Visa numbers are either 13 or 16 digits long and start with a 4.
American Express numbers are 15 digits long and start with 34 or 37.
Discover card numbers are 16 digits long and start with 6011.
Diners Club numbers are 14 digits long and start with 30, 36, or 38,
(and almost nobody takes them -- especially on the web).
Credit card numbers are a string of numeric digits from 13 to 16 characters long. Validation ignores any spaces or dashes, so it's good to get in the habit of entering numbers without them -- it makes everyone's life easier. Here are the rules for how to see if a credit card number is valid.
Starting at the rightmost position, multiply each individual digit by 1 if its position (from the right) is odd, or by 2 if its position is even.
If the product of this multiplication is greater than 9, add the individual digits of the product together. For example, if the result was 16, you would add 1 + 6 = 7. (If the result was 17, you need to go back to second grade.)
Add the resulting single-digit numbers together. If the final sum is a multiple of 10 then the credit card number is valid. If not... guess again.
For example here's a seemingly random 15 digit number... 378765981401955
position
odd even odd even odd even odd even odd even odd even odd even odd
number
3 7 8 7 6 5 9 8 1 4 0 1 9 5 5
multiply
3 14 8 14 6 10 9 16 1 8 0 2 9 10 5
add
3 5 8 5 6 1 9 7 1 8 0 2 9 1 5
total
3+5= 8 16 21 27 28 37 44 45 53 53 55 64 65 70
Which means what? It might be a valid credit card number! Hmmm... now what was that hot chat 800 number again?
But Which Kind of Credit Card Number Is It?
Now hold on thar, Bubba!
Just because a random string of digits passes the check-digit validation, that's no guarantee that it's a good number. Each of the issuing authorities assigns credit cards in a designated sequence. Here are the general rules of thumb:
Mastercard numbers are 16 digits long and start with 51, 52, 53, 54, or 55.
Visa numbers are either 13 or 16 digits long and start with a 4.
American Express numbers are 15 digits long and start with 34 or 37.
Discover card numbers are 16 digits long and start with 6011.
Diners Club numbers are 14 digits long and start with 30, 36, or 38,
(and almost nobody takes them -- especially on the web).