Universal Product Code

barcodeThe Universal Product Code (UPC) is a barcode symbology (i.e., a specific type of barcode). 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.

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 consecutive 1s or 0s in order.

The first digit L is the prefix. The last digit R is an error correcting check digit, allowing some errors in scanning or manual entry to be detected.

The bar-and-space patterns for each digit 0–9 are as follows:


L Pattern

R Pattern

0 0001101 1110010
1 0011001 1100110
2 0010011 1101100
3 0111101 1000010
4 0100011 1011100
5 0110001 1001110
6 0101111 1010000
7 0111011 1000100
8 0110111 1001000
9 0001011 1110100

Before the Middle guard bars, a binary 1 is indicated by a bar, while a 0 is indicated by a space. After the Middle guard bars, however, the patterns are optically inverted. In other words, a 1 is now indicated by a space, and a 0 is now indicated by a bar.


  • 0, 1, 6, 7, 8, or 9: For most products
  • 2: Reserved for local use (store/warehouse), for items sold by variable weight.
  • 3: Drugs by National Drug Code number
  • 4: Reserved for local use (store/warehouse), often for loyalty cards or store coupons.
  • 5: Coupons : The Manufacturer code is the LLLLL, the first 3 RRR are a family code (set by manufacturer), and the next 2 RR are a coupon code. This 2-digit code determines the amount of the discount

Check digit calculation

The check digit is calculated as follows:

  • Add the digits in the odd-numbered positions (first, third, fifth, etc.) together and multiply by three.
  • Add the digits in the even-numbered positions (second, fourth, sixth, etc.) to the result.
  • Find the result modulo 10 (i.e. the remainder when the result is divided by 10).
  • If the result is not zero, subtract the result from ten.

For example, a UPC-A barcode (in this case, a UPC for a box of tissues) “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), calculating modulo 10 (58 mod 10 = 8), subtracting from ten (10 − 8 = 2). The check digit is thus 2.

Click here and here to read more.

0 Responses to “Universal Product Code”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

So what’s this blog about?

Another attempt? Well yes. Attempting to figure out another sustainable model (there are some other attempts going on parallel-ly). Well, we have a lot of questions in mind. we read up stuff, we do some research to find answers to these questions. This is an attempt to publish that little 15-20 minute research.

Click to subscribe to One Post Daily.

Join 5 other followers