UPC/UPC-A/UPC-E & EAN Barcode Symbology


Crifan Li


This article explains the details of UPC symbology and other related UPC-A, UPC-E and EAN.

[Note] This article provide multiple formats:
Download(7Zip package) HTML HTMLs PDF CHM TXT RTF

HTML version online address:


Any question or bug report are encouraged to post in the discussion group:



Revision History
Revision 1.0 2011-07-12 crl
  1. explain the UPC and related UPC-A, UPC-E and EAN symboloy
Revision 1.1 2012-08-09 crl
  1. Release via Docbook

Table of Contents

1. Plessey
1.1. Barcode Basic Knowledge
1.2. What is UPC
1.3. Application Field
1.4. Example
1.5. Technical Detail
1.5.1. Bit Pattern of Digit Mirrored Bit Pattern Design
1.5.2. Check Digit Calculation
1.5.3. Prefixes
2. Zero-Compressed UPC ⇒ UPC-E
3. Printing Considerations
3.1. Dimensions
3.2. Quiet Zone (Light Margin)
3.3. Barcode Text
4. EAN & IAN, EAN-13 & JAN, GTIN, EAN-8, EAN2 & EAN5
4.1. EAN, IAN
4.2. EAN-13, JAN
4.3. GTIN
4.4. EAN-8
4.5. EAN2 & EAN5
4.6. Relation between UPC EAN GS1 GTIN

List of Figures

1.1. UPC Barcode Format
2.1. MSI exapmle 01234567 mode 10
4.1. Relation between UPC EAN GS1 GTIN

Chapter 1. Plessey


1.1. Barcode Basic Knowledge

  1. Bar

    bit 1, the vertical black line, called black bar or bar or dark bar.

  2. Space

    bit 0, the vertical white line/space area, called white space or space or light space

1.2. What is UPC

The UPC is Universal Product Code, is a barcode symbology.

The UPC is called, UPC-A.

1.3. Application Field

UPC is widely used in Canada and the United States for tracking trade items in stores

1.4. Example

Figure 1.1. UPC Barcode Format

UPC Barcode Format

1.5. Technical Detail

The UPC has only numerals (digital number), without letters (such as ‘A’, ‘B’,… ) or other (control / function ) characters.

Total 12 decimal digits, its format/syntax is:


In which:

  1. S – Start, E – End

    fixed bit pattern 101

  2. M – Middle

    fixed bit pattern 01010, called guard bars

  3. L – Left, R - Right

    both have 6 digits, each digit is a 7 bits code

So, total bits = S + L + M + R +E = 3 + 7 * 6 + 5 + 7 * 6 + 3 = 95 bits

Since S, M, and E all include two bars, and each of the 12 digits of the UPC-A barcode consists of two bars and two spaces, all UPC-A barcodes consist of exactly (3 × 2) + (12 × 2) = 30 bars.

For left digits and right digits:

The first digit L is the prefix.

The last digit R is an error correcting check digit, allowing some errors in scanning or manual entry to be detected.

UPC data structures are a component of GTINs (Global Trade Item Numbers). All of these data structures follow the global GS1 standards.

1.5.1. Bit Pattern of Digit

The bar-and-space patterns for each digit 0–9 are as follows:

Digit L Pattern R Pattern Widths
0 0001101 1110010 3211
1 0011001 1100110 2221
2 0010011 1101100 2122
3 0111101 1000010 1411
4 0100011 1011100 1132
5 0110001 1001110 1231
6 0101111 1010000 1114
7 0111011 1000100 1312
8 0110111 1001000 1213
9 0001011 1110100 3112

bit pattern for each numeral is designed to be as little like the others as possible, and to have no more than four consecutive 1s or 0s in order -> more easy to read and recognize it. Mirrored Bit Pattern Design

Numbers on the right side of the middle guard bars are optically the inverse of the numbers to the left. In other words, while a number on the left side of the UPC will be made up of black bars and white spaces, the same number on the right side would be indicated by the inverse (what was black on the left is now white and what was white is now black).

In the illustration above, the "4" digit (shown in detail) is 1011100 (bar × 1, space × 1, bar × 3, space × 2). If the "4" digit were on the left hand side it would be 0100011 (space × 1, bar × 1, space × 3, bar × 2).

