Aug 14
Credit Card Validation

In this blog I explain the numerous ways to identify and validate a credit card number (CCN). The main point in this posting is to articulate the complex nature of identifying sensitive data. The complexities of identifying these types of sensitive data manually are not practical thus the need to automate using tools such as "".

Validation of CCN

Below are techniques that can be used to perform cursory checks on CCN's and an explanation of each of the most common validation techniques.

Luhn Algorithm Check

The Luhn Algorithm is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers and numerous others such as:

  • IMEI numbers
  • US National Provider Identifier (NPI) numbers
  • Canadian Social Insurance Numbers
  • Israeli ID Numbers
  • South African ID Numbers
  • Greek Social Security Numbers (ΑΜΚΑ)
  • McDonald's survey codes
  • Taco Bell receipts
  • Tractor Supply Co. receipts

In addition most credit cards and government identification numbers use this algorithm as a simple method of distinguishing valid numbers from mistyped or otherwise incorrect numbers.

Major Industry Identifier

The first digit of a credit card number represents the category of entity which issued the card.

Issuer identification number

The first six digits of a card number identify the institution that issued the card to the card holder.

Personal Account Number

Digits 7 to final number minus 1 (the last is the checksum) indicate the individual account identifier.

How many digits in a Credit Card Number?

  • Visa and Visa Electron: 13 or 16
  • MasterCard: 16
  • Discover: 16
  • American Express: 15
  • Diner's Club: 14 (including enRoute, International, Blanche)
  • Maestro: 12 to 19 (multi-national Debit Card)
  • Laser: 16 to 19 (Ireland Debit Card)
  • Switch: 16, 18 or 19 (United Kingdom Debit Card)
  • Solo: 16, 18 or 19 (United Kingdom Debit Card)
  • JCB: 15 or 16 (Japan Credit Bureau)
  • China UnionPay: 16 (People's Republic of China)


There are no comments for this post.

 ‭(Hidden)‬ Blog Tools