is the best way to manage your money. Go there now »

Sign up or log in to mint.com

Cracking The Credit Card Code

Share This

There’s hardly a more prominent financial product in America today than the almighty credit card. Nearly everybody has at least one — almost 80% of consumers in 2008, according to the Federal Reserve Bank of Boston — and many use it on a daily basis. Without a doubt, there are also those consumers who know their credit card numbers by heart (makes online shopping and booking travel so much easier, if anything). But how many of you know what those numbers really mean? Contrary to what you may think, they aren’t random. Those 16 digits are there for a reason and, knowing a few simple rules, you could actually learn a lot about a credit card just from its number. This infographic shows you how to crack that code.

Want to do some more code cracking? Check out Decoding Your Car’s VIN Number.

For more personal finance visualizations see byJess.net.

Embed the above image on your site

Related Videos

58 Comments so far

leave a comment
  1. The old credit card !!!!

    Here is a tip to keep that balance low, I call it the Santa Clause cure.

    When you hit the bars or clubs. Leave them at home. simple
    Credit cards and bars are like Superman and Kryptonite.

    So when you become that drunken santa clause, you are using real money and will learn your lesson!

    -Matt

  2. So Amex falls under Travel and Entertainment?

    • Same as JCB. Curious.

    • American Express was originally a travel based agency, hence their travelers checks, etc. and their slogan “Don’t leave home without it.”

    • > So Amex falls under Travel and Entertainment?

      Not at all, in Europe (maybe just Germany) AMEX starts with a 4.

      LL&P
      David

  3. pgn674

    There are one billion possible combinations for the account number, not one trillion. Nine digits in the account number, so 10^9=1,000,000,000.

  4. Neel Johnson

    I tried both of my cards and none of them passed the test but they are valid cards. I have been using them since 2 years.

    They are debit cards actually. Rules are different for debit cards?

    • Jeffumm

      Did you remember, per the instructions above, to take double-digit numbers and add each number individually? For instance, if the first two numbers are “55″, then you double the first number and the result is “10″. But you don’t add “10″ to the second number (“5″) and get “15″. You add “1″ plus “0″ plus “5″ equals “6″. Then continue from there. I tried it and got a wrong result, then re-read the instructions carefully and noticed that I overlooked that part. When I did it correctly, it worked fine.

  5. Florian

    Doesn’t work for me. I tried with both a Visa and an Amex, and both returned sums not divisble by 10

  6. Am I the only one who notices the credit card number they used in the example doesn’t match the above picture?

    • Do you think someone would make up a picture of fake credit card with a valid number for a blog article? (Did you notice the name of the card is “Vista,” not “Visa”?)

  7. Checksums are used elsewhere too. European Bank account numbers use an IBAN that has an intricate mechanism for checksum on a National ID code + Bank routing code + Account number. http://en.wikipedia.org/wiki/International_Bank_Account_Number

    Nice infographics on the topic. Very easy to understand. thanks.

  8. Wouldn’t that be a billion combinations?

  9. I only see a billion different combinations with the account number. Not sure how you got a trillion?

  10. Tried with two valid credit cards. Neither are divisible by 10. Flawed system here.

    • it works. Tried 4 credit/debit cards all divisible by 10.
      2 amex, 1 visa debit, and 1 mc. it’s a strange algorithm, but it works.

  11. this is crazy! Thanks for these tips on detecting fraud!
    @Rob, worked for me…

  12. rudigher

    Can you people not read?

    It says right there “this leaves a trillion possible combinations if the the maximum of 12 digits is used”.

    Key words “IF THE MAXIMUM IS USED…IF!!”:
    10 to the power of 12 = 1 000 000 000 000 (one trillion)

    Also, the credit card number they used in the example DOES match the picture, look again.

  13. Brandon

    Hm, the formula should work. What’s your credit card number? I can go ahead and uh.. check that for you… ;-)

  14. Some cards use a variation – “Mod 10 plus 5″, so they accept as valid if the sum ends with 0 or 5.

  15. Justin

    Lots of people unable to validate their cards.

    1. Write down all your numbers.
    2. Starting from the right, double every other number. Don’t double the last number (the checksum) of the card, double the second to last.
    3. Add all the digits together, not the number the digits. 14 becomes 1+4

  16. Johnnnnn

    very interesting algorithm, it didn’t work the first time because I wasn’t splitting up the double digit numbers. Once i re-read the directions it worked perfectly! However, there is no way in hell I could ever do this in my head, which is the impression the infographic gives. “how to validate a credit card with your mind”….no thanks, I’ll use pen and paper.

  17. Awesome!! Good to know. Tried with one visa, it worked, am convinced.

  18. Alfonso

    I verified some credit card numbers.

    The python code to calculate the sum:
    % python
    >>> s = ’4417123456789113′
    >>> sum([t%10 + t/10 for t in [int(c)*2 for c in s[::2]]]) + sum([int(c) for c in s[1::2]])
    70

  19. Root Ginger

    The 7th digit onwards (not including checksum digit) is not necessarily the account number. Some UK banks, NatWest for example, use a random number here and that changes when your card expires. It is not related to your account number in any way. This is so no one who steals your card has your account details relating to it.

  20. Christian

    You can see if your number passed validation by using this page.
    http://ctthosting.com/cc/

    If you are scared entering your CC# on this page then you can download the source code from the site (there is a link) so you know its safe!

  21. AFAIK from working at a credit card servicer: First digit of 4 is always/only VISA, 5 is same for MasterCard & 6 for Discover. We had that hardcoded in many programs.

  22. The Dude

    Prominant?Does the NYT let you get away with that kind of spelling, Dave? :-)

  23. Um, I’ll let the credit card reader tell me if it’s fake: “DECLINED”!!

  24. I remember Luhn algorithm form school, it is very stylish way how to check credit cards. We used to pre-check validity of them when working part-time while we were studying. I once saved a lot of money for my boss. This post brought such funny memories.

  25. Chris Wagner

    Looking at the picture it says 1 trillion possible. But I only get 1 out of 10 being possible valid.
    I think we can agree that the first set of numbers would add up the same lo looking at the last 4 and adding them together only 1 is divisible by 10
    9103 = +1+8+1+0+3 = 68
    9113 = +1+8+1+2+3 = 70
    9123 = +1+8+1+4+3 = 72
    9133 = +1+8+1+6+3 = 74
    9143 = +1+8+1+8+3 = 76
    9153 = +1+8+1+1+0+3 = 69
    9163 = +1+8+1+1+2+3 = 71
    9173 = +1+8+1+1+4+3 = 73
    9183 = +1+8+1+1+6+3 = 75
    9193 = +1+8+1+1+8+3 = 77

  26. IM Bot for credit card code validator: cccv@bot.im (gtalk or jabber)
    USA SMS: (415) 766-8941 auto reply

  27. Dietmar

    Hi there… works fine for creditcards with 16 digits like Visa and Master, but how does it work for i.e. Amex with 15 digits only?
    As all 16 digits are used for the algorithm, I think it´s slightly different for cards with less than the 16 digits…

  28. I wrote a little BIN-number mashup called truecostofcredit.com a while back. It’s kind of fun.

  29. We primarily use credit cards in our business. This will come in handy when in doubt of a valid card

  30. Andika

    I don’t have a credit card, but it’s interesting to know how to validate it just by doing a math. Btw, is it okay if anyone else know our credit card number?

  31. Nice, but it isn’t complete, these numbers go further and involve the date and a number in the back of the card, if I’m not mistaken.

  32. vasanth bharathi

    i dont know these things thanks for opening my eyes……………most of the population in my country doesn’t know this………… i m going to teach them

  33. Steven Finch

    This is very cool. Im liking the explanation

  34. Chris Wagner, I understand your logic but its slightly off. As mentioned in the article the last digit is a checksum and not part of the account number. Therefore, if valid, it will change to whichever number is required to make the rest of the sum divisible by 10. So, it can work with any of the billion combinations. For example, 9113 works, but if it started with 910, it would not end in 3 but instead in 5, adding up to 70 still. Again, this doesn’t limit the number of accounts because the 5 is the checksum, not part of the account. Another example 912 would end in 1 (9121). The next combination would actually have to add up to 80: A beginning of 913 would have 9 at the end since everything before it would add to 71, so 71+9=80. And the pattern continues.

    I tried this on a couple of my cards and it worked for both.

  35. 1.000.000.000.000 is not a trillion in most countries, it’s a billion (a million millions: billion)

  36. eric shaun

    uhm i dont think 0 can be the first digit can it? so wouldn’t it be 999.999.999 possibilities?

  37. @ Andika: the number of the credit card is obiviously fake!

  38. its stupid and false mi number is not divisble by 10