How to generate a GTIN

The generation of the GTIN code depends on the length of the GS1 Company Prefix. The GTIN must always be unique. Usually the GTIN is 13 numbers long.

GTIN-13 code

The GTIN-13 code is 13 characters long. The number series consists as follows:

  • First the 6–9-digit GS1 Company Prefix
  • The next 1–6 numbers can be decided by yourself
  • The last 13th numebr is a check digit, which is calculated based on the first 12 digits


GTIN-13 code from a 9-digit GS1 Company Prefix


64YYYYYYY = GS1 Company Prefix
AAA = own digits
T = check digit


GTIN-13 code from a 7-digit GS1 Company Prefix


64YYYYY = GS1 Company Prefix
AAAAA = own digits
T = check digit


GTIN-13 code for a for product with variable-weight

  • First comes two numbers that define the weight range of the product:
    23 = products under 10 kg
    24 = products over 10 kg
    25 = over 100 kg products
  • Next comes the last four digits of the GS1 Company Prefix (640 is omitted)
  • You can decide the next two numbers yourself
  • The next four numbers tell the weight of the product in kilograms. The code 23, 24 or 25 at the beginning determines the position of the decimal point of the weight
  • The last 13th, number is a check digit, which is calculated based on the first 12 numbers

23 + YYYY + AA + PPPP + T -> products under 10 kg, e.g. 1.155 kg
24 + YYYY + AA + PPPP + T -> 10-100 kg products, e.g. 11.55 kg
25 + YYYY + AA + PPPP + T -> products over 100 kg, e.g. 115.5 kg

YYYY = company identifier without the beginning 640
AA = own digits
PPPP = weight of the product in kilograms in four digits without a decimal point
T = check number

GTIN-8, GTIN-12 and GTIN-14

In addition to the GTIN-13 code, there are three other GTIN versions: GTIN-14, GTIN-12, and GTIN-8. If the application requires the GTIN to be displayed as 14 digits, a sufficient number of zeros must be added to the beginning.

It should also be noted that GTIN-8 or GTIN-12 codes cannot be generated from a 9-, 7-, 10-, or 11-digit GS1 Company Prefix.