European Article Number
From Wikipedia, the free encyclopedia
An EAN13 barcode (originally European Article Number) is a barcoding standard which is a superset of the original 12digit Universal Product Code (UPC) system developed in North America. The EAN13 barcode is defined by the standards organisation GS1. The numbers encoded in EAN13 bar codes are product identification numbers which are called Japanese Article Number (JAN) in Japan. All the numbers encoded in UPC and EAN barcodes are known as Global Trade Item Numbers (GTIN), and they can be encoded in other GS1 barcodes.
The EAN13 barcodes are used worldwide for marking products often sold at retail point of sale. The less commonly used EAN8 barcodes are used also for marking retail goods; however, they are usually reserved for smaller items, for example confectionery. The GTIN13 encoded in the bar code has four components:
 GS1 Prefix, the first two or three digits, usually identifying the national GS1 Member Organisation to which the manufacturer is registered (not necessarily where the product is actually made). When the EAN13 symbol encodes a conversion of a 10digit ISBN number, the GS1 Prefix will be 978 or 979 respectively, or 977 for ISSNs.
 Company number, consisting of four, five or six digits depending on number of GTIN13s required by the manufacturer to identify different product lines.
 Item reference, consisting of two to six digits.
 Check digit, a single checksum digit. The check digit is computed modulo 10, where the weights in the checksum calculation alternate 1 and 3. In particular, since the weights are relatively prime to 10 the EAN system will detect all single digit errors. But since the difference of consecutive weights is even, the EAN system does not detect all adjacent transposition errors.
The complete number is used as a reference key to look up information about the product line held on a database; the number is never normally broken down into its components within users' systems.
2digit (EAN 2) and 5digit (EAN 5) supplemental barcodes may be added for a total of 14 or 17 data digits. These are generally used for periodicals (to indicate the serial number) and books (to indicate the selling price) respectively.
Contents 
[edit] GS1 Prefixes
The first two or three digits of the GTIN of any product identify the GS1 Member Organisation which the manufacturer has joined. Note that EAN13 codes beginning with 0 are rarely used, as this is just an addition to a 12digit UPC. Since most scanners and registers worldwide can read both equally, most manufacturers in North America still only use UPC.
[edit] Encoding EAN13
To encode an EAN13 barcode, the digits are first split into 3 groups, the first digit, the first group of 6 and the last group of 6. The first group of six is encoded using a scheme whereby each digit has two possible encodings, one of which has even parity and one of which has odd parity. The first digit is encoded by selecting a pattern of choices between these two encodings for the next six digits, according to the table below. (Unlike the other digits, the first digit is not represented directly by a pattern of bars.) All digits in the last group of six digits are encoded using a single set of patterns which are the same patterns used for UPC.
If the first digit is zero, all digits in the first group of six are encoded using the patterns used for UPC, hence a UPC barcode is also an EAN13 barcode with the first digit set to zero.
First digit  First group of 6 digits  Last group of 6 digits 

0  LLLLLL  RRRRRR 
1  LLGLGG  RRRRRR 
2  LLGGLG  RRRRRR 
3  LLGGGL  RRRRRR 
4  LGLLGG  RRRRRR 
5  LGGLLG  RRRRRR 
6  LGGGLL  RRRRRR 
7  LGLGLG  RRRRRR 
8  LGLGGL  RRRRRR 
9  LGGLGL  RRRRRR 
Digit  Lcode  Gcode  Rcode 

0  0001101  0100111  1110010 
1  0011001  0110011  1100110 
2  0010011  0011011  1101100 
3  0111101  0100001  1000010 
4  0100011  0011101  1011100 
5  0110001  0111001  1001110 
6  0101111  0000101  1010000 
7  0111011  0010001  1000100 
8  0110111  0001001  1001000 
9  0001011  0010111  1110100 
Note: Entries in the Rcolumn are bitwise complements of the respective entries in the Lcolumn. Entries in the Gcolumn are the entries in the Rcolumn reversed. See pictures of all codes against a colored background.
[edit] Checksum calculation
The checksum is calculated taking a varying weight value times the value of each number in the barcode to make a sum. The resulting sum modulo 10 (i.e. the last digit) is subtracted from 10, and the result is used as checksum digit (If the new result is 10, then zero is used instead).
[edit] Weight
The weight for a specific position in the EANcode is either 3 or 1. An EAN18 code starts with a weight of 3. All other valid EANcodes get their weight values for the position of the code from this table making their code line up to the right:
1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17 
3  1  3  1  3  1  3  1  3  1  3  1  3  1  3  1  3 
[edit] Calculation
Taking the numbers from an EAN 8 code we get: 7351353 or in the table:
Position  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17 
Weight  3  1  3  1  3  1  3  1  3  1  3  1  3  1  3  1  3 
Code  7  3  5  1  3  5  3  
Sums  21  3  15  1  9  5  9 
The sum from this barcode is then: 63
63 modulo 10 = 3
10 minus 3 makes the checksum = 7
The complete EAN 8 code is then: 73513537
[edit] See also
 Electronic Data Interchange
 Global Electronic Party Information Register (GEPIR) a searchable distributed database of GS1 GTINs
 GTIN
 EAN 8, another form of EAN barcode
[edit] External links
 upcdatabase, another online barcode database
 Barcode Perl modules at CPAN
 An exemple of EAN8/13 implementation
 EAN MediaWiki extension, a MediaWiki extension, visualizing EAN13/EAN8/UPCA/Code39/Codabar barcodes by specifying only the numbers/symbols in the wikitext.
