If you go look in your refrigerator or pantry right now, you will find that just about every package you see has a UPC bar code printed on it. In fact, nearly every item that you purchase from a grocery store, department store and mass merchandiser has a UPC bar code on it somewhere.
The bar code from a bottle of Selsun Blue dandruff shampoo

Have you ever wondered where these codes come from and what they mean?Now, we will solve this mystery so that you can decode any UPC code you come across!
What's a UPC Bar Code?
"UPC" stands for Universal Product Code. UPC bar codes were originally created to help grocery stores speed up the checkout process and keep better track of inventory, but the system quickly spread to all other retail products because it was so successful.
UPCs originate with a company called the Uniform Code Council (UCC). A manufacturer applies to the UCC for permission to enter the UPC system. The manufacturer pays an annual fee for the privilege. In return, the UCC issues the manufacturer a sixdigit manufacturer identification number and provides guidelines on how to use it. You can see the manufacturer identification number in any standard 12digit UPC code, like this one that comes off the back of the book The Teenager's Guide to the Real World published by BYG Publishing:
You can see that the UPC symbol printed on a package has two parts:
 The machinereadable bar code
 The humanreadable 12digit UPC number
BYG Publishing's manufacturer identification number is the first six digits of the UPC number  639382. The next five digits  00039  are the item number. A person employed by the manufacturer, called the UPC coordinator, is responsible for assigning item numbers to products, making sure the same code is not used on more than one product, retiring codes as products are removed from the product line, etc. In general, every item the manufacturer sells, as well as every size package and every repackaging of the item, needs a different item code. So a 12ounce can of Coke needs a different item number than a 16ounce bottle of Coke, as does a 6pack of 12ounce cans, a 12pack, a 24can case, and so on. It is the job of the UPC coordinator to keep all of these numbers straight!
The last digit of the UPC code is called a check digit. This digit lets the scanner determine if it scanned the number correctly or not. Here is how the check digit is calculated for the other 11 digits, using the code 63938200039 from The Teenager's Guide to the Real World example shown above:
 Add together the value of all of the digits in odd positions (digits 1, 3, 5, 7, 9 and 11).
6 + 9 + 8 + 0 + 0 + 9 = 32
 Multiply that number by 3.
32 * 3 = 96
 Add together the value of all of the digits in even positions (digits 2, 4, 6, 8 and 10).
3 + 3 + 2 + 0 + 3 = 11
 Add this sum to the value in step 2.
96 + 11 = 107
 Take the number in Step 4. To create the check digit, determine the number that, when added to the number in step 4, is a multiple of 10.
