Barcode

Message Forum

Symbology
Specifications

News

Links

Barcode Printers

Services

Contact Us

Legal Info

Privacy Policy

UPC-A SYMBOLOGY

See Also:   UPC-A    UPC-E    EAN-8    Bookland    UPC 2-Digit Supplement    UPC 5-Digit Supplement    Symbology Index



Quick Links:   Background    Components    Encoding    Encoding Table    Checksum Calculation    Parity Table    Example    JAN Codes

EAN-13 BACKGROUND INFORMATION

EAN-13, based upon the UPC-A standard, was implemented by the International Article Numbering Association (EAN) in Europe. This standard was implemented mostly because the UPC-A standard was not well designed for international use, but probably partly because no-one likes the U.S. to be in charge of anything-especially the Europeans. :)

EAN-13 is a superset of UPC-A. This means that any software or hardware capable of reading an EAN-13 symbol will automatically be able to read an UPC-A symbol. The only difference between EAN-13 and UPC-A is that the number system code in UPC-A is a single digit from 0 through 9 whereas an EAN-13 number system code consists of two digits ranging from 00 through 99, which is essentially a country code. Each country has a numbering authority which assigns manufacturer codes to companies within its jurisdiction. The manufacturer code is still five digits long, as is the product code, and the check digit is calculated in exactly the same way.

    NOTE: Since EAN-13 is a superset of UPC-A and requires very little additional effort to handle than an UPC-A code, it is recommended that all new designs implement EAN-13 rather than UPC-A. As already mentioned, this guarantees compatibility with UPC-A but also will make your software/hardware appealing to the international community. Otherwise your design will be restricted to the U.S. and Canada. Additionally, the UCC Council has announced that as of January 1, 2005, all bar code systems in the U.S. and Canada must be able to handle EAN-13 bar codes so that international manufacturers do not have to worry about printing a different bar code for their products destined for North America.

A typical EAN-13 bar code looks something like this:


The only difference between a UPC-A symbol and an EAN-13 symbol is that the number system code is 2-digits long in EAN-13 as opposed to 1 digit in UPC-A. Visually, the human-readable check digit is placed below the bar code instead of to the right of it, but this does not make any difference, technically speaking, regarding the encoding itself.

    NOTE: In reality, an UPC-A symbol is an EAN-13 symbol with the first number system digit set to 0. For example, take the UPC-A code "075678164125". This same code, expressed as an EAN-13 symbol, would be "0075678164125". As you can see, we just slapped a leading "0" in front. Compare the original UPC-A symbol (top) to the EAN-13 symbol (bottom):


    At first glance, the two bar codes look different. In UPC-A there is a number to the left and right of the bar code (a 0 number system and a 5 check digit), and below the bar code are two groups of 5 digits each (the manufacturer code and the product code). In the EAN-13 symbol, there is no check digit to the right of the bar code, and the numbers below the bar code consist of two groups of 6 digits each.

    However, look closely at the bar codes themselves; that is, look at the bars and spaces the make up the two bar codes. As you can see, the bars and spaces themselves are identical in both UPC-A and EAN-13. The only difference is where the "human-readable" numbers are placed. Logically, if a UPC-A bar code is a subset of EAN-13, the EAN-13 representation of a UPC-A symbol must be identical. As witnessed above, that is the case.

COMPONENTS OF AN EAN-13 BARCODE

An EAN-13 bar code is divided into four areas: 1) The number system, 2) The manufacturer code, 3) the product code, and 4) the check digit. Normally the first number system digit is printed just to the left of the bar code, the second number system digit is printed as the first character of the group of six numbers on the left-hand side below the bar code, the manufacturer code is the next five digits on the left-hand side below the bar code, the product code product code is the first five digits on the right-hand side below the bar code, and the check digit is the last digit on the right-hand side below the bar code.

