How was the website able to tell my credit card was wrong before it processed it?

Credit card numbers can verified by calculating a checksum.

Every credit card number created is assigned a number following an algorithm.

Ross Millikan: The checksum specifies the last digit, so there are 15 digits left. That should mean there are 10^15 numbers available, but there are other restrictions. The first digit is the card type (4=Visa, 5=MasterCard, etc.) and the next several have to do with the issuer.

Following that, if this a credit card number does not comply with the algorithm, the checksum is incorrect so the number must be invalid.

The algorithm is called the “Luhn algorithm”, check this Wikipage for more Info.

TripeHound: Note: if a given number fails the check, it is definitely not a real CC number. However, if it passes the check, it only proves that it is a potential CC number: it does not prove that it has actually been issued. The next stage of verification (talking to a card-processor) should verify that. Similar checks can be made on UK sort-code/account-number pairs (and probably something similar in other countries) and on International Bank Account Numbers (IBANs)

Edit: Added some of the information given in the Comments to the Answer. Pleas go and give them an Upvote too, its great information.


Credit Card