How Credit Card Numbers Work?

How Credit Card Numbers Work

How credit card numbers work? It is interesting to see how quickly payment gateway web page can check whether given card number is valid. There is a pattern that every card number adheres to. Such patterns can be matched using JavaScript. A credit card number is made-up of four different components: MII (digit 1), IIN (digits 1-6), IAI (digits 7-15) and a check digit (last digit). Let’s see how credit card numbers work with the help of an example.

MII: In the above example, 6 is MII or Major Industry Identifier. This one digit identifier tells us which industry the card belongs to. Following table lists MIIs and industries they represent:

MII Industry
0 ISO/TC 68 and other industry assignments
1 Airlines
2 Airlines, financial and other future industry assignments
3 Travel and entertainment
4 Banking and financial
5 Banking and financial
6 Merchandising and banking/financial
7 Petroleum and other future industry assignments
8 Healthcare, telecommunications and other future industry assignments
9 For assignment by national standards bodies

IIN/BIN: Digits 1 to 6 make up IIN or Issuer Identification Number. This six digit number includes the first digit of MII. IIN tells you which bank has issued the card. It is sometimes also referred to as BIN (Bank Identifier Number). The website Binlists is an organized collection of BINs for credit cards as well as debit cards.

IAI: 7 to 15 digits represent Individual Account Identifier. This number is used to identify the customer account associated with the card.

Check Digit: The last digit is a check digit calculated by Luhn algorithm. In our example card number, check digit is 5. Let’s see how check digit is calculated.

Step 1: From right, multiply every even position digits by 2:

6069 9832 3412 3455

Digits in green color and included in [ ] denote original digits multiplied by 2:

[12]0[12]9[18]8[6]2[6]4[2]2[6]4[10] ?

Step 2: Now, convert all double digit numbers into single digit by summing up their digits (this is called digital root of a number, e.g. 18’s digital root is 9):

[3]0[3]9[9]8[6]2[6]4[2]2[6]4[1] ?

Next we total all digits:

3+0+3+9+9+8+6+2+6+4+2+2+6+4+1 = 75

Step 4: The difference between this total and it’s next multiple of 10 (which in this case is 80) is the check digit:

80 – 75 = 5

So we add the check digit 5 here to the original number:

6069 9832 3412 3455

Luhn test is at the heart of the question how credit card numbers work! Luhn test is the frontline defence against fraud. If you are a programmer, you may want to take a look at Rosettacode.org where this algorithm is implemented in 98 different programming languages.


References

  1. Patterns in Card Numbers
  2. Binlists.com
  3. Find Digital Root of a Number
  4. Rosettacode.org

Comments

avatar
  Subscribe  
Notify of