Table of Contents
What is GTIN?
GTIN (Global Trade Item Number) is a unique identifier for products and services in global commerce. Managed by GS1 (the organization behind barcode standards), GTINs enable products to be tracked through the supply chain and identified at point of sale.
GTINs come in various lengths depending on their application:
- GTIN-8: 8 digits, used for small products where space is limited
- GTIN-12: 12 digits, the UPC-A format widely used in North America
- GTIN-13: 13 digits, the EAN/IAN format used internationally and for ISBN-13
- GTIN-14: 14 digits, used for cases, cartons, and pallets
What is a Check Digit?
A check digit is the last digit of a barcode that verifies the accuracy of the preceding digits. It's calculated using a specific algorithm and helps detect errors in data entry, printing, or scanning. If even one digit is incorrect, the check digit will not match, alerting the system to an error.
Check digits catch common errors including:
- Single digit errors: One digit entered incorrectly
- Transposition errors: Two adjacent digits swapped
- Twin errors: aa becoming bb
- Jump transpositions: abc becoming cba
The Mod 10 Algorithm
GTIN check digits are calculated using the Mod 10 algorithm (also known as the Luhn algorithm variant for GTINs). The algorithm uses alternating multipliers of 1 and 3, starting from the rightmost data digit.
1. Assign multipliers (1 or 3) from right to left, starting with 32. Multiply each digit by its assigned multiplier3. Sum all the products4. Check Digit = (10 - (Sum mod 10)) mod 10
Why Mod 10?
The modulo 10 operation ensures the check digit is always a single digit (0-9). The alternating multipliers (1 and 3) are chosen because they catch the most common data entry errors while remaining computationally simple.
Step-by-Step Calculation
Let's calculate the check digit for EAN-13 barcode 590123412345?:
Step 1: Assign Multipliers
Starting from the rightmost data digit and moving left, assign alternating multipliers of 3 and 1:
Position: 1 2 3 4 5 6 7 8 9 10 11 12Digits: 5 9 0 1 2 3 4 1 2 3 4 5Mult: 1 3 1 3 1 3 1 3 1 3 1 3
Step 2: Multiply and Sum
5×1 + 9×3 + 0×1 + 1×3 + 2×1 + 3×3 + 4×1 + 1×3 + 2×1 + 3×3 + 4×1 + 5×3= 5 + 27 + 0 + 3 + 2 + 9 + 4 + 3 + 2 + 9 + 4 + 15= 83
Step 3: Calculate Check Digit
Check Digit = (10 - (83 mod 10)) mod 10 = (10 - 3) mod 10 = 7
The complete barcode is: 5901234123457
Anatomy of a Barcode
EAN-13 Structure
- Digits 1-3: GS1 Country Prefix (identifies the country where the barcode was assigned)
- Digits 4-7: Company Prefix (identifies the manufacturer)
- Digits 8-12: Product Code (identifies the specific product)
- Digit 13: Check Digit
UPC-A Structure
- Digit 1: Number System Character (type of product)
- Digits 2-6: Manufacturer Code
- Digits 7-11: Product Code
- Digit 12: Check Digit
Worked Examples
Example 1: ISBN-13
Input: 978030640615 (12 digits)
9×1 + 7×3 + 8×1 + 0×3 + 3×1 + 0×3 + 6×1 + 4×3 + 0×1 + 6×3 + 1×1 + 5×3= 9 + 21 + 8 + 0 + 3 + 0 + 6 + 12 + 0 + 18 + 1 + 15 = 93Check Digit = (10 - 3) mod 10 = 7Complete ISBN-13: 9780306406157
Example 2: UPC-A
Input: 03600029145 (11 digits)
0×3 + 3×1 + 6×3 + 0×1 + 0×3 + 0×1 + 2×3 + 9×1 + 1×3 + 4×1 + 5×3= 0 + 3 + 18 + 0 + 0 + 0 + 6 + 9 + 3 + 4 + 15 = 58Check Digit = (10 - 8) mod 10 = 2Complete UPC: 036000291452
Example 3: GTIN-8
Input: 9638507 (7 digits)
9×3 + 6×1 + 3×3 + 8×1 + 5×3 + 0×1 + 7×3= 27 + 6 + 9 + 8 + 15 + 0 + 21 = 86Check Digit = (10 - 6) mod 10 = 4Complete GTIN-8: 96385074
Frequently Asked Questions
UPC (Universal Product Code) is the 12-digit barcode system used primarily in North America. EAN (European Article Number) is the 13-digit international system. UPC-A can be converted to EAN-13 by adding a leading zero. Both use the same Mod 10 check digit algorithm.
Yes, a check digit can be 0. This occurs when the sum of the weighted digits is already a multiple of 10. For example, if the sum is 80, then (10 - 0) mod 10 = 0.
To verify a complete barcode: (1) Calculate what the check digit should be using the first N-1 digits, (2) Compare your calculated check digit with the actual last digit, (3) If they match, the barcode is valid. Alternatively, include the check digit in the calculation - a valid barcode will have a total sum that's a multiple of 10.
The 1-3 weighting scheme was chosen because it catches all single-digit errors and most adjacent transposition errors. Using 1 and 3 specifically (rather than other numbers) means no single digit contributes more than 27 to the sum, keeping calculations manageable while maintaining error detection capability.
Yes, ISBN-13 uses the same format and check digit algorithm as EAN-13. ISBN-13 codes always begin with 978 or 979 (the "Bookland" country prefixes). The calculation method is identical to any other GTIN-13.