Skip to main content

Test Credit Card Numbers:Significance of Last Four Digits of Credit Card.

Should you share Last Four Digits of Credit Card?

How safe is to give out Last Four Digits of Credit Card?

How safe is to give out Last Four Digits of Credit Card?

How to test credit card numbers for validity

In order to test credit card numbers for their validity we can use a simple check-sum formula namely “modulus 10" or "mod 10" algorithm, which is widely used to validate a variety of identification numbers including credit card numbers. Before I go to explain this validating system it is necessary to explain what actually each digit of 16 digit credit card number means.

The 16 digits imprinted on your credit card may look like a haphazard string of numbers that’s only one of its kinds in the world. But in actual those digits disclose a little more than what you think. All the different credit cards in circulation from the major card issuers have one common thing in them which is the meaning of the numbers on the card. Most of the cards of the major credit card companies have 16 digits on them and each of these numbers has a particular meaning. Retailers may sometimes ask their customers for the last four digits of credit card for typing in the digits on the customer receipts. Whether disclosure of the last four digits of your card has any security risk or not can be understood once you know what the numbers mean.

Structure of the numbers on a 16 digit credit card

Here are what the digits of the 16 digit credit card number stand for:

1st Digit (stands for Industry ID).

1&2- Airline cards; 3- Travel and Entertainment cards; 4&5-Banking and Financial cards; 6-Merchandising and Banking cards; 7- Petroleum cards; 8- Telecom cards; 9- Miscellaneous cards;

2nd to 6th Digit (stands for issuer ID)

Indicates the name of the bank that issued the cards;

7th to 15th Digit (stands for Account ID)

This unique nine digit number identifies your account number;

16th Digit (stands for card check digit)

The final digit of the 16 digit credit card number is the check digit, which is a security number used to detect keying or scanning errors when the series of digits of credit card are entered into a computer.

Significance of the Check Digit

The last of the 16 digits of the credit card number is called the check digit. This check digit is generated from adding the remaining 15 numbers and making some simple calculations on this sum to reduce it down to a number between 0 and 9, which becomes the last digit of the 16 digit credit card. This check digit is a security measure to detect counterfeit card numbers.

How to test credit card numbers for validity

All common credit cards use a check digit algorithm called ‘Modulo 10’ to increase reading or scanning reliability. This eliminates well over 99% of errors. In applications requiring very high data integrity, a check digit is recommended. There is a mathematical association between the numbers on the card and if the numbers are entered incorrectly the card validating system would show error for incorrect number entry.

“Modulus 10" or "mod 10" algorithm, is a simple check-sum formula used to validate a variety of identification numbers, such as credit card numbers and many government identification numbers by distinguishing valid numbers from mistyped or otherwise incorrect numbers. In this validating system, in order to test credit card numbers, every alternate number starting with the first number, is doubled. The doubled numbers are then added to all the other remaining digits of the card, considering all the numbers as individual digits, including the two digit numbers arrived from the doubling operation. The rightmost digit is the check digit and is included in this sum. If the summation of the numbers is a multiple of 10, then the 16 digit credit card number is considered valid otherwise it’s not a valid card.

The following illustration will help you to understand more about the validating system of your credit card:

Take any credit card number: 4417 1234 5678 9113

Scroll to Continue

Double every alternate digit starting from the first

Doubled results: 8 2 2 6 10 14 18 2

Add these new digits to the remaining numbers

Remaining numbers: 4 7 2 4 6 8 1 3

Sum: 8+4+2+7+2+2+6+4+1+0+6+1+4+8+1+8+1+2+3(check digit)

= 70 (Multiple of ‘10’)

The given credit card number is a valid one.

Sharing last four digits of credit.

Let us now come to a frequently sked question whether it is safe to give out the last four digits of credit card to anyone when asked for. Some retailers may like to have a look at your card for manual typing in the last four digits of your card. This is sometimes used by the retailers to verify that you are the right customer. These four digits also help to authenticate that the number programmed to the magnetic stripe on the back of the card that store magnetically encoded data is the same number as imprinted on the card. This is one way of checking fake or reprogrammed cards before allowing the goods to leave the store. However, it is not something for which you really should worry about because even if one knows the last four digits but has no other information about the credit card and the cardholder, he can't reconstruct the entire card number. It is a fact that by sharing the last four digits you are giving out the ‘Check Digit’ of the 16 digit credit card number, but this will not allow one to determine any other digits on your card. After all the check digit is only one number and for each such digit value there are an unspecified large number of possible credit card numbers.


Now that you know how to test credit card numbers using “modulus 10" algorithm, you can use the same formula for checking whether a given credit card number is valid or not. Further, from the discussion above it would be evident that it is practically impossible to guess the 16 digit credit card number in its entirety for any given customer, given only the last four digits. These 4 digits are almost useless to anyone trying to access your account provided that is all the information he has got. You are, therefore, not at all at risk of any identity theft by sharing the last four digits of your credit card with your retailers. Nevertheless, your credit card number is an important piece of personal information from the point of your privacy and to prevent fraud and hence needs to be kept secure. One way to do that is to make it sure that the card numbers are truncated and full credit card numbers are not printed on customer receipts.


Chris on May 11, 2016:

Is there cause for concern if they know the last 4 digits of your credit card number, your name, and what you purchased with the card and how much it costs?

radharenu (author) from India on June 20, 2014:

Hi Hackslap

Thanks for your comments.

Harry from Sydney, Australia on June 19, 2014:

Brilliant!! .. I work within the cards industry myself and am aware of some algorithms that are used when assigning a card# but didn't know it so much detail .. voted up mate! ..

radharenu (author) from India on June 13, 2014:

Hi Joe

Thanks for your comment.

Joe from north miami FL on June 13, 2014:

It is scary how many things we access with just those 4 numbers. great hub.

dummy on August 07, 2013:

great article \o/.. Is it safe to give first12 digits of cc number? i mean to ask can anyone determine the last 4 digits if first 12 digits r known?

radharenu (author) from India on March 04, 2013:

Hi Joy

Thank you for stopping by and your comments.

Joy from United States on March 03, 2013:

Great hub.. we didn't know that what one can do with our last 4 numbers of credit card. we always share it freely.

Thank you for this hub. useful for me.

Related Articles