EAN-13 carries 13 digits in a barcode that physically encodes only 12 of them. The 13th - the leading digit - is not drawn as bars at all. It is recovered by the scanner from the parity choices made across the six left-side digits. This is one of the cleanest backwards-compatible extensions in any commercial standard, and it is the part of EAN-13 that most reference material glosses over.
This page is the structural and parity reference: the 95-module envelope, the L/G/R encoding tables (including the full G-code table, which is unique to EAN-13), the left-half parity lookup that encodes the leading digit, a worked decode of 5901234123457, and the GS1 prefix nuances most articles skip. For the mod-10 check digit, see the EAN-13 check digit guide. For the UPC-A side of the family, see the UPC-A complete reference.
The 13 digits and the variable-length prefix
A canonical EAN-13 carries 13 decimal digits, left to right:
| Position | Role |
|---|---|
| 1 | First digit of the GS1 Prefix. Not printed as a bar pattern - encoded only via left-half parity. |
| 1-2 or 1-3 | GS1 Prefix (most prefixes are 3 digits; some 2-digit groups exist for ISBN/ISSN ranges). |
| 4-12 (variable) | Continuation of the GS1 Company Prefix plus the item reference. The split between them depends on the prefix length the brand owner was issued. |
| 13 | Mod-10 check digit. |
The variable-length GS1 Company Prefix. Every barcode reference written before about 2005 will tell you EAN-13 is structured as a fixed 7-digit company prefix plus a 5-digit item reference plus a check digit. That model is dead. GS1 today issues Company Prefixes from 6 to 12 digits long, with the item reference filling whatever positions remain. A small brand might receive a 12-digit prefix and effectively zero item slots (one GTIN per prefix); a global brand with thousands of SKUs might receive a 6-digit prefix and 6 item digits. Code that splits a GTIN by fixed position to extract "manufacturer" and "item" is wrong on a measurable fraction of real-world GTINs. Use the GS1 GEPIR API for ownership lookup; do not parse positions.
The 95-module structure
EAN-13 uses the same physical envelope as UPC-A: 95 modules of equal width, organised as 3 + 42 + 5 + 42 + 3.
QZ (>=11X) | LG (3) | L1..L6 (42) | CG (5) | R1..R6 (42) | RG (3) | QZ (>=7X)
| 101 | 6 digits x 7 | 01010 | 6 digits x 7 | 101 |
3 + 42 + 5 + 42 + 3 = 95 modules
Six left-side digits, six right-side digits. Twelve bar-pattern characters in total. The leading 13th digit is implicit in left-half parity, not present as a bar pattern.
Asymmetric quiet zones. EAN-13 specifies 11X minimum on the left and 7X minimum on the right. This is unlike UPC-A's symmetric 9X + 9X. The asymmetry is a giveaway about the parity-decoding step: the scanner needs more lead-in margin on the side where parity matters, because it has to lock the L/G sequence cleanly before the centre guard.
X-dimension and height. Nominal X at 100% magnification is 0.330 mm. Permitted range 0.264-0.660 mm, corresponding to magnification factors 80% to 200%. Symbol height at 100% is 25.93 mm with the human-readable line; bar height is 22.85 mm. Left, centre, and right guard bars extend an additional 5X below the data-bar baseline, creating the characteristic notched profile that makes EAN-13 visually distinct from a truncated UPC-A. Source: GS1 General Specifications (current v25), ISO/IEC 15420.
L, G, and R: three encoding tables, one digit value
Each digit is encoded across 7 modules. 0 is a light module (space), 1 is a dark module (bar). Where UPC-A uses two patterns per digit (L on the left, R on the right), EAN-13 uses three: L and G both appear on the left, R on the right.
L-code (left set A, odd parity)
Identical to the UPC-A left side. Reproduced briefly here; the full table is in the UPC-A reference.
| Digit | L |
|---|---|
| 0 | 0001101 |
| 1 | 0011001 |
| 2 | 0010011 |
| 3 | 0111101 |
| 4 | 0100011 |
| 5 | 0110001 |
| 6 | 0101111 |
| 7 | 0111011 |
| 8 | 0110111 |
| 9 | 0001011 |
G-code (left set B, even parity) - unique to EAN-13
This is the table you cannot find in a UPC-A reference, because UPC-A does not have one. G is the bit-reverse of the R-code (which is itself the bit-complement of L). G shares a digit value with L but has the opposite parity, and that parity difference is the lever the leading-digit encoding pulls.
| Digit | G |
|---|---|
| 0 | 0100111 |
| 1 | 0110011 |
| 2 | 0011011 |
| 3 | 0100001 |
| 4 | 0011101 |
| 5 | 0111001 |
| 6 | 0000101 |
| 7 | 0010001 |
| 8 | 0001001 |
| 9 | 0010111 |
R-code (right side, even parity)
Identical to the UPC-A right side. Brief here; full table in the UPC-A reference.
| Digit | R |
|---|---|
| 0 | 1110010 |
| 5 | 1001110 |
| 9 | 1110100 |
Properties of the three sets
- L is odd parity (odd number of
1bits per character). - G is even parity (even number of
1bits). - R is even parity.
- R is the bitwise complement of L. Digit 0: L =
0001101, complement =1110010= R. Holds for all 10 digits. - G is the bit-reverse of R (equivalently, the bit-reverse of the complement of L). Digit 0: R =
1110010, reversed =0100111= G. Holds for all 10 digits.
Some non-primary references claim "G is the bit-reverse of L." That is wrong. G is the bit-reverse of R, which is the bit-complement of L - two operations, not one. The composition matters: bit-reverse of L would produce a different table.
The implicit 13th digit via left-half parity
The leading digit of an EAN-13 is not a bar pattern. It is encoded by the choice, for each of the six left-side digits, of whether to use the L-code or the G-code. The scanner reads the parity of each left-side character (odd = L, even = G), assembles the 6-character L/G sequence, and looks it up:
| Leading digit | Left-half parity (positions 2..7) |
|---|---|
| 0 | L L L L L L |
| 1 | L L G L G G |
| 2 | L L G G L G |
| 3 | L L G G G L |
| 4 | L G L L G G |
| 5 | L G G L L G |
| 6 | L G G G L L |
| 7 | L G L G L G |
| 8 | L G L G G L |
| 9 | L G G L G L |
Two structural rules force the table to look the way it does:
- Position 2 (the first left-half character) is always L. Every row in the table starts with L. This guarantees the symbol begins with an odd-parity character immediately after the left guard - which is what an existing UPC-A scanner expects to see. A 1976 EAN-13 symbol could be read by a 1974 UPC-A scanner without any hardware change.
- Leading digit 0 maps to LLLLLL. An EAN-13 with leading digit 0 uses L-codes for all six left-side digits, making it bit-identical to a UPC-A symbol carrying the same trailing 12 digits. This is the literal, bit-level reason "UPC-A is just EAN-13 with a leading zero."
Worked decode: 5901234123457 (GS1 Poland)
This is the canonical EAN-13 used in our check digit walkthrough - a real, valid GS1 Poland (prefix 590) example. The 13 digits are 5 9 0 1 2 3 4 1 2 3 4 5 7, leading digit 5.
Look up leading digit 5 in the parity table: L G G L L G. Apply that pattern to the six left-side digits (9 0 1 2 3 4):
| Symbol position | Digit | Parity | Code | Bits |
|---|---|---|---|---|
| 2 | 9 | L | L9 | 0001011 |
| 3 | 0 | G | G0 | 0100111 |
| 4 | 1 | G | G1 | 0110011 |
| 5 | 2 | L | L2 | 0010011 |
| 6 | 3 | L | L3 | 0111101 |
| 7 | 4 | G | G4 | 0011101 |
The right-side digits (1 2 3 4 5 7) are all R-codes:
| Symbol position | Digit | Code | Bits |
|---|---|---|---|
| 8 | 1 | R1 | 1100110 |
| 9 | 2 | R2 | 1101100 |
| 10 | 3 | R3 | 1000010 |
| 11 | 4 | R4 | 1011100 |
| 12 | 5 | R5 | 1001110 |
| 13 | 7 | R7 | 1000100 |
Concatenated, the full 95-module symbol is:
101 0001011 0100111 0110011 0010011 0111101 0011101 01010 1100110 1101100 1000010 1011100 1001110 1000100 101
To decode, a scanner reads the bars, splits on the centre guard, computes the parity of each left-side character (odd or even number of 1 bits), assembles the L/G sequence, looks up the leading digit, then concatenates all 13 digits and runs the mod-10 check.
Why the design works this way
By 1976, North American supermarkets had already deployed tens of thousands of UPC-A scanners. The European Article Numbering Association (founded as the IAN Council in Brussels in 1977) faced a choice: standardise on a different symbology, or extend UPC. They extended.
The constraint was four-way: keep the 95-module envelope, keep the L and R sets unchanged, add a 13th digit, and remain readable by existing UPC scanners. A different team would have spent a decade arguing about this. The IAN team's solution: add one extra encoding set (G), make G the bit-reverse of R so it slots into existing scan-line algorithms, and use parity choice across the six left-side characters as a lookup key for the new digit. The optical scanner needed no hardware change. Existing UPC scanners were software-upgraded to recognise even-parity characters on the left side, decode the parity sequence, and recover the 13th digit.
This is the most elegant piece of barcode engineering ever standardised. Backwards compatibility this clean is rare.
The GS1 prefix system: what the leading digits actually mean
The first 2-3 digits of an EAN-13 identify the GS1 Member Organisation that issued the company prefix to the brand owner. They do not identify the country of manufacture. They do not identify where the product is sold. A UK company with a 50- prefix may label products manufactured in Vietnam and sold globally. A German company with a 40- prefix may sell products made in China.
The most common consumer-facing barcode misconception is that the prefix is a country-of-origin code. It is not. "Buy local" browser extensions, authenticity-checker apps, and many supermarket loyalty programs are wrong on this point. GS1 itself has to repeatedly clarify this on its prefix-list page.
Selected prefix ranges:
| Prefix | Issued by / used for |
|---|---|
| 000-019, 030-039, 060-139 | GS1 US (and historically the UCC) |
| 020-029, 040-049, 200-299 | Restricted Circulation Numbers - locally meaningful only, not globally unique |
| 300-379 | GS1 France |
| 400-440 | GS1 Germany |
| 450-459, 490-499 | GS1 Japan |
| 500-509 | GS1 UK |
| 590 | GS1 Poland (the worked-example prefix above) |
| 690-699 | GS1 China |
| 754-755 | GS1 Canada |
| 800-839 | GS1 Italy |
| 880 | GS1 South Korea |
| 890 | GS1 India |
| 950 | GS1 Global Office |
| 977 | ISSN (serial publications) |
| 978-979 | ISBN ("Bookland") and ISMN (sheet music, 979-0 sub-range) |
| 980 | Refund receipts |
| 981-984 | GCN coupons (common currency) |
| 99 | GS1 coupon identification (legacy) |
For the full prefix list (~110 entries) refer to the GS1 Member Organisation directory.
Restricted Circulation Numbers
The prefixes 02, 04, 20-29, and 200-299 are Restricted Circulation Numbers (RCNs). They are not globally unique GTINs. A retailer who packages meat or produce in-store - the supermarket deli, the bakery counter, the butcher - typically prints labels using a 02- or 2- prefix. The remaining digits encode the item plus a price or weight that is meaningful only at that store.
A 2- code printed at one supermarket can collide with a different product at another supermarket. The codes are deliberately not globally registered. They exist so that variable-measure items - which by definition cannot have a fixed GTIN, because the price changes with weight - can still flow through the same POS systems as standard scanned products.
The same RCN principle applies to the 040-049 range, which retailers and brands use for company-internal identifiers that should never reach a public POS. If your scanned data contains 02-, 04-, or 2-prefixed codes, you are almost certainly looking at in-store-packaged or company-internal items, not regular GTINs that you can look up in any database.
EAN-13 vs UPC-A after Sunrise 2005
The Sunrise 2005 project, jointly announced by the Uniform Code Council (now GS1 US) and ECCC (now GS1 Canada) in 1997 and effective January 1, 2005, required all North American POS systems and trading-partner item-master systems to scan and process 13-digit EAN-13 (and 14-digit GTIN-14) codes alongside 12-digit UPC-A. After Sunrise, the 12-vs-13 distinction collapsed at the symbol layer: every NA scanner reads either format.
UPC-A persists in North America largely because of item-master inertia. Decades of artwork files, label-printing software defaults, and POS data-entry forms were locked to 12 digits, and migrating them all to 13 has near-zero benefit for a product that will never ship outside NA. Outside North America, EAN-13 has effectively replaced UPC-A globally. New product introductions outside NA almost always use EAN-13 directly.
If your product has any chance of international distribution, print EAN-13 from day one. The detailed buy-or-print decision is in UPC vs EAN: which do I need. The deeper UPC-A treatment is in the UPC-A complete reference.
ISBN-13: a special case of EAN-13
An ISBN-13 is literally an EAN-13 with prefix 978 or 979. The 978 prefix - sometimes called the "Bookland" prefix - was assigned to the publishing industry in the 1980s, well before ISBN itself moved to 13 digits, so that books could carry an EAN barcode while still using their own 10-digit identifier internally. 979 was added later as 978 approached exhaustion.
On January 1, 2007, ISBN officially moved to 13 digits. ISBN-10 and ISBN-13 use completely different check digit algorithms: ISBN-10 is a mod-11 check with descending weights 10..1 and the symbol X for remainder 10; ISBN-13 inherits the EAN-13 mod-10 check. The 2007 transition was effectively forced once 978 ran out: 979-prefixed ISBNs have no ISBN-10 equivalent, so the publishing industry had to migrate or accept the loss of the legacy 10-digit identifier for new books. ISMN (International Standard Music Number, for printed sheet music) uses the 979-0 sub-range of 979.
Common mistakes
| Mistake | Correction |
|---|---|
| "EAN-13 has 13 bar patterns." | It has 12. The 13th (leading) digit is encoded only via the L-vs-G parity choice across the six left-side digits. |
| "The first digit tells me the country of origin." | The prefix identifies the GS1 Member Organisation that issued the company prefix to the brand owner. The product can be manufactured anywhere. |
| "Leading 0 means made in USA." | Leading 0 means GS1 US issued the company prefix. Companies with US prefixes manufacture products globally. |
| "EAN-13 quiet zones are symmetric like UPC-A's." | 11X minimum on the left, 7X minimum on the right. The left needs more lead-in margin for the parity decoder. |
| "G-code is the bit-reverse of L-code." | G is the bit-reverse of R, which is itself the bit-complement of L. Two operations, not one. |
| "L, G, and R all use even parity." | L is odd parity. G and R are even parity. The L vs G parity difference is what encodes the 13th digit. |
| "02 and 200-299 are country codes." | They are Restricted Circulation Numbers. Locally meaningful, not globally unique. Used for in-store-packaged variable-measure items, coupons, and company-internal identifiers. |
| "EAN-13 = 7-digit company prefix + 5-digit item." | The company prefix is variable from 6 to 12 digits. Code that splits a GTIN by fixed position to extract manufacturer and item is wrong on a measurable fraction of real GTINs. |
| "ISBN-10 and ISBN-13 use the same check digit." | Completely different algorithms. ISBN-10 is mod-11 with descending weights and an X symbol for remainder 10; ISBN-13 is the standard EAN-13 mod-10 check. |
To generate a verified EAN-13, use the EAN-13 generator. For bulk encoding from a CSV, use the EAN-13 batch tool.
Last verified against GS1 General Specifications v25.0, ISO/IEC 15420:2009, and the International ISBN Agency's transition guidance, on 2026-04-28.