On a credit card, a checksum is a single digit in the account number that allows a computer, or anyone familiar with the formula involved, to determine whether the number is valid. The checksum can help identify credit card numbers that have been entered incorrectly -- or phony credit card numbers created by counterfeiters.
A checksum is a value embedded within a set of data. The checksum gives you a quick way to determine whether errors have been introduced into that data set during storage or transmission. Think of it like a packing slip that comes with a large delivery. The way to make sure nothing has been lost during shipment is to check each item against the packing slip. When you're dealing with data, the way to make sure that the information has arrived intact is to check it against the checksum.
On credit cards, the checksum takes the form of a "check digit." In a typical 16-digit credit card number, the first six digits identify the institution that issued the card. The next nine digits identify the individual account associated with the card. The last digit, the 16th, is the check digit. Credit card issuers plug the first 15 digits into a mathematical formula called the Luhn algorithm, which produces a single-digit result. That result becomes the check digit.
The main purpose of the check digit is to verify that a card number is valid. Say you're buying something online, and you type in your credit card number incorrectly by switching the places of two digits, perhaps the most common error. When the website looks at the number you've entered and applies the Luhn algorithm to the first 15 digits, the result won't match the 16th digit on the number you entered. The computer knows the number is invalid, and it knows the number will be rejected if it tries to submit the purchase for approval. So it asks you to re-enter the number. A secondary purpose of the check digit is to thwart clumsy attempts to create phony credit card numbers. A counterfeiter familiar with the Luhn algorithm, however, could get past this particular hurdle.
The Algorithm in Action
Verifying a 16-digit card number starts by taking the first 15 digits, which are the institution code and the individual account identifier. For example, in the card number 4578 4230 1376 9219, those digits would be:
Starting with the first digit, multiply every second digit by 2:
Every time you have a two-digit number, just add those digits together for a one-digit result:
Finally, add all the numbers together:
8 + 5 + 5 + 8 + 8 + 2 + 6 + 0 + 2 + 3 + 5 + 6 + 9 + 2 + 2 = 71
When this number is added to the check digit, then the result must be an even multiple of 10. In this case:
71 + 9 = 80
The number is therefore valid. If the algorithm doesn't produce a multiple of 10, then the card number cannot be valid.