This inversion enables the bar code to be scanned from left-to-right or right-to-left. Left-side digits consist of an even number of white space bits and an odd number of black bars. Right side digits are the opposite. Using this difference, the scanning software knows if it read the code the correct way or upside down.

1.5.2. Check Digit Calculation

In the UPC-A system, the check digit is calculated as follows:

  1. Add the digits in the odd-numbered positions (first, third, fifth, etc.) together and multiply by three.
  2. Add the digits in the even-numbered positions (second, fourth, sixth, etc.) to the result.
  3. Find the result modulo 10 (i.e. the remainder when divided by 10.. 10 goes into 58 5 times with 8 leftover).
  4. If the result is not zero, subtract the result from ten.

For example, a UPC-A barcode (in this case, a UPC for a box of tissues) 03600029145X" where X is the check digit, X can be calculated by

  1. adding the odd-numbered digits (0 + 6 + 0 + 2 + 1 + 5 = 14), multiplying by three (14 × 3 = 42),
  2. adding the even-numbered digits (42 + (3 + 0 + 0 + 9 + 4) = 58),
  3. calculating modulo ten (58 mod 10 = 8),
  4. subtracting from ten (10 - 8 = 2).

The check digit is thus 2.

This should not be confused with the real numeral "X" which stands for a value of 10 in modulo 11.

1.5.3. Prefixes

Prefix Value Usage/ Application Field
0[1], 1, 6, 7, 8 For most products
2 Reserved for local use (store/warehouse), for items sold by variable weight. Variable-weight items, such as meats and fresh fruits and vegetables, are assigned a UPC by the store, if they are packaged there. In this case, the LLLLL is the item number, and the RRRRR is either the weight or the price, with the first R determining which.
3 Drugs, by National Drug Code number. Pharmaceuticals in the U.S. have the remainder of the UPC as their National Drug Code (NDC) number; though usually only over-the-counter drugs are scanned at point-of-sale, NDC-based UPCs are used on prescription drug packages as well for inventory purposes
4 Reserved for local use (store/warehouse), often for loyalty cards or store coupons
5 Coupons, The Manufacturer code is the LLLLL, the first 3 RRR are a family code (set by manufacturer), and the next 2 RR are a coupon code. This 2-digit code determines the amount of the discount, according to a table set by the GS1 US, with the final R being the check digit. These coupons can be doubled or tripled
9 Coupons, The Manufacturer code is the LLLLL, the first 3 RRR are a family code (set by manufacturer), and the next 2 RR are a coupon code. This 2-digit code determines the amount of the discount, according to a table set by the GS1 US, with the final R being the check digit. These coupons CANNOT be doubled or tripled
[Note] Note
  1. By prefixing these with a 0, they become EAN-13 rather than UPC-A. This does not change the check digit. All point-of-sale systems can now understand both equally.

Chapter 2. Zero-Compressed UPC ⇒ UPC-E


To allow the use of UPC barcodes on smaller packages where a full 12-digit barcode may not fit, a 'zero-compressed' version of UPC was developed called UPC-E.

This symbology differs from UPC-A in that it only uses a 6-digit code, does not use middle guard bars, and the end bit pattern (E) becomes 010101.

The way in which a 6-digit UPC-E relates to a 12-digit UPC-A is determined by the last (right-hand most) digit. With the manufacturer code represented by X's, and product code by N's then:

Last digit UPC-E equivalent is UPC-A equivalent is
0 XXNNN0 0XX000-00NNN + check
1 XXNNN1 0XX100-00NNN + check
2 XXNNN2 0XX200-00NNN + check
3 XXXNN3 0XXX00-000NN + check
4 XXXXN4 0XXXX0-0000N + check
5 XXXXX5 0XXXXX-00005 + check
6 XXXXX6 0XXXXX-00006 + check
7 XXXXX7 0XXXXX-00007 + check
8 XXXXX8 0XXXXX-00008 + check
9 XXXXX9 0XXXXX-00009 + check

For example a UPC-E barcode with the number 654321 would expand to the UPC-A 065100004327. You can convert UPC-E back to UPC-A using this web utility.

UPC-E check digits are calculated using this expanded string in the same way as used by UPC-A. The resulting check digit is not added to the barcode, however, but is encoded by manipulating the parity of the six digits which are present in the UPC-E - as shown in the following tables:

