What Is a GTIN? β Definition and How It Works
Learn what a GTIN is, how UPC, EAN, and ISBN relate to it, and why it is the best product-matching key.
A Global Trade Item Number is a globally unique identifier for a trade item, administered by GS1. It is the identifier that makes product matching across retailers tractable.
1. The Family
GTIN is the umbrella; the familiar names are its length variants:
| Name | Digits | Common use |
|---|---|---|
| GTIN-8 / EAN-8 | 8 | Very small packages |
| GTIN-12 / UPC-A | 12 | North America |
| GTIN-13 / EAN-13 | 13 | Europe and most of the world |
| GTIN-14 / ITF-14 | 14 | Cases and outer packaging |
| ISBN-13 | 13 | Books β a GTIN-13 in the 978/979 prefix |
They are the same numbering space. A 12-digit UPC is a GTIN-13 with a leading zero, which is why normalising to 14 digits with leading zeros is the standard way to compare them.
2. Normalise Before Comparing
The most common matching bug: comparing a UPC to an EAN as strings and concluding they are different products.
def normalize_gtin(value: str) -> str | None:
digits = "".join(c for c in str(value) if c.isdigit())
if len(digits) not in (8, 12, 13, 14):
return None
return digits.zfill(14)
Zero-padding to 14 makes every variant comparable. Without it, the same product from two retailers looks like two products.
3. The Check Digit
The final digit is a checksum, computed from the others. Validating it catches transcription errors, truncated values, and fabricated numbers β cheaply.
def valid_gtin(gtin14: str) -> bool:
if len(gtin14) != 14 or not gtin14.isdigit():
return False
body, check = gtin14[:-1], int(gtin14[-1])
total = sum(int(d) * (3 if i % 2 == 0 else 1) for i, d in enumerate(body))
return (10 - total % 10) % 10 == check
Run it on every collected GTIN. An invalid check digit means the value is wrong, and storing it as a matching key propagates the error into every downstream join.
4. Why It Is the Best Matching Key
Product matching across retailers is otherwise entity resolution over messy titles. A GTIN turns it into an exact join:
"Acme Wireless Keyboard K450 - Black, Mechanical, US Layout"
"ACME K450 Mechanical Keyboard (Black) US"
β both carry GTIN 00012345678905
exact match
Where present, it removes the fuzzy matching, the blocking, the thresholds, and the review band entirely.
5. Where to Find It
| Location | Reliability |
|---|---|
JSON-LD gtin13 / gtin / gtin12 |
High β structured and maintained |
Microdata itemprop="gtin13" |
High |
| A specifications table | Moderate β labels vary |
| Retailer's own product API | High |
| The barcode in a product image | Requires OCR |
| The URL or page body | Low β often a retailer SKU instead |
Structured data is the place to look first, and it is one of the strongest arguments for extracting JSON-LD before attempting DOM parsing.
6. Its Limits
Not every product has one. Own-brand goods, services, custom items, and many marketplace listings have none.
Variants may share or differ. Colour and size variants sometimes each have a GTIN and sometimes share one, which is inconsistent across brands.
Retailers substitute their own SKUs. A number on a page may be an internal identifier, not a GTIN β length and check-digit validation is what distinguishes them.
Reuse happens. GS1 rules restrict it, but numbers are occasionally reassigned after long discontinuation.
Marketplace listings carry wrong ones. Sellers enter them manually, so a GTIN on a marketplace listing is a claim rather than a fact.
7. Practical Guidance
- Normalise to 14 digits before any comparison.
- Validate the check digit and reject invalid values rather than storing them.
- Prefer structured data as the source.
- Keep the retailer SKU too β it is needed to fetch the page again.
- Do not assume presence. Fall back to fuzzy matching where absent.
- Treat marketplace GTINs as unverified, and corroborate before trusting a join.
8. Summary
A GTIN is a globally unique GS1 trade-item identifier, with UPC-12, EAN-13, and ISBN-13 all being length variants of one numbering space β so normalising to 14 digits with leading zeros is what makes them comparable.
Validate the check digit to reject wrong values before they poison downstream joins, prefer structured data as the source, and remember that many products have none and that marketplace-supplied GTINs are seller claims rather than verified facts.