EAN-13 structure and parity: how 13 digits fit in a 12-position symbol

The 95-module EAN-13 envelope, the L/G/R encoding tables, and the parity scheme that encodes the 13th digit without printing it. Includes the full G-code table, the left-half parity-pattern lookup, a worked decode of 5901234123457, and how the GS1 prefix system is assigned.

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. The scanner recovers it from the parity choices made across the six left-side digits.

This page covers the 95-module envelope, the L, G and R encoding tables (including the full G-code table, which only EAN-13 uses), the left-half parity lookup that encodes the leading digit, a worked decode of 5901234123457, and how the GS1 prefix system is assigned. 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.

PositionRole
1First digit of the GS1 Prefix. Not printed as a bar pattern. Encoded only via left-half parity.
1-3GS1 Prefix (3 digits).
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.
13Mod-10 check digit.

The variable-length GS1 Company Prefix. Every barcode reference written before about 2005 will tell you EAN-13 is 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 4 to 12 digits long, with the item reference filling whatever positions remain. A small brand might receive a 12-digit prefix and 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 for every GTIN whose prefix is not 7 digits long. Use the Verified by GS1 lookup to check who owns a prefix.

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.

Asymmetric quiet zones. EAN-13 specifies 11X minimum on the left and 7X minimum on the right, where UPC-A specifies a symmetric 9X + 9X. The wider left zone is where the leading digit is printed in the human-readable line.

X-dimension and height. Nominal X at 100% magnification is 0.330 mm. The permitted range is 0.264-0.660 mm, corresponding to magnification factors of 80% to 200%. Symbol height at 100% is 25.93 mm with the human-readable line, and bar height is 22.85 mm. The left, centre and right guard bars extend a further 5X below the data-bar baseline, which gives EAN-13 the notched profile that tells it apart from a truncated UPC-A.

The L, G and R encoding tables

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.

DigitL
00001101
10011001
20010011
30111101
40100011
50110001
60101111
70111011
80110111
90001011

G-code (left set B, even parity) - unique to EAN-13

UPC-A has no G set, so this table appears only in EAN-13 references. 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 what encodes the leading digit.

DigitG
00100111
10110011
20011011
30100001
40011101
50111001
60000101
70010001
80001001
90010111

R-code (right side, even parity)

Identical to the UPC-A right side. Brief here; full table in the UPC-A reference.

DigitR
01110010
51001110
91110100

Properties of the three sets

  • L is odd parity (odd number of 1 bits per character).
  • G is even parity (even number of 1 bits).
  • R is even parity.
  • R is the bitwise complement of L. For digit 0, L is 0001101 and its complement 1110010 is R. This holds for all 10 digits.
  • G is the bit-reverse of R (equivalently, the bit-reverse of the complement of L). For digit 0, R is 1110010 and reversed it is 0100111, which is G. This holds for all 10 digits.

G is the bit-reverse of R, which is the bit-complement of L, so two operations are involved. Bit-reversing L directly produces 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 in this table.

Leading digitLeft-half parity (positions 2..7)
0L L L L L L
1L L G L G G
2L L G G L G
3L L G G G L
4L G L L G G
5L G G L L G
6L G G G L L
7L G L G L G
8L G L G G L
9L G G L G L

The shape of the table comes from UPC-A compatibility.

  1. 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 a UPC-A scanner expects to see. The bar geometry is identical to UPC-A, so the same scanner optics read both symbols.
  2. 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 bit-level reason UPC-A is EAN-13 with a leading zero.

Worked decode of 5901234123457 (GS1 Poland)

This is the EAN-13 used in our check digit walkthrough, a valid EAN-13 with the GS1 Poland prefix 590. The 13 digits are 5 9 0 1 2 3 4 1 2 3 4 5 7, leading digit 5.

Leading digit 5 maps to L G G L L G in the parity table. Apply that pattern to the six left-side digits (9 0 1 2 3 4).

Symbol positionDigitParityCodeBits
29LL90001011
30GG00100111
41GG10110011
52LL20010011
63LL30111101
74GG40011101

The right-side digits (1 2 3 4 5 7) are all R-codes.

Symbol positionDigitCodeBits
81R11100110
92R21101100
103R31000010
114R41011100
125R51001110
137R71000100

Concatenating the guards and the twelve characters gives the full 95-module symbol.

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 1977 only about 200 North American stores had installed UPC scanners, but the UPC-A format was fixed. The European Article Numbering Association, founded in Brussels in 1977, had to choose between standardising on a different symbology and extending UPC. They extended.

The design had to keep the 95-module envelope, keep the L and R sets unchanged, add a 13th digit, and stay readable by existing UPC scanners. The EAN designers added one extra encoding set (G), made G the bit-reverse of R, and used the parity choice across the six left-side characters as a lookup key for the new digit. Recovering the 13th digit needs only a parity lookup on the six left-side characters, with no change to the bar geometry.

What the GS1 prefix means

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, and 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 prefix is often read as a country-of-origin code, and that reading is wrong. Any app or browser extension that claims to tell you where a product was made from its barcode is wrong on the same point. GS1's own prefix list page says as much.

Selected prefix ranges.

PrefixIssued by / used for
001-019, 030-039, 060-139GS1 US (and historically the UCC)
020-029, 040-049, 200-299Restricted Circulation Numbers, meaningful only within the store or company that printed them
300-379GS1 France
400-440GS1 Germany
450-459, 490-499GS1 Japan
500-509GS1 UK
590GS1 Poland (the worked-example prefix above)
680-681, 690-699GS1 China
754-755GS1 Canada
800-839GS1 Italy
880-881GS1 South Korea
890GS1 India
950GS1 Global Office
977ISSN (serial publications)
978-979ISBN ("Bookland") and ISMN (sheet music, 979-0 sub-range)
980Refund receipts
981-984GCN coupons (common currency)
990-999GS1 coupon identification

For the full prefix list 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, at the deli, the bakery counter or 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 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.

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 codes alongside 12-digit UPC-A. After Sunrise the 12-vs-13 distinction collapsed at the symbol layer, because 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 replaced UPC-A, and new product introductions there 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 the UPC vs EAN guide. The deeper UPC-A treatment is in the UPC-A complete reference.

ISBN-13 as a special case of EAN-13

An ISBN-13 is 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 different check digit algorithms. ISBN-10 is a mod-11 check with descending weights 10..1 and the symbol X for remainder 10, and ISBN-13 inherits the EAN-13 mod-10 check. Once 978 ran out the transition was forced, because a 979-prefixed ISBN has no ISBN-10 equivalent, so publishers had to migrate or lose 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

MistakeCorrection
"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 wider left zone holds the printed leading digit.
"G-code is the bit-reverse of L-code."G is the bit-reverse of R, which is itself the bit-complement of L.
"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, meaningful only within the store or company that printed them. 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 4 to 12 digits. Code that splits a GTIN by fixed position to extract manufacturer and item is wrong for every GTIN whose prefix is not 7 digits long.
"ISBN-10 and ISBN-13 use the same check digit."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.

Based on GS1 General Specifications Release 26.0, ISO/IEC 15420:2025, and the International ISBN Agency's transition guidance.

Try it

More guides