Check digit Parity pattern

Digit to be encoded Odd parity pattern Even parity pattern
0 3-2-1-1 1-1-2-3
1 2-2-2-1 1-2-2-2
2 2-1-2-2 2-2-1-2
3 1-4-1-1 1-1-4-1
4 1-1-3-2 2-3-1-1
5 1-2-3-1 1-3-2-1
6 1-1-1-4 4-1-1-1
7 1-3-1-2 2-1-3-1
8 1-2-1-3 3-1-2-1
9 3-1-1-2 2-1-1-3

Our example code 654321, therefore, would become 1-1-1 4-1-1-1 1-2-3-1 2-3-1-1 1-4-1-1 2-2-1-2 2-2-2-1 1-1-1-1-1-1. The resulting barcode would look roughly like this:

Figure 2.1. MSI exapmle 01234567 mode 10

MSI exapmle 01234567 mode 10

Chapter 3. Printing Considerations


3.1. Dimensions

UPC-A Bar code symbols can be printed at various densities to accommodate a variety of printing and scanning processes.

The significant dimensional parameter is called X-dimension, the ideal width of single module element. The X-dimension has to be constant in UPC-A symbol. The width of each bar (dark bar) and space (light bar) is determined by multiplying the X-dimension by the module width of each dark bar or light bar (1,2,3, or 4).

The X-dimension for the UPC-A at the nominal size is 0.33 mm (0.013 in.). UPC-A can be reduced or magnified in the range of 80% to 200%.

Nominal symbol height for UPC-A is 25.9 mm (1.0 in.). In UPC-A the dark bars forming the left, centre, and right Guard Bar Patterns are extended downwards by 5 times X-dimension. This also applies to the bars of the first and the last symbol characters of UPC-A symbol. See illustration.

3.2. Quiet Zone (Light Margin)

The minimum Quiet Zone width required by the UPC-A bar code symbol is 9 x X-dimension on both the left and right sides. UPC-E requires 9 X-dimension units on the left side and 7 on the right. (Source; UPC Symbol Specification Manual).

3.3. Barcode Text

Exactly 12 digits must be printed below the UPC-A barcode.

Chapter 4. EAN & IAN, EAN-13 & JAN, GTIN, EAN-8, EAN2 & EAN5


4.1. EAN, IAN

EAN means "European Article Number", but now renamed IAN (International Article Number) even though the abbreviation has been retained.

The EAN was developed as a superset of UPC, adding an extra digit to the beginning so that there would be plenty of numbers for the entire world.

4.2. EAN-13, JAN

An EAN-13 barcode is a 13 digit (12 + check digit) barcoding standard which is a superset of the original 12-digit UPC (Universal Product Code) system developed in the United States.

The EAN-13 barcode is defined by the standards organisation GS1.

The EAN-13 barcodes are used worldwide for marking products often sold at retail point of sale.

The numbers encoded in EAN-13 bar codes are product identification numbers, which are also called Japanese Article Number (JAN) in Japan.

4.3. GTIN

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.

4.4. EAN-8

An EAN-8 is a barcode and is derived from the longer European Article Number (EAN-13) code. It was introduced for use on small packages where an EAN-13 barcode would be too large; for example on cigarettes, pencils (though it is rarely used for pencils), and chewing gum packets.

EAN-8 barcodes may be used to encode GTIN-8s which are another set of product identifiers from the GS1 System.

It begins with a 2- or 3-digit GS1 prefix (which is assigned to each national GS1 authority) 5- or 4-digit item reference element depending on the length of the GS1 prefix), and a checksum digit.

EAN-8 codes are common throughout the world, and companies may also use them to encode RCN-8s (8-digit Restricted Circulation Numbers) used to identify own-brand products sold only in their stores. These are formatted as 0xxx xxxx or 2xxx xxxx.

4.5. EAN2 & EAN5

2-digit (EAN 2) and 5-digit (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), or books and weighted products like food (to indicate the selling price), respectively.

4.6. Relation between UPC EAN GS1 GTIN

The relation between UPC, EAN, GS1, GTIN, can be illustrated by following figure:

Figure 4.1. Relation between UPC EAN GS1 GTIN

Relation between UPC EAN GS1 GTIN


[3] EAN 8