Friday, October 1, 2010

How to validate credit card number……..



There are many banks over the world which provides 16 digit credit card number , some banks also provides 14 , 15 digit credit card numbers. Lets see how 16 digit credit card number is validated……..

Validation or selection of credit card number is using Luhn algorithm .how Luhn algorithm validates credit card number is as follow.
1) Starting from check digit multiply by 2 to every second digit
2) If multiplication results are 10 &more than ten then subtract 9 from such value.
3) Now new credit card number will form from that new 8 numbers & existing 8 numbers.
4) Add all digit of credit card number.

If addition of all that credit card number is multiple of 10 then such credit card number is valid & if such addition is not multiple of 10 then such number is invalid credit card number.

Eg . Credit card number
4568273002431056


4
5
6
8
2
7
3
0
0
2
4
3
1
0
5
6
4*2
5
6*2
8
2*2
7
3*2
0
0*2
2
4*2
3
1*2
0
5*2
6
8
5
12
8
4
7
6
0
0
2
8
3
2
0
10
6
8
5
3
8
4
7
6
0
0
2
8
3
2
0
1
6


Sum of all digits is 63. Therefore above credit card number is not valid.

9 comments:

  1. gud one dear.......is there somthing to validate our debit cards

    ReplyDelete
  2. I just checked mine... its fun ya...
    I never knew this girl.... thanx

    ReplyDelete
  3. hey maria i just checked my number it really works... vow thats amazing i never knew that... is there something to check debit card numbers as well....

    ReplyDelete
  4. thanx swethrt for sharing such a valuable information..its realy worled for my 16 digit credit card no..

    ReplyDelete
  5. productive one thanx for sharing

    ReplyDelete
  6. please find out whether banks follow this algorithm for credit card nos or a person who devised this algorithm developed this on general basis.

    ReplyDelete