How To Use Luhn Algorithm To Find If A Credit Card Is Fake?


Luhn Algorithm

Did you know that you can easily tell whether a credit card/debit card number is correct or not by doing some quick calculations? While it’s highly unlikely that you will find yourself in a situation where you have to manually verify the authenticity of a card, nonetheless it is an interesting trick to know.

The process to find if a card number is fake is based on an algorithm developed by an IBM scientist Hans Peter Luhn (1896-1964), and is called Luhn algorithm. He was awarded US patent for that in 1960.

Using a little bit of Math, and following the instructions given below, you can easily apply Luhn algorithm manually to find if a card (debit or credit) is authentic or not.

Let’s take the example of this card that I picked from Google Images.

Fake Credit Card Example

The card number is 4000 0012 3456 7899. The last digit on the card is called the ‘check digit’ and plays a very important role as we will see.

Steps To Identify If A Credit Card Is Fake or Authentic using Luhn Algorithm

1) Note down the card number after removing the check digit

In our example card, we’ll remove the last digit and note down the remaining numbers.  

4 0 0 0 0 0 1 2 3 4 5 6 7 8 9

2) Multiply the digits in the odd-places by 2

Multiply the 1st digit, 3rd digit, 5th digit, and so on

4
x
2
00
x
2
00
x
2
01
x
2
23
x
2
45
x
2
6 7
x
2
89
x
2

This is what we get

8 0 0 0 0 0 2 2 6 4 10 6 14 8 18

3) If any of the numbers so obtained is 10 or greater than 10, subtract 9 from it

Subtracting 9 from all the two-digit numbers obtained in the previous step, we get:

8 0 0 0 0 0 2 2 6 4 1 6 5 8 9

4) Add all the digits together

Adding all the digits obtained in step 3, we get 51.

5) Add the check digit that was removed in the first step, to the answer obtained above.

Check digit that we removed in Step 1 is 9, and the answer obtained in the previous step is 51. Adding these two we get the final answer as 60.

6) If the final answer is divisible by 10, the card number is valid

Since our answer, 60, is divisible by 10, our card number is valid.

But wait!!

This doesn’t necessarily mean that this is an authentic card. It only means that this can be a possible card sequence. However, whether or not the bank has issued a card with this sequence is a different case.

What’s The Practical Use Of Luhn Algorithm?

While Luhns Algorithm is not about security anymore, it was an important feature earlier when credit cards could not be quickly verified online.

Luhn Algorithm Security Compressed

Even today, it’s a fantastic way of catching typos and can catch most of the transcription mistakes. If you see an error message when you incorrectly type your card number online, it is probably because the backend is using Luhn algorithm as the first line of defense.

CRED: An App That Rewards You For Paying Credit Card Bills

This holds true for all debit and credit cards, including Visa, Master, Amex, RuPay etc

Isn’t this interesting? Why don’t you try this out with your card?

If you are new here, see the list of articles published so far.

Whatsapp group


Leave a Comment