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

  1. Take all digits except the check digit.
  2. Starting from the rightmost digit, multiply the digits alternately by 3 and 1.
  3. Add up the products.
  4. 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)393331836004
Weight313131313131
Product99939124318004

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