MeridianMERIDIAN

EAN

identity.commerce.ean

European Article Number (also called Universal Product Code / UPC). Standard versions: EAN-8 (8 digits) and EAN-13 (13 digits). Last digit is check digit.

Worked samples

DuckDB 1.5.5 · finetype 0.6.64

ValueAs VARCHARean_version
59012341234575901234123457EAN-13
9638507496385074EAN-8
40063813339314006381333931EAN-13
Check digit
GS1 mod 10

Shape

Pattern
^[0-9]{8}$|^[0-9]{13}$
ValueLengthShape
590123412345713matches
963850748matches
400638133393113matches
59012341234512rejected: one character short

Told apart

Going the other way, this type's own rule accepts 1 of 3 samples of ISBN.

Background

Origin

In 1974 the U.S.-based Uniform Code Council (UCC) was appointed as administrator of the new Universal Product Code (U.P.C) barcode.[1] In 1977 the European Article Numbering Association (EAN) was established as an international, not-for-profit standards organisation in Brussels, Belgium.[1] The UCC and EAN merged in 2005, creating a single international organisation with 101 local GS1 Member Organisations.[1]

The EAN system has been integrated into the broader Global Trade Item Number (GTIN) standard.[2]

Use

The first three digits usually identify the GS1 Member Organisation the manufacturer joined, but do not necessarily declare where the product is made.[2] So a prefix is a poor guide to a product's country of origin, and it is best not to derive one from it. (Meridian's view)

EAN-13 codes beginning with 0 are 12-digit UPC codes with a 0 prepended.[2] Keep these codes as text: a spreadsheet or numeric column that drops that leading zero turns a valid EAN-13 into a 12-digit string. (Meridian's view) When a file mixes 12- and 13-digit codes, padding the shorter ones with a leading zero is usually the fair way to compare them. (Meridian's view)

The EAN prefix 978, and later 979, has been allocated since the 1980s for books, so that ISBNs can be carried as EANs.[2] The prefix 977 indicates an International Standard Serial Number (ISSN).[2] A 13-digit code starting 978 or 979 is likely a book's ISBN, so check that prefix before you classify a column as general product codes. (Meridian's view)

Where you'll meet it

Open Food Facts describes the code field in its CSV export as the product barcode, which can be EAN-13 or an internal code for some food stores.[3] For products without a barcode, Open Food Facts assigns a number starting with the reserved prefix 200.[3]

Detection notes

v1 migration: Was code.ean. EAN-13 is most common. EAN-8 used for small packages. Check digit via Luhn algorithm (validated in crate).

Use it

CLI · DuckDB
$ finetype infer -i "5901234123457" --mode column
→ identity.commerce.ean

SELECT ft_infer('5901234123457');
-- → 'identity.commerce.ean'
Cast expression
CAST({col} AS VARCHAR)

Schema

https://meridian.online/schemas/identity.commerce.ean · Frictionless type string

finetype taxonomy identity.commerce.ean -o json-schema

Aliases

upc

Type Registry