How the GTIN check digit is calculated
Every GTIN ends with a check digit. It lets scanners and software detect typing and reading errors. The same calculation, the GS1 mod-10 algorithm, is used for GTIN-8, GTIN-12 (UPC-A), GTIN-13 (EAN-13), GTIN-14, SSCC (18 digits) and GLN (13 digits).
The algorithm
- Take all digits except the check digit.
- Starting from the rightmost digit, multiply the digits alternately by 3 and 1.
- Add up the products.
- The check digit is the number you need to add to reach the next multiple of 10:
(10 − sum mod 10) mod 10.
Because the weights start from the right, leading zeros do not change the result. That is why 4006381333931 and its GTIN-14 form 04006381333931 have the same check digit.
Worked example: EAN-13 4006381333931
Data without check digit: 400638133393
| Digit (from right) | 3 | 9 | 3 | 3 | 3 | 1 | 8 | 3 | 6 | 0 | 0 | 4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Weight | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 |
| Product | 9 | 9 | 9 | 3 | 9 | 1 | 24 | 3 | 18 | 0 | 0 | 4 |
Sum: 89. Next multiple of 10: 90. Check digit: 1. The full GTIN is 4006381333931.
What the check digit catches
- Every single wrong digit.
- Most swaps of two neighbouring digits. Swapping digits a and b changes the sum by 2 × (a − b). The error goes unnoticed only when the two digits differ by exactly 5, for example 1 and 6.
A correct check digit does not mean the GTIN is assigned or registered. It only means the number is well formed.
Related tools
- GTIN Validator: check a GTIN and get the correct check digit
- GS1 Parser: validate GTINs inside GS1 element strings
- Barcode Generator: create EAN-13, UPC-A and ITF-14 barcodes