Tech Dreams

Is your Credit Card Number valid?

Validating credit card numbers

The credit card numbers may look like some random unique 16 digits number but those digits inform more than what we think it could be. The first digit of the card is the Major Industry Identifier:

  • 1 and 2 -  Airlines
  • 3  – Travel and Entertainment
  • 4 and 5 -  Banking and Financial
  • 6 – Merchandizing and Banking
  • 7 – Petroleum
  • 8 – Telecommunications
  • 9 – National assignment

The first 6 digits represent the Issuer Identification Number:

  • Visa – 4xxxxx
  • Master Card – 51xxxx & 55xxxx

The 7th and following digits, excluding the last digit, are the person’s account number which leads to trillion possible combinations if the maximum of 12 digits is used. Many cards only use 9 digits.

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

How To Validate Credit Card Number?

Take any credit card number, for example 5588 3201 2345 6789.

Step 1: Double every other digit from the right:

5*2      8*2      3*2      0*2      2*2      4*2      6*2      8*2

————————————————————————-

10        16        6          0          4          8      12        16

Step 2: Add these new digits to undoubled digits. All double digit numbers are added as a sum of their digits, so 16 becomes 1+6 = 7:

Undoubled digits:       5          8          2          1          3          5          7          9

Doubled Digits:          10       16         6          0          4          8         12         16

Sum:  5+1+0+8+1+6+2+6+1+0+3+4+5+8+7+1+2+9+1+6 = 76

If the final sum is divisible by 10, then the Credit Card number is valid, if not, the number is invalid or fake!!! Hence the example is a fake number€ ;)

via mint  cc and image credit