The **UPC** (**Universal Product Code)** was the original barcode widely used in the United States and Canada for items in stores. The first item to ever be placed under a UPC scanner in a retail store is a 10-pack of Wrigley's Juicy Fruit chewing gum at Marsh's supermarket in Troy, Ohio, June 24, 1974.

The UPC (now officially **EAN.UCC-12**) encodes twelve digits as S__L__LLLLLM**RRRRR**__R__E, 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, seven bits long each. 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.

The UPC is only numerals, with no letters or other characters. The first __L__ digit is 0 for ordinary items, 3 for pharmaceuticals, 2 for random-weight items, and 5 for coupons (though stores often ignore this and use 000000 or 999999). The rest of L is the manufacturer code. The first five R digits are the product code assigned by the manufacturer. The last digit __R__ is a check digit, so that errors in scanning or manual entry can be detected. In the UPC-A system, the check digit is calculated as follows:

- Add the odd-numbered digits (first, third, fifth, etc.) together and multiply by three.
- Add the even-numbered digits (second, fourth, sixth, etc.) to the result.
- Subtract the result from the next-higher multiple of ten. The answer is the check digit.

For instance, a UPC-A barcode "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) and subtracting from the next-higher multiple of ten (60 - 58 = 2). The check digit is thus 2.

Pharmaceuticals in the U.S. have the remainder of the UPC as their National Drug Control (NDC) number. Random-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 _RRRR is either the weight or the price, with the first R determining which. Likewise, coupons are supposed to have the coupon code in LLLLL, the amount to be taken off in _RRRR, and whether that amount is a percent or a literal amount encoded in the first R.

## Representation

In the barcode, each number is represented by two bar and space configurations. One configuration is used in the "L" digits, while another is used in the "R" digits. This is done so that the barcode can be scanned forwards or backwards, and the scanner can determine from which direction the code is being scanned so that it can be registered correctly. If it were not for this, products could easily be registered incorrectly.

Each digit has four forms, of which two are used in UPC-A and three in EAN. For instance, the number 6 can be encoded as:

`0101111` (In the left half of a UPC-A barcode)
`1010000` (In the right half of a UPC-A barcode)
`0000101` (In an EAN barcode)
`1111010` (unused)

The first and second forms are the one's complement of each other, as are the third and fourth.

The (L) codes for the ten digits are:

- 0:
`0001101`
- 1:
`0011001`
- 2:
`0010011`
- 3:
`0111101`
- 4:
`0100011`
- 5:
`0110001`
- 6:
`0101111`
- 7:
`0111011`
- 8:
`0110111`
- 9:
`0001011`

The (R) codes are simply the one's complement of the (L) codes. All left-side digits have odd parity, while all right-side digits have even parity.

Company prefixes are assigned by EAN-UCC, which is now using longer company codes (with shorter item codes) for smaller companies.

## Expansion

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. The prefix digit 0 has been reserved for UPC, and in fact the Uniform Code Council has mandated all retail systems be able to recognize UPC and EAN together by the end of 2004. As of 2005, manufacturers will then be able to put only the 13-digit codes on their items, rather than having two separate numbers. In addition, this also expands the numbers available for the U.S. and Canada by 50%, adding 10 to 14 to the 00 to 09 (0 to 9 in UPC) already in use.

## External links