How Check Digits Work: Mod-10 and Mod-97 Explained
The last digit of a barcode, ISBN, or IBAN is not random. It is computed from all the other characters, and it exists to catch typos before they cost you money.
What a check digit actually does
A check digit is a single character appended to an identifier that is calculated from every other character in it. When someone later types or scans that identifier, a computer reruns the same calculation. If the result does not match, the number was corrupted somewhere — a mistyped digit, two digits swapped, a scanner misread — and the system can reject it immediately instead of shipping the wrong product or wiring money to the wrong account.
The two most common failure modes a check digit algorithm targets are:
- Single-digit errors: typing 7 instead of 1. This is the most frequent keying mistake.
- Adjacent transpositions: typing 54 instead of 45. This is the second most frequent.
Different code systems use different math to catch these. Let's walk through the three you will meet most often: the GS1 Mod-10 check digit on barcodes, the Mod-11 scheme on old-style ISBNs, and the Mod-97 check on IBANs.
GS1 Mod-10: the barcode check digit
Every GTIN — the family that includes UPC-A (12 digits), EAN-13, GTIN-14, and also the 18-digit SSCC used on logistics labels — ends with a check digit computed by the GS1 mod-10 algorithm. The rule:
- Take the number without its check digit.
- Starting from the rightmost digit, multiply digits alternately by 3 and 1 (rightmost gets 3).
- Add up all the products.
- The check digit is whatever you must add to reach the next multiple of 10 (if the sum already ends in 0, the check digit is 0).
Worked example: 03600029145
Suppose a manufacturer has the 11-digit UPC-A body 03600029145 and needs the twelfth digit. Working from the right:
| Digit | 0 | 3 | 6 | 0 | 0 | 0 | 2 | 9 | 1 | 4 | 5 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Weight | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 |
| Product | 0 | 3 | 18 | 0 | 0 | 0 | 6 | 9 | 3 | 4 | 15 |
Sum of products: 0 + 3 + 18 + 0 + 0 + 0 + 6 + 9 + 3 + 4 + 15 = 58. The next multiple of 10 is 60, so the check digit is 60 − 58 = 2, and the full UPC-A is 036000291452.
Why does this catch typos? Any single wrong digit changes the sum by either the plain difference or 3× the difference. Because 3 and 10 share no common factor, that change can never be a multiple of 10, so the total stops landing on a round number and validation fails — the scheme catches every single-digit error. Swapping two adjacent digits changes the sum by twice their difference, which is only invisible when the two digits differ by 5 (or are equal); so mod-10 catches most, but not all, adjacent transpositions — swapping ...27... to ...72... is missed, since 7 − 2 = 5.
You do not need to do this by hand: the GTIN check digit calculator computes or verifies the final digit for UPC-A, EAN-13 and GTIN-14 codes, and if you have a whole spreadsheet of barcodes the bulk barcode validator checks them all at once.
One caution: the GS1 algorithm is often confused with the Luhn algorithm used on credit card numbers. Both are "mod 10", but Luhn doubles alternate digits and folds two-digit products back into one digit, while GS1 multiplies by 3 and keeps products whole. A number valid under one is not generally valid under the other.
ISBN-10 Mod-11: why some ISBNs end in X
Before 2007, books carried 10-character ISBNs with a mod-11 checksum. The first nine digits are multiplied by descending weights 10, 9, 8, ... 2, and the check character is chosen so that the grand total is divisible by 11.
Worked example: 0-306-40615-?
(0×10) + (3×9) + (0×8) + (6×7) + (4×6) + (0×5) + (6×4) + (1×3) + (5×2) = 0 + 27 + 0 + 42 + 24 + 0 + 24 + 3 + 10 = 130.
130 mod 11 = 9, so we need 11 − 9 = 2 more to reach a multiple of 11. The full ISBN is 0-306-40615-2.
Here is the twist: because the modulus is 11, the required check value can be anything from 0 to 10 — and 10 is not a single digit. When the math demands 10, the ISBN ends in the letter X (the Roman numeral for ten). For example, in 0-8044-2957-X the weighted sum of the first nine digits is 199; 199 mod 11 = 1, so the check value must be 10, written as X.
Why tolerate that awkward X at all? Because 11 is a prime number and every weight from 2 to 10 is distinct, the mod-11 scheme catches all single-digit errors and all transpositions of any two characters — stronger than mod-10. Modern ISBN-13s trade that away for barcode compatibility: an ISBN-13 is a GTIN, so it uses the same GS1 mod-10 algorithm described above, and its check digit is always 0–9. That is why converting between the two formats means recomputing the check digit, not just adding a 978 prefix — the ISBN-10 to ISBN-13 converter handles both directions and validates the result.
IBAN Mod-97: two check digits for bank accounts
International Bank Account Numbers, defined by ISO 13616, protect against errors with two check digits (positions 3 and 4, right after the country code) and a much bigger modulus: 97, the largest two-digit prime. The validation procedure, based on ISO/IEC 7064 MOD 97-10:
- Move the first four characters (country code + check digits) to the end of the string.
- Replace every letter with two digits: A = 10, B = 11, ... Z = 35.
- Interpret the whole thing as one large integer and compute its remainder mod 97.
- The IBAN is valid if and only if the remainder is 1.
Worked example: GB82 WEST 1234 5698 7654 32
Step 1 — rearrange: WEST12345698765432GB82.
Step 2 — convert letters (W=32, E=14, S=28, T=29, G=16, B=11): 3214282912345698765432161182.
Step 3 — that 28-digit number mod 97 equals 1, so the IBAN is valid. (In practice software takes the number in chunks — for example nine digits at a time, carrying the remainder forward — because the full integer overflows ordinary 32- or 64-bit arithmetic.)
To generate the check digits, banks do the same computation with 00 in the check positions and subtract the remainder from 98. Two check digits and a prime modulus make this scheme very strong: it detects all single-character errors and all single transpositions, and the vast majority of more complex garbling. You can test any IBAN's structure and checksum — country format, length, and the mod-97 remainder — with the IBAN checker.
Choosing the right modulus: a quick comparison
| Scheme | Used by | Check chars | Single-digit errors | Adjacent transpositions |
|---|---|---|---|---|
| GS1 Mod-10 (weights 3/1) | UPC, EAN, GTIN, ISBN-13, SSCC | 1 digit (0–9) | All caught | Missed when digits differ by 5 |
| Mod-11 (weights 10..2) | ISBN-10 | 1 char (0–9 or X) | All caught | All caught |
| Mod-97 (ISO 7064) | IBAN (ISO 13616) | 2 digits | All caught | All caught |
The pattern: a prime modulus larger than the alphabet catches more, but may need an extra symbol (ISBN's X) or extra digits (IBAN's two). Mod-10 accepts a small blind spot in exchange for pure-digit output that fits neatly under a barcode.
Finally, remember what a check digit cannot do. It confirms the number is self-consistent, not that it is assigned. A GTIN with a perfect check digit may belong to no product; an IBAN that passes mod-97 may be a closed account. Checksums are the cheap first gate — registries and bank confirmation are the second.
FAQ
Is the GS1 Mod-10 check digit the same as the Luhn algorithm?
No. Both are mod-10 schemes, but they weight digits differently. The GS1 algorithm multiplies alternating digits by 3 and 1 and picks the check digit that brings the total to a multiple of 10. The Luhn algorithm, used for payment card numbers, doubles alternating digits and, if a doubled value exceeds 9, adds its digits together (or subtracts 9) before summing. A number that passes one test will not generally pass the other.
Why do some ISBN-10 numbers end in X?
ISBN-10 uses a mod-11 checksum, so the check value can be anything from 0 to 10. Since 10 cannot be written as a single digit, the Roman numeral X stands in for it. This only happens in ISBN-10; ISBN-13 uses the GS1 mod-10 algorithm, so its check digit is always 0-9 and never X.
Does a valid check digit mean the code actually exists?
No. A correct check digit only means the number is internally consistent - it was not obviously mistyped. It does not prove that a GTIN has been assigned to a real product, that an ISBN belongs to a published book, or that an IBAN points to an open bank account. Checksum validation is a first filter, not a registry lookup.
Calculate any GTIN check digit in one click
Paste a UPC, EAN or GTIN-14 body into the GTIN check digit calculator and get the verified final digit instantly — no spreadsheet formulas required.
This guide is for general information only. Check digit validation confirms internal consistency of a number, not that a code is officially registered, assigned, or in use. For barcode assignment consult GS1; for ISBNs consult your national ISBN agency; always confirm bank details directly with the account holder or bank before sending payments.