Number System: The number system consists of two digits (sometimes three digits) which identify the country (or economic region) numbering authority which assigned the manufacturer code. Any number system which starts with the digit 0 is a UPC-A bar code. The valid number system codes are presented in the following table:

    00-13: USA & Canada 20-29: In-Store Functions 30-37: France
    40-44: Germany 45: Japan (also 49) 46: Russian Federation
    471: Taiwan 474: Estonia 475: Latvia
    477: Lithuania 479: Sri Lanka 480: Philippines
    482: Ukraine 484: Moldova 485: Armenia
    486: Georgia 487: Kazakhstan 489: Hong Kong
    49: Japan (JAN-13) 50: United Kingdom 520: Greece
    528: Lebanon 529: Cyprus 531: Macedonia
    535: Malta 539: Ireland 54: Belgium & Luxembourg
    560: Portugal 569: Iceland 57: Denmark
    590: Poland 594: Romania 599: Hungary
    600 & 601: South Africa 609: Mauritius 611: Morocco
    613: Algeria 619: Tunisia 622: Egypt
    625: Jordan 626: Iran 64: Finland
    690-692: China 70: Norway 729: Israel
    73: Sweden 740: Guatemala 741: El Salvador
    742: Honduras 743: Nicaragua 744: Costa Rica
    746: Dominican Republic 750: Mexico 759: Venezuela
    76: Switzerland 770: Colombia 773: Uruguay
    775: Peru 777: Bolivia 779: Argentina
    780: Chile 784: Paraguay 785: Peru
    786: Ecuador 789: Brazil 80 - 83: Italy
    84: Spain 850: Cuba 858: Slovakia
    859: Czech Republic 860: Yugloslavia 869: Turkey
    87: Netherlands 880: South Korea 885: Thailand
    888: Singapore 890: India 893: Vietnam
    899: Indonesia 90 & 91: Austria 93: Australia
    94: New Zealand 955: Malaysia 977: International Standard Serial Number for Periodicals (ISSN)
    978: International Standard Book Numbering (ISBN) 979: International Standard Music Number (ISMN) 980: Refund receipts
    981 & 982: Common Currency Coupons 99: Coupons
Manufacturer Code: The manufacturer code is a unique code assigned to each manufacturer by the numbering authority indicated by the number system code. All products produced by a given company will use the same manufacturer code.

EAN uses what is called "variable-length manufacturer codes." Assigning fixed-length 5-digit manufacturer codes, as the UCC has done until recently, means that each manufacturer can have up to 99,999 product codes--and many manufacturers don't have that many products, which means hundreds or even thousands of potential product codes are being wasted on manufacturers that only have a few products. Thus if a potential manufacturer knows that it is only going to produce a few products, EAN may issue it a longer manufacturer code, leaving less space for the product code. This results in more efficient use of the available manufacturer and procuct codes.

Product Code: The product code is a unique code assigned by the manufacturer. Unlike the manufacturer code, which must be assigned by the UCC, the manufacturer is free to assign product codes to each of their products without consulting any other organization. Since the UCC will already have guaranteed that the manufacturer code is unique, the manufacturer need only make sure that they do not repeat their own product codes.

Check Digit: The check digit is an additional digit used to verify that a bar code has been scanned correctly. Since a scan can produce incorrect data due to inconsistent scanning speed, print imperfections, or a host of other problems, it is useful to verify that the rest of the data in the bar code has been correctly interpreted. The check digit is calculated based on the rest of the digits of the bar code. Normally, if the check digit is the same as the value of the check digit based on the data that has been scanned, there is a high level of confidence that the bar code was scanned correctly. The method of calculating the check digit will be discussed later in this page.

ENCODING EAN-13 (AND UPC-A)

The encoding for EAN-13 (and UPC-A) bar codes is relatively straight-forward. To encode a value as an EAN-13 bar code, the checksum digit must first be calculated and the entire bar code, including check digit, may then be encoded as a sequence of bars and spaces.

    NOTE: Encoding a UPC-A symbol is identical to encoding a EAN-13, a "0" is simply inserted in front of the UPC-A code itself (i.e., if the bar code is 075678164125, a zero is inserted before the code, making the EAN-13 symbol 0075678164125).

COMPUTING THE CHECKSUM DIGIT

