The 12-digit universal product code (UPC) is in widespread use on items for sale in the United States and many other countries. This Demonstration is designed to illustrate how the UPC number is encoded into the familiar looking bars seen on packaging. When the "show details" option is selected, guide lines appear. These guide lines show that each digit in the UPC number is represented by a sequence of seven bars. The bar code begins and ends with a 3-bar "guard bars" pattern and the bar code is separated into two parts by the 5-digit "center bars". Moving the cursor over the UPC number will show what the various parts of the number represent, and moving the cursor over the individual digits/spaces above the bar code will show a large graphic of the coding of those symbols.
The code for a digit depends on whether the digit appears before or after the center bars. The two codes for a digit are complements of each other (1's become 0's, 0's become ones; see snapshot 1). Several of the fixed examples are designed to allow easy comparison of the bars corresponding to certain digits before and after the space bars. See snapshots 2–4.
The last digit is the check digit. While the check digit does not always appear on the printed UPC code on a product, the bars for the check digit are always there. Given a UPC number , the check digit is chosen so that the weighted sum is divisible by 10.
 COMAP, For All Practical Purposes, New York: W. H. Freeman and Company, 2009.