Universal Product Code (English: Universal Product Code, UPC) is a commodity bar code developed by the U.S. Uniform Code Council, which is mainly used in the United States and Canada. The European commodity code developed on its basis has developed into the most widely applicable universal bar code.
History of UPC
UPC was born on the basis of the ring code of IBM engineer Norman Woodland[1]. In 1966, the National Association of Food Chains (NAFC) required the development of equipment to speed up the inspection and acceptance of goods. The National Cash Register (the predecessor of IBM) was developed in 1967 to replace Wood The new concentric circle code of the RAND bull’s eye code.
In the summer of 1970, at the request of the National Food Chain Association, Logicon developed the Universal Grocery Products Identification Code (UGPIC) for the food industry, based on the IBM George Laurel design plan [2] [3]. Soon, the American supermarket Ad Hoc organization made UPC under the suggestion of Logicon. The U.S. Uniform Code Council established the UPC system in 1973 and realized the standardization of the code system. UPC was first tested in the grocery retail industry. On June 25, 1974, the Marsh supermarket in Ohio installed the first UPC scanner manufactured by NCR. Among the 27 products using UPC, the first one scanned by the cashier Sharon Buchanan was a pack of ten Wrigley chewing gums priced at 69 cents. Within ten years, barcode scanners accounted for half of American supermarkets. By 1989, it had reached 62% of all food stores in the United States.
In 1992, the Wellcome Supermarket in Hong Kong (called “Dinghao” in Taiwan) became the first supermarket in Hong Kong to use the UPC system, providing customers with faster and more convenient payment services. According to the 2004-2008 report, the number of branches in Wellcome Supermarket has increased as a result.
UPC encoding rules

UPC can only be used to represent numbers from 0-9. Every 7 modules express a character, and each module has two states: empty (white) and bar (black).
UPC is divided into five versions: UPC-A, B, C, D, and E.
UPC-A
It is used for general-purpose products and is the most widely applicable UPC. There are a total of 113 modules, each of which is 0.33 mm long. The two left and right blanks each consist of 9 modules. UPC-A is a fixed-length code, which can only represent 12 digits. From left to right, it is the start code of 3 modules (101), the system code of 1 bit, the data code of 5 digits on the left, the middle code of 5 modules (01010), and the data of 5 digits on the right. Code, check code, termination code of 3 modules (101). Among them, the module length of the start code, intermediate code, and stop code must be longer than the data code.
Correspondence rule: The data code on the left and the data code on the right have different numerical correspondence rules. The data code on the left contains an odd number of modules, and the data code on the right contains an even number. The logic value corresponding to the black module is 1, and the white module is 0.
Data code on the left | Data code on the right | |
Value | Logical value | Logical value |
0 | 0001101 | 1110010 |
1 | 0011001 | 1100110 |
2 | 0010011 | 1101100 |
3 | 0111101 | 1000010 |
4 | 0100011 | 1011100 |
5 | 0110001 | 1001110 |
6 | 0101111 | 1010000 |
7 | 0111011 | 1000100 |
8 | 0110111 | 1001000 |
9 | 0001011 | 1110100 |
It can be seen that the data code on the left is the inverse of the data code on the right.
The number 4 in the above figure is an example: first make sure it is the right data code, and then read its logical value: 1011100. Converted into bars and spaces are: thin black (1), thin white (0), thick black (111), thick white (00).
Check code: The check code is the last digit of all 12-digit data codes. If the first eleven digits of the data code are named N1-N11 from left to right, the check code is named C. The calculation method of the check code C is as follows:
CC=(N1+N3+N5+N7+N9+N11)×3 +(N2+N4+N6+N8+N10), and then take one digit;
C=10–CC (If the C value is 10, then take 0).
Take the barcode in the figure as an example, CC=(0+6+0+2+1+5)×3+(3+0+0+9+4)=58, C=2
UPC-B/C/D
Basically the same as UPC-A. Among them: B code is mainly used for medicine and health; C code is used for industrial departments, the second digit is the system code, and the penultimate digit is the check code; D code is used for warehouse wholesale, and the third digit is the check code.
UPC-E
Short code, the total length is 8 characters. The corresponding rule of numbers between A code and E code is related to the last check code. As follows:
Check code | UPC-E | UPC-A |
0 | XXNNN0 | 0XX000-00NNN+check code |
1 | XXNNN1 | 0XX100-00NNN+check code |
2 | XXNNN2 | 0XX200-00NNN+check code |
3 | XXXNN3 | 0XXX00-000NN+check code |
4 | XXXXN4 | 0XXXX0-0000N+check code |
5 | XXXXX5 | 0XXXXX-00005+check code |
6 | XXXXX6 | 0XXXXX-00006+check code |
7 | XXXXX7 | 0XXXXX-00007+check code |
8 | XXXXX8 | 0XXXXX-00008+check code |
9 | XXXXX9 | 0XXXXX-00009+check code |
Correspondence law: As for the correspondence between numbers and modules, it is also related to the last digit:
Check code | Rules |
0 | EEEOOO |
1 | EEOEOO |
2 | EEOOEO |
3 | EEOOOE |
4 | EOEEOO |
5 | EOOEEO |
6 | EOOOEE |
7 | EOEOEO |
8 | EOEOOE |
9 | EOOEOE |
E means even code, O means odd code. The odd code of UPC-E is exactly the same as the odd code of UPC-A.
odd code | Even code | |
Value | Logical value | Logical value |
0 | 0001101 | 0100111 |
1 | 0011001 | 0110011 |
2 | 0010011 | 0011011 |
3 | 0111101 | 0100001 |
4 | 0100011 | 0011101 |
5 | 0110001 | 0111001 |
6 | 0101111 | 0000101 |
7 | 0111011 | 0010001 |
8 | 0110111 | 0001001 |
9 | 0001011 | 0010111 |
Check code: When calculating the check code of UPC-E, first convert it to the corresponding UPC-A, and then calculate the check code according to the same pattern.