Before an EAN-13 symbol may be encoded, the software must compute the correct checksum digit which will be appended to the bar code. The checksum digit is based on a modulo 10 calculation based on the weighted sum of the values of each of the digits in the number system, manufacturer code, and product code. In simple English, that means we must calculate a checksum value for the bar code. First, we take the rightmost digit of the value and consider it to be an "odd" character. We then move right-to-left, alternating between odd and even. We then sum the numeric value of all the even positions, and sum the numeric value multiplied by three of all the odd positions.

The steps for calculating the check digit are as follows:

  1. Consider the right-most digit of the message to be in an "odd" position, and assign odd/even to each character moving from right to left.
  2. Sum the digits in all odd positions, and multiply the result by 3.
  3. Sum the digits in all even positions.
  4. Sum the totals calculated in steps 2 and 3.
  5. The check digit is the number which, when added to the totals calculated in step 4, result in a number evenly divisible by 10.
  6. If the sum calculated in step 4 is evenly disivisible by 10, the check digit is "0" (not 10).
This is easier to understand with an example. Let's calculate the checksum digit for the bar code 0075678164125. Actually, we know the checksum digit is the last digit in the bar code, "5". This means the "message" itself of the bar code is really 007567816412 (we just dropped the last character of the bar code). This represents a number system of "00", a manufacturer code of "75678" and a product code of "16412". Thus, we must calculate a check digit for the message 007567816412.

    Barcode 0 0 7 5 6 7 8 1 6 4 1 2
    Position E O E O E O E O E O E O
    Weighting 1 3 1 3 1 3 1 3 1 3 1 3
    Calculation 0 * 1 0 * 3 7 * 1 5 * 3 6 * 1 7 * 3 8 * 1 1 * 3 6 * 1 4 * 3 1 * 1 2 * 3
    Weighted Sum 0 0 7 15 6 21 8 3 6 12 1 6

Summing up the weighted sum for each digit, we get 0 + 0 + 7 + 15 + 6 + 21 + 8 + 3 + 6 + 12 + 1 + 6 = 85. This is the checksum value. However, there is only one checksum digit. The checksum digit is the value which must be added to the checksum value in order to make it even divisible by 10. In this case, the next number following 85 which is evenly divisible by 10 is the number 90. We must add 5 to 85 to get 90, therefore our check digit is "5". We subsequently append the original bar code message (007567816412) with our newly calculated check digit (5), to arrive at the final value of 0075678164125.

Comparing this with our original bar code, we find that our calculated check digit is in fact the same as the check digit that we found on the bar code. Our calculation, therefore, is correct.

    NOTE: You may be wondering why the first character in the EAN-13 symbol is considered an "even" position and the second is considered "odd," etc. Logic would dictate that the first character be considered "odd" and the second considered "even," etc. Do not dispair, there is a logical reason for this.

    This was done to preserve compatability with the original UPC-A format. The original UPC-A symbol only had a single digit number system, therefore what is the second character of an EAN-13 symbol is what would be considered the first character of an UPC-A symbol, and would therefore be in an "odd" position. Rather than rewriting and confusing the specification, when the EAN-13 standard was defined they simply inserted the new, leading character in front and called it "even" thereby maintaining compatability with existing UPC-A bar codes and, to some extent, with existing UPC-A documentation.

You may use the following EAN-13 Checksum Calculator to calculate the final checksum digit for any EAN-13 bar code. Simply enter the first 12 characters of the bar code in the first field, click the "Calculate" button, and the final checksum digit will appear in the field below. The calculator requires that you have JavaScript enabled.

    Enter EAN-13 message (12 characters):
    Check Digit:

ENCODING THE SYMBOL

Once the checksum digit has been calculated we know the entire message which must be encoded in the bars and spaces. Continuing with our example, we will encode an EAN-13 bar code for the value 0075678164125.

In the following text, we will discuss the encoding of the bar code by considering that the number "1" represents a "dark" or "bar" section of the bar code whereas a "0" represents a "light" or "space" section of the bar code. Thus the numbers 1101 represents a double-wide bar (11), followed by a single-wide space (0), followed by a single-wide bar (1). This would be printed in the bar code as:


