Skip to content

How do credit card numbers work? What is the science behind it?

  • by
  • 3 min read
How do credit card numbers work? What is the science behind it?

Credit cards have become increasingly popular in the past few decades, but most of us do not know how the string of numbers that form our credit card numbers are created. Yes, there is science to everything, even your credit card. The 16-digit number isn’t a normal string, it tells many things about your credit card. In this article, you will come to know what’s hidden behind those mystery digits.

Major Identity Identifier (MII)

The first digit of your credit card number tells about the category of the industry which issued you the credit card. It could be ISO, Airlines, Banking And Finance VISA, Banking And Finance Mastercard, Telecommunications And Other Industries, National Assignment, among others.

Issuer Identification Number (IIN)

The first six digits of the credit card number are known as IIN. They describe the type of card. Here is a list of common card prefixes:

  • VISA: 4-
  • MasterCard: 51-, 52-, 53-, 54-, 55-
  • Diners Club: 36-, 38-
  • Discover: 6011-, 65-
  • JCB: 35-
  • American Express: 34-, 37-

Also read: 5 types of SIM cards explained

Account Number

After the six IIN digits, the 6th to 9th digits determine the unique bank account number. This is the account number corresponding to your credit account.

Also read: Credit card fraud: what you need to know

Check Digits

The credit card numbers are typed and quoted a large number of times. It is obvious that there can be errors while performing these operations as humans are involved in them. To check whether the credit card number entered is valid or not, there is a set of check digits.

Generally, in a 16-digit credit card, the first 15 digits are determined by the bank and the last digit is calculated mathematically by using some algorithm on the other digits.

The formula for calculating the last digit was given by Hans Peter Luhn, an engineer at IBM in 1954. It is very difficult to check the error in 15 digits by using a single check digit but the Luhn Algorithm is so clever that it does this task very efficiently and accurately.

Luhn Algorithm is as follows:

  • Take the first 15 digits of your credit card number. Let us suppose: 789015625896314.
  • Start with the first number from the left, take every second number (i.e., numbers 7, 9, 1, 6, 5, 9, 3, 4 in this case) and multiply it by 2.









  • If the multiplication gives a two-digit number, sum up the two digits so that you get a single-digit number. Hence, the numbers are:









  • Sum up these digits and add them to the sum of all the digits left in the card number.

5+9+2+3+1+9+6+8           +            8+0+5+2+8+6+1           =             73

  • Find a single-digit number which when added to this sum, will give a number divisible by 10. In this case, it is 7.
  • This number will be the 16th digit.

Wasn’t it amazing to learn so many things about Credit Cards? Do let us know your thoughts on this in the comments section.

Also Read: What is Formjacking, how it works and protective measures

Featured Image by Rupixen

Himanshu Nimje

Himanshu Nimje