The Universal Product Code (UPC) is a barcode symbology (i.e., a specific type of barcode), that is widely used in the United States and Canada for tracking trade items in stores.
The UPC encodes 12 decimal digits as SLLLLLLMRRRRRRE, where S (start) and E (end) are the bit pattern 101, M (middle) is the bit pattern 01010 (called guard bars), and each L (left) and R (right) are digits, each one represented by a seven-bit code. This is a total of 95 bits. The bit pattern for each numeral is designed to be as little like the others as possible, and to have no more than four 1s or 0s in order. Both are for reliability in scanning.
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.
The UPC has only numerals, with no letters or other characters. The first L digit 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.
UPC is technically UPC-A. 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. Subtract the result modulo 10 from ten.
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. For example a UPC-E barcode with the number 654321 would expand to the UPC-A 065100004327. |