107 + 3 = 110
The check digit is therefore 3.
Each time the scanner scans an item, it performs this calculation. If the check digit it calculates is different from the check digit it reads, the scanner knows that something went wrong and the item needs to be rescanned.
How is the Price Determined?
As you can see, there is no price information encoded in a bar code. When the scanner at the checkout line scans a product, the cash register sends the UPC number to the store's central POS (point of sale) computer to look up the UPC number. The central computer sends back the actual price of the item at that moment.
This approach allows the store to change the price whenever it wants, for example to reflect sale prices. If the price were encoded in the bar code, prices could never change. On the other hand, not encoding a fixed price gives the store an easy way to rip off customers. When you hear about "scanner fraud" in the news, that is what the newsperson is talking about. It is incredibly easy for a store to mistakenly or purposefully overprice an item.
One thing you will notice if you start looking at UPC codes in detail is that the big manufactures have manufacturer IDs with lots of zeros in them. Here are a few:
Here is the bar code from a 3liter bottle of Diet Coke:
You can see that Coke's manufacturer ID is 049000. However, if you look at can of Coke or most 2liter bottles, you will find that the UPC code is much shorter  only eight digits total. Here's the bar code from a 2liter bottle of Sprite:
These short bar codes are called zerosuppressed numbers. There's a set of rules around forming zerosuppressed numbers from full numbers, but the basic idea is to leave out a set of four digits, all zeros. In the case of the Sprite UPC code, the 049 at the beginning is the first three digits of Coke's 049000 manufacturer ID. The 551 is the item number for this bottle of Sprite, shortened from 00551. The zero in the secondtolast digit is the fourth digit from Coke's manufacturer ID. The final digit is the normal check digit. The main reason for having zerosuppressed numbers is to create smaller bar codes for small product packages like 12ounce cans.
The first digit of the manufacturer's identification number is special. It is called the number system character. The following table shows you what different number system characters mean:
0 
Standard UPC number (must have a zero to do zerosuppressed numbers) 
1 
Reserved 
2 
Randomweight items (fruits, vegetables, meats, etc.) 
3 
Pharmaceuticals 
4 
Instore marking for retailers (A store can set up its own codes, but no other store will understand them.) 
5 
Coupons 
6 
Standard UPC number 
7 
Standard UPC number 
8 
Reserved 
9 
Reserved 
Here is an example of a pharmaceutical bar code (number system character 3), this one from a 4ounce bottle of Selsun Blue dandruff shampoo:
Here is an example of instore marking (number system character 4), in this case from a $10 Toys R Us gift certificate:
Since Toys R Us is the only store that will ever use this bar code  it's the only place where the gift certificate can be redeemed  Toys R Us made up its own UPC code for the gift certificate and used number system 4 so it could do that.
What is a Coupon code?
The coupon code is interesting (number system character 5). If you have ever wondered how the scanner can read a coupon and reject it if you haven't bought the product, here's your explanation. Here is the UPC code from a box of Post Honey Nut Shredded Wheat:
Here is the coupon for the same product:
You can see that the coupon's bar code starts with a 5 to indicate that it is a coupon. The 43000 is Post's manufacturer ID. The next three digits (186) are called the family code. The next two digits (70) are a value code. The final digit is the normal check digit.
The family code and value code are set up arbitrarily by the UPC coordinator for the manufacturer. It must be done that way because a coupon will often be usable for a whole family of products. For example, a coupon might be good for four different kinds of soap made by the same manufacturer. In the same way, the value code represents the value of the coupon arbitrarily. The manufacturer sends the retailer the data that tells the retailer's computer exactly which products fit the family code, and exactly how much to take off. When the coupon is scanned, the POS computer:
 Decodes the family code
 Checks to make sure the customer purchased an item from the family
 Decodes the value code
 Sends the discount back to the cash register
The next time you go to the store, pick up a product  any product. Look at its UPC code: Now you know what it means!
Can I Decode the Bars?
So let's say you would like to decode the actual bars in the bar code and map them to numbers. This is something that will make you crosseyed, but it can be done.
First of all, look at any 12digit bar code. It is made up of black bars and white spaces between the bars. Assume that the thinnest bar or space that you see (for example, the first bar on the left) can be called "one unit wide." The bars and spaces can therefore be seen to have proportional widths of one, two, three or four units. If you look at any bar code you can see examples of these four widths.
The start of any bar code is "111." That is, starting at the left you find a oneunitwide black bar followed by a oneunitwide white
space followed by a oneunitwide black bar (barspacebar). Following the start code, the digits are encoded like this:
0 = 3211
1 = 2221
2 = 2122
3 = 1411
4 = 1132
5 = 1231
6 = 1114
7 = 1312
8 = 1213
9 = 3112
(Something to notice: All of these encodings seem to add up to 7.)
So let's take this barcode as an example:
The code embedded in the bars is 043000181706:
 The bar code starts with the standard start code of 111 (barspacebar).
 The zero is 3211 (spacebarspacebar).
 The four is 1132 (spacebarspacebar).
 The three is 1411 (spacebarspacebar).
 The next three zeros are 3211 (spacebarspacebar).
 In the middle there is a standard 11111 (spacebarspacebarspace), which is important because it means the numbers on the right are optically inverted!
 The one is 2221 (barspacebarspace).
 The eight is 1213 (barspacebarspace).
 The one is 2221 (barspacebarspace).
 The seven is 1312 (barspacebarspace).
 The zero is 3211 (barspacebarspace).
 The six is 1114 (barspacebarspace).
 The stop character is a 111 (barspacebar).
Have fun decoding those 12digit bar codes!
Lots More Information!
Related stuff.dewsoftoverseas.com Articles
More Great Links!
