UPC/UPC-A/UPC-E & EAN Barcode Symbology
Author: green-waste (at) 163.com
Bar: bit 1, the vertical black line, called black bar or bar or dark bar.
Space: bit 0, the vertical white line/space area, called white space or space or light space.
The UPC is Universal Product Code, is a barcode symbology.
The UPC is called, UPC-A.
UPC is widely used in < xmlnamespace prefix =”st1″ ns =”urn:schemas-microsoft-com:office:smarttags” />Canada and the United States for tracking trade items in stores
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:
S – Start
E – End
M – Middle
L – Left
R – Right
S, E: fixed bit pattern 101
M: fixed bit pattern 01010, called guard bars
L, R: 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.
The bar-and-space patterns for each digit 0–9 are as follows:
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.
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.
In the UPC-A system, the check digit is calculated as follows:
- Add the digits in the odd-numbered positions (first, third, fifth, etc.) together and multiply by three.
- Add the digits in the even-numbered positions (second, fourth, sixth, etc.) to the result.
- Find the result modulo 10 (i.e. the remainder when divided by 10.. 10 goes into 58 5 times with 8 leftover).
- 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
- adding the odd-numbered digits (0 + 6 + 0 + 2 + 1 + 5 = 14), multiplying by three (14 × 3 = 42),
- adding the even-numbered digits (42 + (3 + 0 + 0 + 9 + 4) = 58),
- calculating modulo ten (58 mod 10 = 8),
- 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.
Usage/ Application Field
0, 1, 6, 7, 8
For most products
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.
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
Reserved for local use (store/warehouse), often for loyalty cards or store coupons
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
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
 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.
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:
UPC-E equivalent is
UPC-A equivalent is
0XX000-00NNN + check
0XX100-00NNN + check
0XX200-00NNN + check
0XXX00-000NN + check
0XXXX0-0000N + check
0XXXXX-00005 + check
0XXXXX-00006 + check
0XXXXX-00007 + check
0XXXXX-00008 + check
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:
Digit to be encoded
Odd parity pattern
Even parity pattern
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:
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.
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).
Exactly 12 digits must be printed below the UPC-A barcode.
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.
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.
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.
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.
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.
1. Universal Product Code
2. European Article Number
3. EAN 8