How Credit Card Numbers Are Generated

Credit Card Generator

How do they come up with credit card numbers?

If you’re looking for a credit card generator you’ve come to the wrong place.

While you can’t actually generate a credit card number which will be valid and accepted for a payment, you can find out more about how our current credit card numbers are validated and test the theory on the cards in your wallet.

Your credit card numbers may seem to be made up of a series of random numbers and whether you know those numbers off by heart or not, in the US they are verified according to a simple mathematical system you can learn, and use as a great party trick too.

The Luhn Algorithm

In 1954 – before the world was immersed in credit card debt – Hans Peter Luhn patented an algorithm which is now known as the Luhn Algorithm. Every credit card and debit card number in the United States follows Luhn’s Algorithm so that every US credit card provider can be sure there are no errors when they create and distribute their cards. You can use the Luhn Algorithm to verify any credit card you have in your purse right now, and here is an example credit card number to show you how it works:

5412 7534 5678 9123

Firstly, the check digit is isolated on the card and that is the last number in the sequence – in this case it is the three. Then start with the number to the left of the check digit and double that number, and every second number on the card, this is what you end up with:

(10)4(2)2 (14)5(6)4 (10)6(14)8 (18)1(4)3

Then add together the digits of any double digit number to create a single digit number and this is the result:

1422 5564 1658 9143

Now when these numbers are added up they equal 66, which means this example credit card number is not real as the result of a real credit card number would be evenly divisible by 10. Also, even though you are able to generate a credit card number which works out to be divisible by 10 according to Luhn’s theory, there are other security features which you are not able to duplicate such as the CVV2, CVC2 and the CID numbers which are those ones printed on the front or back of a credit card for additional authentication that the card is present in a transaction.

Generating Valid Credit Card Numbers

Having cracked the credit card number code, it is important to keep in mind that US banks and credit card providers don’t use the Luhn Algorithm to prevent fraud or identity theft, but for their own administrative needs. Therefore, to create a fake credit card with a valid number and valid security authentication is impossible. If you wanted to create a valid three digit CVV2 security code, you would need the primary account number, the four digit expiry date, a unique three digit service code and a set of DES keys. It is not just one piece of account information which is required to generate credit card security codes and this, coupled with the fact that there are almost endless numerical combinations, makes it impossible to create a fake credit card, and makes it impossible for someone to use your credit card number if they don’t have the additional security codes.

So while it is interesting to be able to validate your own credit card numbers, and actually quite mind-boggling to think that every single credit card being used in the US adheres to this mathematical system, that system doesn’t make it possible to generate a valid credit card number – only validate an existing credit card number. It also means you can feel more secure knowing just how hard and how impossible it is to conduct credit card fraud, and how unlikely it is someone can charge purchases to your credit card number, without your actual credit card.

Fred is a personal finance writer at Credit Card Finder. He helps people to compare credit cards online.

Share Button



Last Edited: May 7, 2013 @ 1:14 pm