How credit card numbers are formed

The first time I had to replace a credit card (stolen) I noticed that many of the digits were the same. My wife has a card from the same bank and she also shares most digits with me.

Obviously the first few digits are bank specific.

This page has a brief outline of the meaning behind the numbers.

The first digit is the type of card:

  • 3 = Amex or Diners Club
  • 4 = VISA
  • 5 = Mastercard

The rest of the digits depend on the type of card.

The format of VISA credit card numbers


  • T is for the type of card. In this case always 4 as this is a VISA card
  • B is a six digit code for the bank
  • A is a 9 digit account number
  • C is a check digiti calculated from all of the other digits