Skip to content

How is a Credit Card Number Selected? They’re Not Just Random

A credit card number is a 16-digit string of numbers, separated in 4 groups of 4 numbers each for ease of reading. In some cases, the number can be as long as 19 digits.


Have you ever wondered how that number is generated? Well, we’ve got the answer. The numbers are based on the American National Standards Institute ANSI numbering system.

Travel Freedom Credit Card


Purpose of the Credit Card Numbers

Credit Card numbers are more than just random digits. Parts of the number are identification markers for the kind of credit card that it is. The first six digits are used to identify the card issuer and the type of card it is. The first digit is called the major industry identifier or MII.


  • The numbers 1 and 2 are issued by airlines.
  • The number 3 is issued by the entertainment and travel industry. The MII for American Express card is 3.
  • The numbers 4 and 5 are reserved for banking and financial institutions. Visa Cards begin with the MII 4. Cards from MasterCard start with the MII 5.
  • Number 6 is issued by merchandising and banking industry. For example, cards issued by Discover start with the number 6.
  • The number 7 is reserved for petrol and oil companies.
  • Number 8 is issued by telecommunication companies.
  • Number 9 is reserved for national assignment.


The digits from 2 – 6 are reserved for the bank that is issuing the card, the currency information stored on the card or the kind of services that are available on it. Each card issuing authority may use the numbers in a different manner. For example, MasterCard uses the digits two and three or two through six to identify the bank number. On the other hand, American Express uses digits three and four to specify the currency on the card and services it provides.


The digits 8 – 15 on the card are used to identify the bank account holder’s information and links the card to the debit or credit account. When you enter the credit card number to an online vendor for purchase, these digits are used to forward the transaction to your bank and ask for verification.


The last digit on a credit card is called a checksum. It is a key that is used to identify whether a card is valid. The key is created by a formula known as the Luhn algorithm. The algorithm is used to create this last digit, based on the first 15 digits on the card.


The checksum is able to identify errors quickly as there is only a one in ten chance that a randomly generated card number has the correct last checksum. It can detect when a person enters incorrect card information.

best travel credit cards dog


Luhn Algorithm Calculation

The Luhn algorithm can be calculated by the ‘modulo arithmetic’ principle of digital roots. The algorithm uses modulo 10 mathematics.


This method takes every odd digit on a credit card number from the left and multiplies it by 2. The result of multiplication for all the numbers is added together to give a total. This total is called the ‘digital root’.


The next step is to add all the even numbers on the card. The sum of the even numbers is added to the digital root to give the final total. The last digit is calculated as the number that would be needed to make the total a multiple of 10.


For example, supposes that the first 15 digits on a Visa card are 4051 2867 9734 524. The sum of odd numbers multiplied by 2 would be:

  • 4 x 2 = 8
  • 5 x 2 = 10 i.e. 1+0
  • 2 x 2 = 4
  • 6 x 2 = 12 i.e. 1+2
  • 9 x 2 = 18 i.e. 1+8
  • 3 x 2 = 6
  • 5 x 2 = 10 i.e. 1+0
  • 4 x 2 = 8


Total would be 8 + 1 + 0 + 4 +1 + 2 +1 + 8+ 6 + 1 + 0 + 8 = 40.


Then, we add the total of all the even numbers 0 + 1 + 8 + 7 +7 + 4 + 2 = 29.


These two numbers would be added to give us a total of 40 + 29 = 69.


In order to make the number a multiple of 10 i.e. 70, we would need to add the digit 1. Thus the last checksum for the hypothetical number above would make I 4051 2867 9734 5241.


While it is possible to calculate this checksum and hackers can get around the check, it does add a little complexity and security to the number to protect it from poorly educated criminals.
