The EAN-13 barcode is the best-known barcode in the world — it appears on almost every product in the supermarket. But what is behind the 13 digits? How is the code structured, how do you calculate the check digit, and where do you get valid EAN numbers? This article explains EAN-13 from the ground up and shows how to create and decode an EAN code.
At a glance
- What: a 13-digit numeric barcode managed by GS1 (modern term: GTIN-13)
- Structure: country prefix + company number + item number + check digit
- Germany: prefixes 400–440 (issued by GS1 Germany)
- Check digit: the 13th digit, calculated from the first 12
- Valid EANs: officially only through GS1 membership
What Is an EAN-13?
EAN stands for European Article Number, now referred to internationally as the International Article Number. The EAN-13 is a 13-digit numeric barcode managed by the standards body GS1. In modern GS1 terminology it is called a GTIN-13 (Global Trade Item Number) — both terms mean the same thing.
Its job is to identify every retail product worldwide unambiguously. When the checkout scans the code, the inventory system uses the number to look up the matching item with its price and name. Unlike Code 128, EAN-13 encodes digits only and has a fixed length — which makes it simple but inflexible. For a more flexible barcode, see our article Code 128 explained.
The Structure of an EAN-13 Code
The structure of an EAN-13 divides the 13 digits into four logical blocks:
- GS1 prefix (usually the first 3 digits): identifies the GS1 member organization that issued the code.
- Company number (base number): the unique number of the company that obtained the code from GS1.
- Item number: assigned freely by the company to distinguish its individual products.
- Check digit (the 13th digit): a calculated control digit.
How long the company and item numbers are depends on how many products a company manages. A company with many items gets a shorter base number and more digits for items — and vice versa.
The Clever Role of the First Digit
A technical detail worth knowing: the first of the 13 digits is not represented as its own bars at all. Instead, it is encoded through the parity pattern of the left-hand six digits. EAN-13 uses two character sets (A and B) in a specific order, from which the scanner reconstructs the first digit. The right-hand six digits use a third set (C). Between them sit separators — the guard bars at the start, middle, and end. This clever solution makes it possible to fit 13 digits into a symbol that physically has room for only twelve.
Country Prefixes: What Do 400–440 Mean?
The GS1 prefix is often confused with the country of origin. For Germany, GS1 Germany issues prefixes 400 to 440. But here's the key point: the prefix only shows which GS1 organization issued the code — not where the product was made. A product with a German prefix can well have been manufactured in Asia.
| Prefix | GS1 organization |
|---|---|
| 000–019, 030–039 | USA / Canada |
| 300–379 | France |
| 400–440 | Germany |
| 760–769 | Switzerland |
GS1 maintains a complete list of all prefixes.
How to Calculate the EAN-13 Check Digit
The 13th digit is a check digit calculated from the first twelve digits. Here is how:
- Number the first twelve digits from the left, positions 1 to 12.
- Add up all digits in the odd positions (1, 3, 5, 7, 9, 11).
- Add up all digits in the even positions (2, 4, 6, 8, 10, 12) and multiply that sum by 3.
- Form the total of both values.
- The check digit completes this total to the next multiple of 10 — that is, (10 − (total mod 10)) mod 10.
Worked Example: 4006381333931
Let's verify the code 4006381333931. The first twelve digits are 400638133393:
- Odd positions (1, 3, 5, 7, 9, 11): 4 + 0 + 3 + 1 + 3 + 9 = 20
- Even positions (2, 4, 6, 8, 10, 12): 0 + 6 + 8 + 3 + 3 + 3 = 23, times 3 = 69
- Total: 20 + 69 = 89
- Check digit: (10 − (89 mod 10)) mod 10 = (10 − 9) mod 10 = 1
The calculated check digit is 1 — exactly the 13th digit of the code. If it doesn't match, the code is invalid.
Decoding an EAN-13
To decode an EAN-13 usually means understanding its parts: prefix, company number, item number, and check digit. However, the exact boundary between the company and item number cannot be reliably read from the outside, because it varies with each GS1 assignment. Only the prefix (first digits) and the check digit (last digit) are clearly identifiable. To find out which company a code belongs to, you can query the official "Verified by GS1" database.
Where Do I Get Valid EAN Numbers?
This is the most important question — and where most mistakes happen. An EAN you intend to use in retail must be globally unique. There are two routes:
- Officially via GS1: you become a member and receive a company prefix from which you build your own GTINs. This is the only route accepted by all major retail chains and marketplaces. GS1 charges fees based on turnover and the number of codes needed.
- Via resellers: single barcodes are sold cheaply online. They work technically, but GS1 explicitly warns that such numbers are not uniquely assigned to your company and may be rejected by retailers like Amazon or large chains.
Rule of thumb: for serious distribution, there is no way around the official GS1 route. For purely internal purposes — your own warehouse without sales — you may use any numbers and do not need GS1 membership.
What About Barcodes on Books?
Books also use an EAN-13 barcode in practice, but with a specific numbering logic: the ISBN-13 is represented as a Bookland EAN. The number usually starts with 978 or 979, followed by the ISBN structure, and ends with the normal EAN-13 check digit.
The printed ISBN and the scannable barcode belong together, but they should not be invented freely. If you publish a book for regular distribution, you obtain the ISBN from the responsible ISBN agency. From that ISBN, you can generate the EAN-13 barcode for the cover, checkout systems and inventory workflows. For internal library or warehouse labels, Code 128 may be a better fit when you need letters, shelf marks or custom identifiers in addition to numbers.
How to Create an EAN-13
Once you have a valid 13-digit number (or use an internal number), all that's left is the barcode image. An EAN generator does the work for you: you enter the twelve data digits, the tool calculates the check digit automatically and produces the finished, scannable symbol. This avoids check-digit errors — the most common cause of invalid codes. You can create an EAN code for free with our barcode generator.
EAN-13, EAN-8, and UPC — The Differences
| Format | Digits | Region / purpose |
|---|---|---|
| EAN-13 | 13 | standard in retail worldwide |
| EAN-8 | 8 | small packaging with little space |
| UPC-A | 12 | US counterpart (GTIN-12), backward-compatible with EAN-13 |
Modern scanners read all three formats without issue. An EAN-13 is essentially a UPC-A with one extra leading digit.
Frequently Asked Questions About EAN-13
How do I calculate the EAN-13 check digit? Add the odd positions, multiply the even positions by 3, sum both, and complete to the next ten. A generator does this automatically.
Do I need GS1 membership for an EAN code? For official retail sales, yes. For internal labeling without sales, no.
Does the prefix indicate the country of origin? No. It only shows the issuing GS1 organization, not the place of manufacture.
What is the difference between EAN-13 and GTIN-13? They are the same — GTIN-13 is the modern GS1 term for the EAN-13.
Conclusion
EAN-13 is simple to use but thoughtfully designed in detail: 13 digits, a cleverly hidden first digit, and a check digit that prevents read errors. The key is not creating the image — any EAN generator does that in seconds — but the question of valid numbers. If you want to sell, go through GS1; if you label internally, you're free. With this knowledge you can create and decode any EAN-13 with confidence.