Check Digit Calculator
Enter a barcode, identification number, or credit card number to calculate its check digit or verify that an existing check digit is correct. Choose your algorithm from Luhn (credit cards, IMEI, NPI), EAN-13, EAN-8, UPC-A, ISBN-10, ISBN-13, ISSN, GTIN-14, and SSCC-18. The step-by-step panel shows every multiplication and sum so you can follow the working yourself.
What is a check digit and why does it matter?
A check digit is a single character appended to an identification number - such as a barcode, credit card number, ISBN, or IMEI - that is calculated from the other digits using a mathematical algorithm. When a scanner, point-of-sale terminal, or database system reads or receives a number, it runs the same algorithm on the received digits and compares the result with the supplied check digit. If they match, the number is almost certainly correct; if they differ, an error has occurred during entry or transmission. Check digits catch virtually all single-digit errors and most transpositions of adjacent digits, which are the most common human copying mistakes. They do not prove that a product or card exists in any database - only that the number itself is internally consistent.
GS1 Mod-10: the algorithm behind EAN, UPC, and GTIN
EAN-13, EAN-8, UPC-A, ISBN-13, GTIN-14, and SSCC-18 all use the same GS1 Mod-10 algorithm. Each digit of the payload (the number excluding the check digit) is multiplied alternately by 1 and 3, working from left to right and ending with weight 3 on the rightmost payload digit. All products are summed, and the check digit is whatever value must be added to make the total a multiple of 10. For example, with EAN-13 payload 400638133393: multiply by 1, 3, 1, 3, ... , 3, sum the products, find the remainder when dividing by 10, and subtract from 10. This is also sometimes called the Luhn-variant or Modulo 10 retail algorithm, though it differs from the standard Luhn algorithm used for credit cards.
Luhn algorithm: credit cards, IMEI, and NPI
The Luhn algorithm (also called Mod-10) is used by virtually all payment card networks, IMEI mobile identifiers, and US National Provider Identifier (NPI) numbers. Working from right to left, every second digit is doubled; if doubling produces a number greater than 9, subtract 9 from the result. All digits (original and doubled) are then summed, and a valid number yields a sum divisible by 10. For NPI numbers, a five-digit prefix "80840" is prepended before applying Luhn, which is an unusual wrinkle specific to the US healthcare system. The Luhn algorithm was patented in 1954 by Hans Peter Luhn of IBM and is intentionally simple so that card readers could verify numbers electronically in the 1950s without network access.
ISBN-10 and Mod-11: why the check digit can be X
ISBN-10, used for books published before 2007, employs Modulo 11 arithmetic. Each of the 9 payload digits is multiplied by a descending weight from 10 down to 2, the products are summed, and the check digit is (11 - sum mod 11) mod 11. Because this can yield values from 0 to 10, and 10 cannot be represented as a single digit, the Roman numeral X is used instead. This is why some older ISBN numbers end with X. Since 2007, all new ISBNs are published in ISBN-13 format (which is identical to EAN-13 and uses GS1 Mod-10), so the X-ending possibility no longer arises for new books.
Common check digit algorithms and their uses
| Format | Algorithm | Total Digits | Used For |
|---|---|---|---|
| EAN-13 / ISBN-13 | GS1 Mod-10 (weights 1, 3) | 13 | Retail barcodes, modern books |
| EAN-8 | GS1 Mod-10 (weights 1, 3) | 8 | Small product barcodes |
| UPC-A | GS1 Mod-10 (weights 1, 3) | 12 | North American retail |
| GTIN-14 | GS1 Mod-10 (weights 1, 3) | 14 | Shipping cases and cases |
| SSCC-18 | GS1 Mod-10 (weights 1, 3) | 18 | Shipping containers |
| ISSN | Mod-11 (weights 8..2) | 8 | Journal and magazine IDs |
| ISBN-10 | Mod-11 (weights 10..2) | 10 | Legacy book IDs (pre-2007) |
| Credit Card | Luhn / Mod-10 (double alternating) | 13-16 | Payment cards |
| IMEI | Luhn / Mod-10 | 15 | Mobile device identifiers |
| NPI | Luhn with 80840 prefix | 10 | US healthcare provider IDs |
Each format uses a specific weighting scheme and expected digit count.
Frequently asked questions
What is the difference between Luhn and GS1 Mod-10?
Both are Modulo 10 algorithms but they use different weighting patterns. Luhn (used for credit cards and IMEI) doubles every second digit starting from the right, subtracts 9 if the doubled value exceeds 9, then sums everything. GS1 Mod-10 (used for EAN, UPC, and GTIN barcodes) multiplies alternating digits by 1 and 3, always ending with weight 3 on the rightmost payload digit. They produce different check digits for the same input number.
Why does my credit card check digit verify as valid but the card is declined?
Check digit validation only confirms that the number is internally consistent - it does not contact any bank or network. A number can pass the Luhn check while still being expired, cancelled, blocked, or simply non-existent. Banks always perform their own real-time lookup against account records, which is a separate step entirely from the check digit.
Can a check digit detect all errors?
No. Check digits reliably catch all single-digit errors and most transpositions of two adjacent digits. They cannot detect all two-digit errors or permutations of three or more digits. For example, swapping the first and third digit can sometimes go undetected depending on the algorithm. For high-security applications, longer error-detection codes such as CRC-32 are used instead.
What is SSCC-18 and when is it used?
SSCC stands for Serial Shipping Container Code. It is an 18-digit GS1 number that uniquely identifies a logistics unit such as a pallet, case, or container. Every SSCC ends with a GS1 Mod-10 check digit. SSCCs are used in supply chains to track shipments from manufacturer to retailer and are typically encoded in a GS1-128 barcode or an RFID tag.
Why does the NPI calculator prepend 80840?
The US National Provider Identifier standard (HIPAA, 45 CFR Part 162) specifies that Luhn validation is performed on a 15-digit number formed by prepending the NPI Enumerator prefix "80840" to the 10-digit NPI. This ensures that NPIs are distinguishable from other Luhn-checked numbers and reduces accidental cross-system collisions.
How do I calculate the check digit for an ISBN-13?
ISBN-13 uses exactly the same GS1 Mod-10 algorithm as EAN-13. Enter the first 12 digits of the ISBN-13 (the prefix, group code, publisher code, and title number, without the final check digit), select EAN-13 as the algorithm, choose "calculate" mode, and the calculator will return the correct check digit. The full 13-digit result is your complete ISBN-13.