Credit card number

What is a credit card ?
  • A credit card allows us to borrow money from a bank to make purchases as long as we pay back the money we borrow within the “grace period” of 25-30 days, we don’t have to pay extra. 
  • If we don’t pay it back in that time period, we’ll have to pay interest a percentage of the money we owe the bank on top of what we borrowed.

How credit card number generates ?


  1.  Major Industry Identifier (MII) : The first digit of the credit card number is the Major Industry Identifier (MII). It designates the category of the entry which issued the card.
  2. 1 and 2 – Airlines 
    3 – Travel
    4 and 5 – Banking and Financial
    6 – Merchandising and Banking/Financial
    7 – Petroleum
    8 – Healthcare, Telecommunications
    9 – National Assignment 
  3. Issuer Identification Number : The first 6 digits are the Issuer Identification Number. It will identify the institution that issued the card. Following are some of the major IIN's. 
    Amex – 34xxxx, 37xxxx 
    Visa – 4xxxxxx 
    MasterCard – 51xxxx – 55xxxx 
    Discover – 6011xx, 644xxx, 65xxxx 
  4. Account Number : Taking away the 6 identifier digits and the last digits, remaining digits are the person’s account number (7th and following excluding last digits).
  5. Check digits : Last digit is known as check digits or checksum. It is used to validate the credit card number using Luhn algorithm (Mod 10 algorithm).

How to validate credit card number ?

Luhn algorithm (Mod 10)  :  It was created by IBM scientist Hans Peter Luhn. Here are the Luhn steps which we can used to validate the credit card number ( 5 5 5 5 2 5 4 4 3 8 3 1 5 1 8 7 ).

Step 1 - Starting with the check digit double the value of every other digit (right to left every 2nd digit).


Step 2 - If doubling of a number results in a two digits number, add up the digits to get a single digit number. This will results in eight single digit numbers.


Step 3 - Now add the un-doubled digits to the odd places and add up all the digits in this number.
  

If the final sum is divisible by 10, then the credit card number is valid. If it is not divisible by 10, the number is invalid.