Bar codes, the most common of which is the Universal Product Codes (UPCs), are images printed on products for sale that can be read and interpreted by a laser bar code reader, which in turn converts the bar coded information to a sequence of numbers that can be used to identify individual products in a database. The images printed are a sequence of black and white bars that represent different numbers. Converting bar codes to digits is a straightforward process.

Things You Will Need
  • Example bar code

  • Table of bar codes

Obtain a bar code example. Look on a bag or box for a product that has been purchased in a grocery store. The UPC code is either stamped or printed onto paper or plastic and is usually nearly square shaped. The code will be comprised of alternating black and white bars, generally with a regular number stamped below them.

Create a bar code transposition table. Draw a rectangular box on a piece of paper with three columns and 10 rows. Label the columns from left to right as such: Number, Left, Right. The transposition table will be comprised of all the possible sequences in the code for the numbers available for a particular code. For the UPC, there are no letters or other symbols, which leaves just the digits 0 through 9 (see "Tips" for more chart information).

Read your example bar chart from left to right. Skip the first two black bars as they are just placeholders. Count over across the next seven bars, including the white ones. Those seven bars represent the first number. Write down a 1 for a black bar and a 0 for a white one. You should end up with a number such as: 0110111.

Look for that sequence of bars in the table you made. The number corresponding to it is the first number your write down in your transcription. If it was 0110111, for example, you’d write down 8.

Continue reading the barcode from left to right, counting the next seven bars. That’s your next number. Use your table to convert it to a number as well. Continue in this manner until you have six numbers written down.

Skip the 0101 pattern of bars in the middle of the bar code as they are only placeholders.

Continue with the next six numbers as you did the first six, writing down each number as you go. You should wind up with a 12 digit number that has been converted from its bar code format.


To help keep track of which group of seven bars represent a digit on a bar code, use a piece of paper to blot out other bars.

Using a magnifying glass can help more clearly see the individual bars.

To create numbers, bars are used to represent 0s and 1s. A black bar is a 1 and a white bar is a 0. The order of the bars describes a particular number. The sequence, White White White Black Black White Black, for example, is used to represent the number 0. All of the sequences of bars are predefined so they don’t need to be calculated.

The bars printed on a UPC code are separated into five separate areas. The first is at the beginning of the code on the far left, it is always represented by 101 (Black White Black). At the other end, on the far right is the same code representing the end of the code; it, too, is always represented by 101. In the center of the code is a placeholder that serves only to separate the two halves of the code. Between the center and the ends are the sections of bars representing numbers on the left, and numbers on the right.

The numbers that are represented by the bars on the left are inverses of the numbers on the right. If the bars are lined up as 0001101 on the left side of the code, they represent the number 0. On the right side though the number 0 is the exact opposite and looks like: 1110010.

This is where the transposition table comes in.

Copy the table below onto your paper then delineate the columns and rows with lines.

No. Left Right 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


Because some products are so small, a different kind of bar code is sometimes used that takes up less space.

Some grocery and other stores use different kinds of bar codes than the UPC, which means converting to digits would be done differently.