EAN-13 and the check digit
In short: The EAN-13 consists of 13 digits. The last one is a check digit that lets the scanner detect reading errors. The first digits reveal the country of the issuer, not of the product.
In more detail: The numbers are issued by GS1 (in Germany GS1 Germany). Structure: country prefix (e.g. 400–440 for Germany), company number, item number, check digit.
In detail
Calculating the check digit:
- Take the first 12 digits from the left.
- Multiply digits at odd positions (1st, 3rd, 5th …) by 1 and at even positions (2nd, 4th …) by 3.
- Add everything.
- Check digit = (10 − (sum mod 10)) mod 10.
Example 400638133393 → 4·1+0·3+0·1+6·3+3·1+8·3+1·1+3·3+3·1+3·3+9·1+3·3 = 4+0+0+18+3+24+1+9+3+9+9+9 = 89, 89 mod 10 = 9, check digit 10−9 = 1 → 4006381333931.
- EAN-8: short form for small packages.
- UPC-A: 12 digits, treated as EAN-13 with a leading 0.
- ISBN-13: books use EAN-13 with prefix 978 or 979.
- Databases: Open Food Facts and others look up products by this number (GTIN).
- GTIN: the umbrella term for EAN/UPC numbers.
See also: Barcode types at a glance, Barcode scanners: technology and types