Ever wonder how to validate a credit card or how sites are able to detect if that card entered in is valid without actually connecting to a server. However complex it may seem on the surface, underneath it is quite simple as you can see it fully explained by this page here that breaks down the steps in validating a credit card number. They have stepped though a single example however you can enter in your own test card number to see how it validates. I tried a few just random numbers to see if they would validate. After a few tries I was not only able to get cards to validate, but also I can now switch between different card types, such as VISA, Mastercard and AMEX. Many things that I did not realize have been brought to light such as the first digit on a credit card actually determines the industry the card services.