An EAN-13 bar code has the following physical structure:

  • Left-hand guard bars, or start sentinel, encoded as 101.
  • The second character of the number system code, encoded as described below.
  • The five characters of the manufacturer code, encoded as described below.
  • Center guard pattern, encoded as 01010.
  • The five characters of the product code, encoded as right-hand characters, described below.
  • Check digit, encoded as a right-hand character, described below.
  • Right-hand guard bars, or end sentinel, encoded as 101.
The characters that are encoded to the left of the center guard pattern are considered the "left hand side" of the symbol whereas all characters encoded to the right of the center guard pattern are considered the "right hand side" of the symbol.

The first character of the EAN-13 number system code (i.e., the first digit of the EAN-13 value) is encoded in the parity of the characters of the left-hand side of the symbol. That is to say, the value of the first character of the EAN-13 value determines the parity with which each of the characters in the left-hand side of the bar code will be encoded from the following table.

    NOTE: For "left-hand encoding", odd and even parity is often referred to as "character set A" (odd) and "character set B" (even).

EAN CHARACTER SET ENCODING TABLE

This table indicates how to encode each digit of an EAN-13 bar code depending on which half (left or right) of the bar code the digit is found in. In the case of a left-hand digit, the encoding (odd or even parity) is based on the value of the first digit of the number system code (see parity encoding table below).

    DIGIT LEFT-HAND ENCODING RIGHT-HAND ENCODING
    ODD PARITY (A) EVEN PARITY (B) ALL CHARACTERS
    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
OBSERVATIONS:

  • An EAN-13 character is represented in 7 elements consisting of 2 bars and 2 spaces. No bar or space may be longer than 4 elements. The only exception to this rule is the left and right guard bars (3 elements each) and the center guard bar (5 elements long).
  • All characters in the left-hand side of the bar code always start with a 0 (space) while all characters in the right-hand side of the bar code always start with a 1 (bar).
  • The "right-hand" encoding pattern is exactly the same as the "left-hand odd" encoding pattern, but with 1's changed to 0's, and 0's changed to 1's.
  • The "left-hand even" encoding pattern is based on the "left-hand odd" encoding pattern. To arrive at the even encoding, work from the left encoding and do the following: 1) Change all the 1's to 0's and 0's to 1. 2) Read the resulting encoding in reverse order (from right to left). The result is the "left-hand even" encoding pattern.

EAN PARITY ENCODING TABLE

The following table indicates the parity with which each character in the left-hand side of the bar code should be encoded. The parity is based on the first digit of the EAN-13 value. For example, our CD had the EAN-13 value of 0075678164125. In this case, the first digit of the number system code is the first digit "0," so the parity would be based on the number 0 in the following table:

    FIRST NUMBER
    SYSTEM DIGIT
    PARITY TO ENCODE WITH
    SECOND NUMBER
    SYSTEM DIGIT
    MANUFACTURER CODE CHARACTERS
    1 2 3 4 5
    0 (UPC-A) Odd Odd Odd Odd Odd Odd
    1 Odd Odd Even Odd Even Even
    2 Odd Odd Even Even Odd Even
    3 Odd Odd Even Even Even Odd
    4 Odd Even Odd Odd Even Even
    5 Odd Even Even Odd Odd Even
    6 Odd Even Even Even Odd Odd
    7 Odd Even Odd Even Odd Even
    8 Odd Even Odd Even Even Odd
    9 Odd Even Even Odd Even Odd
OBSERVATIONS:
  • The second number system digit is always encoded with odd parity (this becomes important at decode-time).
  • A UPC-A bar code always has a first number system digit of zero, and therefore uses exclusively odd parity. In fact, any EAN-13 symbol which has a first number system digit of 0 is actually an UPC-A symbol, not an EAN-13 symbol.
  • All EAN-13 symbols (that have a first number system digit that is non-zero) always have three left-hand characters that are encoded using even parity and two that are encoded using odd parity.
The last two tables are the key and the genius in EAN-13 encoding and its compatability with existing UPC-A symbols.

Consider, for a moment, a UPC-A symbol. As already mentioned, a UPC-A symbol is simply an EAN-13 symbol that has its first number system digit as an "implied" zero. Consulting the parity table above, it is obvious that when the first number system digit is zero, all the characters in the left-hand side of the bar code will be encoded with "odd" parity. That is to say, all UPC-A bar codes use exclusively odd parity. This was the original standard in UPC-A. EAN-13 just expanded on that standard and defined the non-zero characters with other parity patterns. This is what makes UPC-A compatible with EAN-13 (and also what makes EAN-13 incompatible with UPC-A).

