Credit Card Account Number Verification - Check Digit Scheme

Check Digit Scheme

A check digit is a digit added to a number (either at the end or the beginning) that validates the authenticity of the number. A simple algorithm is applied to the other digits of the number which yields the check digit. Check Digit Scheme can be used when an end-user has entered in a credit card number and you want to validate it before sending it an authorization.

This self-checking scheme (referred to as the Luhn Mod-10 Method) is an international standard for validating card account numbers (ISO 2894/ANSI 4.13). Such account numbers, which cannot exceed 19 digits including the check digit, are assigned, embossed and encoded to include a single check digit in the rightmost position. The check digit is calculated as follows:

  1. Beginning on the right with the digit which immediately precedes the check digit and moving toward the left, double every other digit. After doubling each selected digit, if the result is ten or greater, add the two digits together to arrive at a single-digit result.
  2. Each individual resulting digit (plus those skipped above) are then added together.
  3. This sum is then subtracted from the lowest multiple of ten which is equal to or greater than the sum and the single-digit result is the check digit.

Example:
15-Digit Account Number 7951-0287-9015-54?