Link to the host of this site- Marist College This project was supported by a grant (DUE #9752632) from the National Science Foundation.
            




      

     There is a Universal Product Code (UPC) on every product you buy. UPCs are used in a variety of ways. First of all, a UPC not only identifies the product, but also the type of the product and its manufacturer. With the UPC, each store identifies a price that appears on the cash register when the products bar code is scanned as one checks-out. Stores also use UPCs for inventory purposes. By using the UPC, the store can track products that sell quickly, ones that rarely sell, and make sure that all products are always in stock.
      The UPC system was created in 1973 by the US grocery industry as the standard bar code for marking products. Three years later, in 1976, the European Article Numbering (EAN) code was developed. This code is used by the rest of the world.
      There are five versions of the UPC and two of the EAN. The most commonly used in the US are the 12 digit Version A UPC and the 8 digit Version E UPC systems. The Version E system is used in special cases, such as for soda cans, a variety of smaller items, and magazines. In this section, the 12 digit version A system will be studied. In a 12-digit UPC a1-a2a3a4a5a6-a7a8a9a10a11-a12, the first digit, a1, referred to as the number system character, identifies the type of product. The following table gives the different values of a1 and when each is used.


     The second set of numbers a2a3a4a5a6 identifies the manufacture. The third set of numbers a7a8a9a10a11 identifies the product. The last digit a12 is the check digit. While it is not always printed, it is always encoded in the bar code. 

Twelve Digit UPC Check Digit Scheme

Given the 11 digit number a1-a2a3a4a5a6-a7a8a9a10a11 the check digit a12 is appended to create the UPC a1-a2a3a4a5a6-a7a8a9a10a11-a12 such that a12 satisfies the equation

3a1 + a2 + 3a3 + a4 + 3a5 + a6 + 3a7 + a8 + 3a9 + a10 + 3a11 + a12 = 0 (mod 10)

Examples:

Valid UPC: 0-53600-10054-0

Calculation: 3a1+a2+3a3+a4+3a5+a6+3a7+a8+3a9+a10+3a11+a12 (mod 10)

= 3· 0+5+3· 3+6+3· 0+0+3· 1+0+3· 0+5+3· 4+0 (mod 10)

= 0 + 5 + 9 + 6 + 0 + 0 + 3 + 0 + 0 + 5 + 12 + 0 (mod 10)

= 40 (mod 10)

= 0

Since the result of the calculation is 0, the UPC is valid. 

Invalid UPC: 3-70501-09110-4

Calculation: 3a1+a2+3a3+a4+3a5+a6+3a7+a8+3a9+a10+3a11+a12 (mod 10)

= 3· 3+7+3· 0+5+3· 0+1+3· 0+9+3· 1+1+3· 0+4 (mod 10)

= 9 + 7 + 0 + 5 + 0 + 1 + 0 + 9 + 3 + 1 + 0 + 4 (mod 10)

= 39 (mod 10)

= 9

Since the result of the calculation is not 0, the UPC is not a valid one.

       The twelve digit UPC check digit scheme does catch all single digit errors. However, it does not catch all transposition of adjacent digit errors. If a and b are two adjacent digits in a twelve digit UPC, the transposition error ...ab... ® ...ba... is not caught when |a – b| = 5.

      Writing Assignment: List all the possible numbers that could be check digits for the UPC check digit scheme. Explain how you got your answer.

      More Information on UPC's and EAN's can be found at the following sites:

Uniform Code Council, Inc.
UPC & Barcode Information
UPC/EAN Examples
For All Practical Purpose