How to Read Barcodes Without a Barcode Reader
Barcode

Barcodes are generated in such a way that "direct reading" by a human being is not a priority. However, that does not prevent us from knowing their exact mechanism. The process takes a few milliseconds for a computer, but that casual "beep!" represents a significant amount of information that includes country, company name, product, and a final verification designed to ensure the correct reading of the code.

A Brief History of the Barcode

Like many other inventions, the history of the first barcode for consumer products dates back to the late 1940s. Several names are associated with its creation, but at the top of the list are Norman Joseph Woodland and Bernard Silver. Both patented an initial version based on a circular design, and according to Woodland himself, it was inspired by Morse code.

Woodland ended up at IBM, which showed great interest in the system (even tried to buy the patent), but admitted that the necessary processing power was not yet available. 70 years later, barcodes are printed on almost anything you can imagine: food, medicine, tools, clothing... if it is sold by unit, package, or weight, you will most likely see one.

How Barcodes Work

Now, the magic question is... how do they work? How can a laser extract numbers from such thin lines? Obviously, if there is a reading problem, we always have the option of entering the numbers manually, but it all starts with a standard, and that is where the GS1 organization comes in, headquartered in Brussels.

With more than 100 offices worldwide and one and a half million registered companies, you basically have to deal with them if you need barcodes for your products. The two most popular formats are UPC-A and EAN-13. UPC-A is supposed to be used in the United States and Canada, but the magic of international trade makes it very easy to find examples of both formats.

How to Read Barcodes Without a Barcode Reader
GS1 codes. Our article focuses on UPC-A.

Let's take UPC-A as an example: Any code has 95 bars (yes, 95) that can be black or white, with three pillars of separation marking the start, center, and end. The pillars consume 11 bars (the pattern is 3-5-3), leaving a total of 84 bars to store information. These 84 bars are divided into twelve groups (one per number) of seven bars each. The configuration of the bars establishes the encoding of the group, and by extension, the digit you want to represent. Wikipedia did the heavy lifting by publishing an accurate chart with every possible combination:

How to Read Barcodes Without a Barcode Reader
The differences are subtle, but critical

There is something strange in that image, isn't there? One expects that the encoding for each digit would be the same on both sides of the code, but it does not work that way. In fact, a trained eye will probably notice a subtlety: the white bars on the left half are always even, while on the right half they are odd. Why? Because it guarantees the reading process even when the code is upside down, something that happens very often. If the reader recognizes that the white bars on the left side appear odd, it automatically knows it must start reading from the right side.

What does the number itself tell us? Once again we stay in the realm of UPC-A, and we discover that the first three digits represent the country. If you have some codes nearby that you want to explore, you can click here to enter the official GS1 prefix table, or alternatively, use this international identity search engine (it's enough to enter the code, but there is a limit of searches per day). The rest of the code includes the company and the product.

This is where GS1 makes its money: the big players in each market have a huge number of products, so they require the "country + company" section of the code to be short, otherwise they wouldn't be able to generate barcodes for their entire catalog. In contrast, companies with small offerings (ten products or less) can access a much cheaper prefix.

How to Read Barcodes Without a Barcode Reader
An example of a UPC-A code on a Logitech mouse: 09785506395-3

The closing of this article belongs to the last digit of the UPC-A barcode, which is essentially the checksum, a control that confirms the correct reading of the code. How is it calculated? First we sum the six digits in the odd positions of the code, and multiply by three. Then we sum the five digits in the even positions. Then we add the results of both operations. The last step is to take that number and add the check digit, which should turn the result into a multiple of 10. Let's test it with our Logitech mouse code:

  1. (0 + 7 + 5 + 0 + 3 + 5) = 20
  2. (20 x 3) = 60
  3. (9 + 8 + 5 + 6 + 9) = 37
  4. (60 + 37) = 97
  5. (97 + 3) = 100

As the image shows.