|
2 | 2 |
|
3 | 3 | Yet another not complete list of random codes. |
4 | 4 |
|
| 5 | +## GTIN |
| 6 | + |
| 7 | +GTIN is the umbrella term for globally standardized product identifiers used to uniquely identify trade items. There are different types based on length: |
| 8 | + |
| 9 | +- GTIN-13 (13 digits) → same as EAN-13* |
| 10 | +- GTIN-12 (12 digits) → same as UPC-A** |
| 11 | +- GTIN-14 (14 digits) → used for packaging levels or logistics |
| 12 | +- GTIN-8 (8 digits) → for small products |
| 13 | + |
| 14 | +*EAN is an older term, originally used mainly in Europe. EAN-13 (or GTIN-13) is the most common EAN form. Although the term EAN is still commonly used, it has been officially replaced by GTIN in global standards. |
| 15 | + |
| 16 | +**UPC-A (Universal Product Code) or GTIN-12 is a 12-digit code widely used in the United States and Canada. There's also a shortened version called UPC-E (8 digits) used for small packages. |
| 17 | + |
| 18 | +### GTIN structure |
| 19 | + |
| 20 | +A GTIN is a numeric code (8, 12, 13, or 14 digits long) with this general structure: |
| 21 | + |
| 22 | +[Country Code] + [Company Prefix] + [Item Reference] + [Check Digit] |
| 23 | + |
| 24 | +- Company Prefix: Assigned by GS1 (the global standards organization). Identifies the brand owner. |
| 25 | +- Item Reference: Assigned by the company to identify a specific product. |
| 26 | +- Check Digit: A single digit at the end, used to verify that the number was correctly composed or scanned. |
| 27 | + |
| 28 | +=== "GTIN Prefixes" |
| 29 | + |
| 30 | + | Prefix | Country / Use | Prefix | Country / Use | |
| 31 | + |---------------|------------------------------------|--------------|----------------------------------------| |
| 32 | + | 00–13 | USA & Canada | 20–29 | Internal numbering | |
| 33 | + | 30–37 | France | 380 | Bulgaria | |
| 34 | + | 383 | Slovenia | 385 | Croatia | |
| 35 | + | 387 | Bosnia and Herzegovina | 400–440 | Germany | |
| 36 | + | 45, 49 | Japan | 460–469 | Russia | |
| 37 | + | 471 | Taiwan | 474 | Estonia | |
| 38 | + | 475 | Latvia | 476 | Azerbaijan | |
| 39 | + | 477 | Lithuania | 478 | Uzbekistan | |
| 40 | + | 479 | Sri Lanka | 480 | Philippines | |
| 41 | + | 481 | Belarus | 482 | Ukraine | |
| 42 | + | 484 | Moldova | 485 | Armenia | |
| 43 | + | 486 | Georgia | 487 | Kazakhstan | |
| 44 | + | 489 | Hong Kong | 50 | United Kingdom | |
| 45 | + | 520 | Greece | 528 | Lebanon | |
| 46 | + | 529 | Cyprus | 531 | North Macedonia | |
| 47 | + | 535 | Malta | 539 | Ireland | |
| 48 | + | 54 | Belgium and Luxembourg | 560 | Portugal | |
| 49 | + | 569 | Iceland | 57 | Denmark | |
| 50 | + | 590 | Poland | 594 | Romania | |
| 51 | + | 599 | Hungary | 600, 601 | South Africa | |
| 52 | + | 608 | Bahrain | 609 | Mauritius | |
| 53 | + | 611 | Morocco | 613 | Algeria | |
| 54 | + | 616 | Kenya | 619 | Tunisia | |
| 55 | + | 621 | Syria | 622 | Egypt | |
| 56 | + | 624 | Libya | 625 | Jordan | |
| 57 | + | 626 | Iran | 627 | Kuwait | |
| 58 | + | 628 | Saudi Arabia | 629 | United Arab Emirates | |
| 59 | + | 64 | Finland | 690–695 | China | |
| 60 | + | 70 | Norway | 729 | Israel | |
| 61 | + | 73 | Sweden | 740 | Guatemala | |
| 62 | + | 741 | El Salvador | 742 | Honduras | |
| 63 | + | 743 | Nicaragua | 744 | Costa Rica | |
| 64 | + | 745 | Panama | 746 | Dominican Republic | |
| 65 | + | 750 | Mexico | 76 | Switzerland and Liechtenstein | |
| 66 | + | 770 | Colombia | 773 | Uruguay | |
| 67 | + | 775 | Peru | 777 | Bolivia | |
| 68 | + | 779 | Argentina | 780 | Chile | |
| 69 | + | 784 | Paraguay | 786 | Ecuador | |
| 70 | + | 789–790 | Brazil | 80–83 | Italy | |
| 71 | + | 84 | Spain | 850 | Cuba | |
| 72 | + | 858 | Slovakia | 859 | Czech Republic | |
| 73 | + | 860 | Yugoslavia | 867 | North Korea | |
| 74 | + | 869 | Turkey | 87 | Netherlands | |
| 75 | + | 880 | South Korea | 885 | Thailand | |
| 76 | + | 888 | Singapore | 890 | India | |
| 77 | + | 893 | Vietnam | 899 | Indonesia | |
| 78 | + | 90, 91 | Austria | 93 | Australia | |
| 79 | + | 94 | New Zealand | 955 | Malaysia | |
| 80 | + | 958 | Macau | 977 | Magazines (ISSN) | |
| 81 | + | 978–979 | Books (ISBN) | 980 | Refund receipts, voucher codes | |
| 82 | + | 981–983 | Common Currency Coupons | 990–999 | Coupon codes | |
| 83 | + |
| 84 | +The check digit is calculated using the modulo 10 algorithm, also known as the Luhn algorithm variant for GTINs. Here is a python code example that uses the check digit to validate a GTIN-8, GTIN-12, GTIN-13, or GTIN-14 code: |
| 85 | + |
| 86 | +=== "GTIN code validation" |
| 87 | + |
| 88 | + ```py |
| 89 | + def is_valid_gtin(gtin): |
| 90 | + if not gtin.isdigit() or len(gtin) not in [8, 12, 13, 14]: |
| 91 | + return False |
| 92 | + digits = list(map(int, gtin)) |
| 93 | + total = sum(d * (3 if i % 2 else 1) for i, d in enumerate(reversed(digits[:-1]))) |
| 94 | + check = (10 - total % 10) % 10 |
| 95 | + return check == digits[-1] |
| 96 | + |
| 97 | + # Example |
| 98 | + print(is_valid_gtin("4006381333931")) # True |
| 99 | + print(is_valid_gtin("1234567890128")) # False |
| 100 | + ``` |
| 101 | + |
5 | 102 | ## Morse code |
6 | 103 |
|
7 | 104 | a: .- |
|
0 commit comments