Credit card: How to validate it like a pro

credit card sample

Everybody have at least a credit card in their wallet. We know for sure that this card is useful. But how much do we know about these cards.

Here is a little trick about how the numbers are generated and how to validate a credit card.

Let’s get started.

Major Industry Identifier

The first digit is the Major Industry Identifier.It designates the category of the entity which issued the card.

1 and 2 are airlines

3 is Travel and entertainment.

4 and 5 are banking and financial

7 is petroleum

8 is telecomunications

9 is national assignment.

Issuer Identification Number(IIN)

The first 6 digits are Issuer Identification Number. It will identify the institution that issued the card.

Visa 4xxxxx

Mastercard 51xxxx – 55xxxx

Discover 6011xx, 644xxx and 65xxxx

Amex 34xxxx and 37xxxx

Cards can be looked up by their IIN. A card that starts with 37621 is a Singapore airlines krisflyer American express gold card. 529962 designates a prepaid Much music mastercard.

Person’s account number

The 7th and following digits , excluding the final digits are the person’s account number. This leaves a trillion possibilities if the maximum of 12 digits is used. Most cards use just 9 digits.


The final digit is the check digit or checksum. It is used to validate the credit card number using the Luhn algorithm.

How to validate a credit card.

Lets take the above credit number for example:

7 2 5 3   3 2 5 6    7 8 9 5   1 2 4 5

And double every other digit from the right

(7×2) 14 (5×2) 10 (3×2) 6 (5×2) 10 (7×2) 14  (9×2) 18 (1×2) 2 and finally (4×2) 8

Add these new digits to undoubled ones

2 3 2 6 8 5 2 5

All double digits are added as a sum of their digits for example 14 = 1 + 4


It gives a total of 124

A credit card number is valid only when the final sum is divisable by 10. In the case of our example, it is a fake credit card number or an  invalid one.

if you enjoyed it, please do not hesitate to share it with your friends.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s