ENCODING EXAMPLE

This example will encode the EAN-13 bar code which represents the value "7501031311309". This is number system "75", manufacturer code "01031", product code "31130" (the check digit is "9", but we're going to calculate that in this example). This is the bar code from a 12-ounce can of Pepsi in the country of Mexico.

First, we calculate the check digit:

    Barcode 7 5 0 1 0 3 1 3 1 1 3 0
    Position E O E O E O E O E O E O
    Weighting 1 3 1 3 1 3 1 3 1 3 1 3
    Calculation 7 * 1 5 * 3 0 * 1 1 * 3 0 * 1 3 * 3 1 * 1 3 * 3 1 * 1 1 * 3 3 * 1 0 * 3
    Weighted Sum 7 15 0 3 0 9 1 9 1 3 3 0

Summing the weighted sums we arive at 7 + 15 + 0 + 3 + 0 + 9 + 1 + 9 + 1 + 3 + 3 + 0 = 51. We must add 9 to make 51 evenly divisible by 10 (51 + 9 = 60), therefore the check digit is 9. This matches the trailing "9" that we observed in the bar code, so we calculated it correctly.

Next, we observe that the first digit of the number system code (the left-most digit in the bar code) is the digit "7". Consulting the parity encoding table for the digit "7", we find that the parity for the second number system digit and the manufacturer code should follow the pattern "Odd/Even/Odd/Even/Odd/Even." That means the second number system digit will be encoded from the "left-hand odd" parity table, the first digit of the manufacturer code will be encoded with "left-hand even" parity, etc. We can now start encoding our bar code with the following steps, or sections. The bar code is then constructed by simply concatenating all the strings together.

  1. LEFT GUARD BARS (always the same): 101.
  2. SECOND NUMBER SYSTEM DIGIT [5]: Encoded with left-hand odd parity, 0110001.
  3. 1st MANUFACTURER DIGIT [0]: Encoding with left-hand even parity, 0100111.
  4. 2nd MANUFACTURER DIGIT [1]: Encoded with left-hand odd parity, 0011001.
  5. 3rd MANUFACTURER DIGIT [0]: Encoded with left-hand even parity, 0100111.
  6. 4th MANUFACTURER DIGIT [3]: Encoded with left-hand odd parity, 0111101.
  7. 5th MANUFACTURER DIGIT [1]: Encoded with left-hand even parity, 0110011.
  8. CENTAR GUARD BARS (always the same): 01010.
  9. 1st PRODUCT CODE DIGIT [3]: Encoded as right-hand character, 1000010.
  10. 2nd PRODUCT CODE DIGIT [1]: Encoded as right-hand character, 1100110.
  11. 3rd PRODUCT CODE DIGIT [1]: Encoded as right-hand character, 1100110.
  12. 4th PRODUCT CODE DIGIT [3]: Encoded as right-hand character, 1000010.
  13. 5th PRODUCT CODE DIGIT [0]: Encoded as right-hand character, 1110010.
  14. CHECK DIGIT [9]: Encoded as right-hand character, 1110100.
  15. RIGHT GUARD BARS (always the same): 101.
Remember, a "1" represents a bar and a "0" represents a space. Thus if we convert this string of numbers to their graphical representation we end up with the following bar code:


In order to see more clearly the construction of the bar code, the following graphic shows the exact same bar code but each character, or section, of the bar code is indicated by alternating colors. Above the bar code, in each colored section, is a number from 1 to 15, which corresponds to each of the "steps," or sections, described above. You may easily compare the 1-0 sequence of each step to the graphical representation below:


JAN BACKGROUND INFORMATION

JAN (Japanese Numbering Authority) are EAN codes that use the number system "49".
© Copyright 2006 BarCodeIsland.com, Inc. All Rights Reserved.
Information provided "as-is" without warranty. Please
see details.
Contact us for usage and copy permission.